Khuong Dinh Pham <[EMAIL PROTECTED]> writes: > Where can I find a script where I can generate the methods body from the > prototypes define the headers? > > Thx in advance
I use the following function to do this: (defun c++-convert-to-method-body () "Take a function prototype from the class definition and convert it to the implementation body" (interactive) (let ((class-name) (doit)) (save-excursion (back-to-indentation) (setq doit (looking-at ".+(.*); *$"))) (if doit (progn (save-excursion (re-search-backward "^[^ \t].+\\(\\<\\w+\\>*::\\)") (setq class-name (match-string-no-properties 1))) (back-to-indentation) (when (looking-at "virtual") (message class-name) (delete-region (match-beginning 0) (match-end 0))) (beginning-of-line) (re-search-forward "(") (re-search-backward "[ \t]") ;;(forward-char 1) (delete-horizontal-space) (insert " ") (insert class-name) (end-of-line) (delete-region (point) (- (point) 1)) (indent-according-to-mode) (insert " {\n\n}\n") (next-line 1)) (message "This line does not contain a valid method declaration")))) (define-key c++-mode-map [(control c) ?e] 'c++-convert-to-method-body) Now I copy the function definition from the header file to my cpp file and hit C-c e. The function works for most of the method definitions that I use. Stefan. _______________________________________________ Help-gnu-emacs mailing list Help-gnu-emacs@gnu.org http://lists.gnu.org/mailman/listinfo/help-gnu-emacs