Re: EmacsAssist

2006-03-29 Thread Anton V. Belyaev
Thanks a lot!
I cleaned up my code according to your review, the version is available
on the same link.
Please note also the way I got rid of eassist-do-for-first-suitable: I
used builtin find-if function.

___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: EmacsAssist

2006-03-28 Thread Klaus Berndl

What are the advantages of your Emacs-assist compared to speedbar or ECB -
both of them allow already the same functionality, maybe besides the
header-body switch. But concerning this IMHO this functionality should be
integrated into semantic/senator and must be much more customizable because
often header and body do not reside in the same directory

In general the ideas are good but should be integrated either in semantic or
maybe in ECB.

Ciao,
Klaus

On 27 Mar 2006, Anton V. Belyaev wrote:



  Remember VisualAssist for VisualStudio? If you lack its convinient M-o,
  M-m features in Emacs, EmacsAssist is for you. EmacsAssist is a C/C++
  code navigator, allowing rapid navigation between class methods and
  switch between header and body files (.h and .cpp).
  
  Comments, critics, feature requests are welcome.
  I am beginner in eLisp, so I would highly appreciate comments related
  to Elisp usage and Emacs API usage (for example if something is written
  ugly from point of view of experienced Elisp programmer).
  
 ;;; eassist.el --- EmacsAssist, C/C++ code navigator.
  
 ;; Copyright (C) 2006 Anton V. Belyaev
 ;; Author: Anton V. Belyaev anton.belyaev at the gmail.com
  
 ;; This file is *NOT* part of GNU Emacs.
  
 ;; This program is free software; you can redistribute it and/or
 ;; modify it under the terms of the GNU General Public License as
 ;; published by the Free Software Foundation; either version 2 of
 ;; the License, or (at your option) any later version.
  
 ;; This program is distributed in the hope that it will be
 ;; useful, but WITHOUT ANY WARRANTY; without even the implied
 ;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 ;; PURPOSE.  See the GNU General Public License for more details.
  
 ;; You should have received a copy of the GNU General Public
 ;; License along with this program; if not, write to the Free
 ;; Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 ;; MA 02111-1307 USA
  
 ;; Version: 0.1
  
 ;; Compatibility: Emacs 22, CEDET 1.0pre3.
  
 ;;; Commentary:
  
 ;; Contains some useful functions features for C/C++ developers similar
  to
 ;; those from VisualAssist. Remember that convinient M-o, M-g and M-m?
  
 ;; 1) Method navigaton.
 ;;When eassist-list-methods called when c/c++ body file buffer is
  active
 ;;a new buffer is shown, containing list of methods and functions
  in the
 ;;format: return type, class, method name. You can select the
  method
 ;;moving to its line and press ENTER to jump to the method. You
  also can
 ;;type a string in the buffer and method list will be reduced to
  those
 ;;which contain the string as a substring. Nice highlight is
  implemented.
 ;;This function is recommended to be bound to M-m in c-mode.
  
 ;; 2) Header - Body file switch.
 ;;You can easily switch between body (c, cpp, cc...) and its
  corresponding
 ;;header file (h, hpp...) using eassist-switch-h-cpp. The file is
  searched
 ;;in the same directory. You can adjust body to header
  correspondance
 ;;customizing eassist-header-switches variable.
 ;;This function is recommended to be bound to M-o in c-mode.
  
 ;; EmacsAssist uses Semantic
  (http://cedet.sourceforge.net/semantic.shtml)
 ;; EmacsAssist is defeloped for Semantics from CEDET 1.0pre3 package.
 ;; EmacsAssist works with current development (22) version of Emacs and
 ;; does not work with version 21.
  
 ;; Usage:
  
 ;; 1) Install CEDET 1.0pre3 package for Emacs (if you dont have CEDET
  already).
 ;; 2) Copy eassist.el to your emacs/lisp folder.
 ;; 3) Add to your .emacs following line to load EmacsAssist:
 ;;(require 'eassist)
 ;; 4) Add convinient keymaps for fast EmacsAssist calls in c-mode:
 ;;(defun my-c-mode-common-hook ()
 ;;  (define-key c-mode-base-map (kbd M-o) 'eassist-switch-h-cpp)
 ;;  (define-key c-mode-base-map (kbd M-m) 'eassist-list-methods))
 ;;(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
 ;; 5) Open any C++ file with class definithion, press M-m. Try to type
 ;;any method name.
 ;; 6) Open any .cpp file. Press M-o. If there is .h or .hpp file in the
 ;;same folder, it will be opened.
  
 ;;; Changelog:
  
 ;; 27 mar 2006 -- Initial version 0.1 created.
  
 ;;; Code:
  
 ;; == My STRING utils
  
  (defun eassist-string-last (string n)
(substring string (- (length string) n)))
  
  (defun eassist-string-without-last (string n)
(substring string 0 (max 0(- (length string) n
  
  (defun eassist-string-ends-with (string end)
(string= end (eassist-string-last string (length end
 ;; == My STRING utils end
  
  
 ;; == CPP-H switch
  ===
 ;; Funcalls action until it is not nil.
 ;; Returns result of the last action.
  (defun eassist-do-for-first-suitable (lst action)
(if (null lst)
nil

Re: EmacsAssist

2006-03-28 Thread Anton V. Belyaev
ECB is nice. But to select method from it you should navigate to it
with C-p C-n. Senator (a part of Semantic) allows to select method with
abbreviation.

EmacsAssist offers a better (faster!) way, IMHO:
You can type any substring from method name. And with every letter you
type you see the progress: method list is reduced to only those which
contain this substring. This saves you several TAB presses comparing to
using abbrev. And you can still select among them with C-p C-n. This
saves your time if the rest of the substring needed to pinpoint method
is complex.

It is hard to explain this convinience. Have you tried it? It should be
obvious after you have tried.

Maybe I'll generalize this type of list item selection to allow to
select buffer, file and whatsorever in such a way.

___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


EmacsAssist

2006-03-27 Thread Anton V. Belyaev
Remember VisualAssist for VisualStudio? If you lack its convinient M-o,
M-m features in Emacs, EmacsAssist is for you. EmacsAssist is a C/C++
code navigator, allowing rapid navigation between class methods and
switch between header and body files (.h and .cpp).

Comments, critics, feature requests are welcome.
I am beginner in eLisp, so I would highly appreciate comments related
to Elisp usage and Emacs API usage (for example if something is written
ugly from point of view of experienced Elisp programmer).

;;; eassist.el --- EmacsAssist, C/C++ code navigator.

;; Copyright (C) 2006 Anton V. Belyaev
;; Author: Anton V. Belyaev anton.belyaev at the gmail.com

;; This file is *NOT* part of GNU Emacs.

;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation; either version 2 of
;; the License, or (at your option) any later version.

;; This program is distributed in the hope that it will be
;; useful, but WITHOUT ANY WARRANTY; without even the implied
;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
;; PURPOSE.  See the GNU General Public License for more details.

;; You should have received a copy of the GNU General Public
;; License along with this program; if not, write to the Free
;; Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
;; MA 02111-1307 USA

;; Version: 0.1

;; Compatibility: Emacs 22, CEDET 1.0pre3.

;;; Commentary:

;; Contains some useful functions features for C/C++ developers similar
to
;; those from VisualAssist. Remember that convinient M-o, M-g and M-m?

;; 1) Method navigaton.
;;When eassist-list-methods called when c/c++ body file buffer is
active
;;a new buffer is shown, containing list of methods and functions
in the
;;format: return type, class, method name. You can select the
method
;;moving to its line and press ENTER to jump to the method. You
also can
;;type a string in the buffer and method list will be reduced to
those
;;which contain the string as a substring. Nice highlight is
implemented.
;;This function is recommended to be bound to M-m in c-mode.

;; 2) Header - Body file switch.
;;You can easily switch between body (c, cpp, cc...) and its
corresponding
;;header file (h, hpp...) using eassist-switch-h-cpp. The file is
searched
;;in the same directory. You can adjust body to header
correspondance
;;customizing eassist-header-switches variable.
;;This function is recommended to be bound to M-o in c-mode.

;; EmacsAssist uses Semantic
(http://cedet.sourceforge.net/semantic.shtml)
;; EmacsAssist is defeloped for Semantics from CEDET 1.0pre3 package.
;; EmacsAssist works with current development (22) version of Emacs and
;; does not work with version 21.

;; Usage:

;; 1) Install CEDET 1.0pre3 package for Emacs (if you dont have CEDET
already).
;; 2) Copy eassist.el to your emacs/lisp folder.
;; 3) Add to your .emacs following line to load EmacsAssist:
;;(require 'eassist)
;; 4) Add convinient keymaps for fast EmacsAssist calls in c-mode:
;;(defun my-c-mode-common-hook ()
;;  (define-key c-mode-base-map (kbd M-o) 'eassist-switch-h-cpp)
;;  (define-key c-mode-base-map (kbd M-m) 'eassist-list-methods))
;;(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
;; 5) Open any C++ file with class definithion, press M-m. Try to type
;;any method name.
;; 6) Open any .cpp file. Press M-o. If there is .h or .hpp file in the
;;same folder, it will be opened.

;;; Changelog:

;; 27 mar 2006 -- Initial version 0.1 created.

;;; Code:

;; == My STRING utils

(defun eassist-string-last (string n)
  (substring string (- (length string) n)))

(defun eassist-string-without-last (string n)
  (substring string 0 (max 0(- (length string) n

(defun eassist-string-ends-with (string end)
  (string= end (eassist-string-last string (length end
;; == My STRING utils end


;; == CPP-H switch
===
;; Funcalls action until it is not nil.
;; Returns result of the last action.
(defun eassist-do-for-first-suitable (lst action)
  (if (null lst)
  nil
(let ((res (funcall action (car lst
  (if (null res)
  (eassist-do-for-first-suitable (cdr lst) action)
res

(setq eassist-header-switches '(
 (h . (cpp cc c))
 (hpp . (cpp))
 (cpp . (h hpp))
 (c . (h))
 (cc . (h hpp))
 ))

(defun eassist-switch-h-cpp ()
  (interactive)
  (let ((ext (file-name-extension (buffer-file-name
(if (null (eassist-do-for-first-suitable eassist-header-switches
 (lambda (i

EmacsAssist

2006-03-27 Thread Anton V. Belyaev
Remember VisualAssist for VisualStudio? If you lack its convinient M-o,
M-m features in Emacs, EmacsAssist is for you. EmacsAssist is a C/C++
code navigator, allowing rapid navigation between class methods and
switch between header and body files (.h and .cpp).

Comments, critics, feature requests are welcome.
I am beginner in Elisp, so I would highly appreciate comments related
to Elisp usage and Emacs API usage (for example if something is written
ugly from point of view of experienced Elisp programmer).

Here is the link:
http://rain.ifmo.ru/~bell/eassist.el

___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources