[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: lisp-indent-line and comment-region in emacs-lisp-mode menu

From: Drew Adams
Subject: RE: lisp-indent-line and comment-region in emacs-lisp-mode menu
Date: Tue, 4 Mar 2008 16:49:02 -0800

> > Wouldn't it be better if the emacs-lisp-mode menu used
> > indent-for-tab-command instead of lisp-indent-line and
> Here is what I currently use:
> (define-key emacs-lisp-mode-map [tab] 'my-lisp-indent-or-complete)
> (defun my-lisp-indent-or-complete (&optional arg)
>   "Complete Lisp symbol, or indent line or region.
> If the character preceding point is symbol-constituent, then perform
> completion on Lisp symbol preceding point using 
> `lisp-complete-symbol'.
> Otherwise, call `indent-for-tab-command' that indents line or region."
>   (interactive "P")
>   (if (and (not (and transient-mark-mode mark-active
>                      (not (eq (region-beginning) (region-end)))))
>            (memq (char-syntax (preceding-char)) (list ?w ?_))
>            (not (bobp)))
>       (lisp-complete-symbol)
>     (indent-for-tab-command arg)))
> and find this very useful.  Maybe something like this should be added
> to emacs-lisp-mode and its menu?

I don't care if you add it, but please don't bind it to TAB. I use TAB to do
`lisp-indent-line' (the default) always. I don't want to have to move the
cursor away from a symbol constituent, just to be able to indent the line.
The beauty of TAB is that it works no matter where the cursor is on a line.

If you want to have TAB sometimes not indent (e.g. `lisp-complete-symbol'),
please do it via `tab-always-indent' = nil.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]