[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: about auto indentation
From: |
fgr |
Subject: |
Re: about auto indentation |
Date: |
Wed, 08 Dec 2010 15:23:41 -0000 |
2010-08-07 16:50 +0300, Teemu Likonen wrote:
| * 2010-08-07 15:11 (+0200), fgr@bir-tawil.nul.invalid wrote:
|
| > 2010-08-07 15:08 +0300, Teemu Likonen wrote:
| >> I guess you want command c-indent-new-comment-line which, by
| default, >> is bound to M-j key in c-mode.
| >
| > That command does an indentation but doesn't add any "*"
| character.
|
| Did you use M-j at the end of a comment line? The command should
| add a newline, indent and then add a comment character. That's
| what it does in my Emacs. Command's description:
|
| M-j runs the command c-indent-new-comment-line, which is an
| interactive compiled Lisp function in `cc-cmds.el'.
|
| It is bound to M-j, C-M-j.
|
| (c-indent-new-comment-line &optional SOFT ALLOW-AUTO-FILL)
[...]
Well, you can take a look at the following:
,----
| ~ % locate cc-cmds.el
| /usr/share/emacs/24.0.50/lisp/progmodes/cc-cmds.el.gz
| /usr/share/emacs/24.0.50/lisp/progmodes/cc-cmds.elc
`----
Maybe some setting influences the command in question. I don't know.
What follows is an extract of my ~/emacs.d/init.el:
(global-set-key (kbd "RET") 'newline-and-indent)
(setq comment-auto-fill-only-comments t)
(add-hook 'c-mode-common-hook '(lambda () (c-toggle-auto-state 1)))
(add-hook 'c-mode-common-hook '(lambda () (c-toggle-hungry-state 1)))
(add-hook 'c-mode-common-hook '(lambda () (c-subword-mode 1)))
(c-set-offset 'case-label '+) ; see Emacs FAQ, 5.22
;; To automatically fill comments but not code in ProgrammingModes
(add-hook 'c-mode-common-hook
(lambda ()
(auto-fill-mode 1)
(set (make-local-variable 'fill-nobreak-predicate)
(lambda ()
(not (eq (get-text-property (point) 'face)
'font-lock-comment-face))))))