all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: <fgr@bir-tawil.nul.invalid>
To: help-gnu-emacs@gnu.org
Subject: Re: about auto indentation
Date: Sat, 7 Aug 2010 16:57:05 +0200	[thread overview]
Message-ID: <20100807165705.04e89ba8@bir-tawil.nul> (raw)
In-Reply-To: 87eieasfau.fsf@mithlond.arda

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))))))



  reply	other threads:[~2010-08-07 14:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-07 11:22 about auto indentation fgr
2010-08-07 12:08 ` Teemu Likonen
     [not found]   ` <20100807151110.5a60f768@bir-tawil.nul>
2010-08-07 13:50     ` Teemu Likonen
2010-08-07 14:57       ` fgr [this message]
2010-08-07 15:20         ` fgr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100807165705.04e89ba8@bir-tawil.nul \
    --to=fgr@bir-tawil.nul.invalid \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.