Alan Mackenzie <[EMAIL PROTECTED]> writes: > o Do you program with auto-newline switched on (e.g. do you get NLs > inserted automatically after typing a `;' or `{')?
Yes. > o Did you configure this auto-newline setting yourself, and if not, are > you happy with it? Yes. I have some customization in my .emacs. I don't know elisp well enough to tell whether this code entirely makes sense, but it seems to do what I want: ;; Returns true if the last character typed by the user was a ;; semicolon. (This is a gross hack.) (defun newline-if-semi () (= last-command-char ?\;)) ... ;; My style for C, based on GNU style. (defconst blp-c-style ... ;; Insert a newline after a typed semicolon if the line after this ;; one is blank and we're not inside a set of parentheses. ;; Never insert a newline after a comma. (c-hanging-semi&comma-criteria . (c-semi&comma-no-newlines-before-nonblanks c-semi&comma-inside-parenlist newline-if-semi)) ... For what it's worth, I use this in conjunction with custom keybindings to create and end {} blocks: ;; Simplifies braced blocks: just type M-{ at the beginning, type ;; some statements, type M-} to end it, and no need to worry about ;; anything else. (local-set-key [?\M-{] 'insert-brace) (local-set-key [?\M-}] 'move-past-brace-and-reindent) ;; Inserts a pair of braces {}, properly spacing them, and puts the ;; cursor between them. (defun insert-brace () (interactive) (setq last-command-event ?{) (c-electric-brace nil) (c-indent-line) (save-excursion (insert "\n\n}") (c-indent-command))) (defun move-past-brace-and-reindent () (interactive) (delete-all-blank-lines) (search-forward "}") (let ((save-point)) (save-excursion (insert "\n") (c-indent-line) (setq save-point (point))) (funcall blink-paren-function) (goto-char save-point))) (defun delete-all-blank-lines () "Delete all surrounding blank lines." (interactive "*") (save-excursion (beginning-of-line) (if (looking-at "[ \t]*$") (delete-region (if (re-search-backward "[^ \t\n]" nil t) (progn (forward-line 1) (point)) (point-min)) (if (re-search-forward "[^ \t\n]" nil t) (progn (beginning-of-line) (point)) (point-max)))))) > o Are you aware of the key binding C-c C-a to toggle this mode on and > off? Yes. > o How often do you use C-c C-a (or even C-c C-t) to toggle auto-newline > mode? Hardly ever. > o In which language(s) (C, C++, ....) do you program in (X)Emacs? C mostly. Fairly often Perl, Bourne shell. Occasionally Java, C++. -- "Large amounts of money tend to quench any scruples I might be having." -- Stephan Wilms _______________________________________________ Help-gnu-emacs mailing list Help-gnu-emacs@gnu.org http://lists.gnu.org/mailman/listinfo/help-gnu-emacs