* lisp-indent-line and comment-region in emacs-lisp-mode menu
@ 2008-03-04 22:23 Dan Nicolaescu
2008-03-04 23:33 ` Juri Linkov
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Dan Nicolaescu @ 2008-03-04 22:23 UTC (permalink / raw)
To: emacs-devel
Wouldn't it be better if the emacs-lisp-mode menu used
indent-for-tab-command instead of lisp-indent-line and
comment-dwim instead of comment-region ?
The former don't have key bindings, but the latter do, so the menus
do not help users learn the key bindings.
What about "Indent region"? Currently TAB does when transient-mark-mode is on...
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: lisp-indent-line and comment-region in emacs-lisp-mode menu
2008-03-04 22:23 lisp-indent-line and comment-region in emacs-lisp-mode menu Dan Nicolaescu
@ 2008-03-04 23:33 ` Juri Linkov
2008-03-05 0:49 ` Drew Adams
2008-03-05 3:32 ` Dan Nicolaescu
2008-03-05 10:43 ` Juri Linkov
2008-03-05 18:41 ` Stefan Monnier
2 siblings, 2 replies; 9+ messages in thread
From: Juri Linkov @ 2008-03-04 23:33 UTC (permalink / raw)
To: emacs-devel
> 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?
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: lisp-indent-line and comment-region in emacs-lisp-mode menu
2008-03-04 23:33 ` Juri Linkov
@ 2008-03-05 0:49 ` Drew Adams
2008-03-05 10:40 ` Juri Linkov
2008-03-05 3:32 ` Dan Nicolaescu
1 sibling, 1 reply; 9+ messages in thread
From: Drew Adams @ 2008-03-05 0:49 UTC (permalink / raw)
To: 'Juri Linkov', emacs-devel
> > 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.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: lisp-indent-line and comment-region in emacs-lisp-mode menu
2008-03-04 23:33 ` Juri Linkov
2008-03-05 0:49 ` Drew Adams
@ 2008-03-05 3:32 ` Dan Nicolaescu
1 sibling, 0 replies; 9+ messages in thread
From: Dan Nicolaescu @ 2008-03-05 3:32 UTC (permalink / raw)
To: Juri Linkov; +Cc: emacs-devel
Juri Linkov <juri@jurta.org> writes:
> > 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?
Maybe, but let's go one step at a time, first use for menus a command
that is also bound to a key. And after that, discuss changing the key
bindings. The former should be easy, it's mostly a bug fix. The later
might be controversial.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: lisp-indent-line and comment-region in emacs-lisp-mode menu
2008-03-05 0:49 ` Drew Adams
@ 2008-03-05 10:40 ` Juri Linkov
2008-03-05 15:33 ` Drew Adams
0 siblings, 1 reply; 9+ messages in thread
From: Juri Linkov @ 2008-03-05 10:40 UTC (permalink / raw)
To: Drew Adams; +Cc: emacs-devel
> 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.
This is not the default anymore. TAB in emacs-lisp-mode now uses the
default TAB binding `indent-for-tab-command'. That's why Dan raised
this question. In Emacs 22, the Emacs-Lisp menu has the item:
Indent Line (TAB)
Now in CVS it shows a menu item with non-default `lisp-indent-line' that
has no key binding. I think it makes sense to replace it with the command
`indent-for-tab-command' that is bound to TAB.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: lisp-indent-line and comment-region in emacs-lisp-mode menu
2008-03-04 22:23 lisp-indent-line and comment-region in emacs-lisp-mode menu Dan Nicolaescu
2008-03-04 23:33 ` Juri Linkov
@ 2008-03-05 10:43 ` Juri Linkov
2008-03-05 18:41 ` Stefan Monnier
2 siblings, 0 replies; 9+ messages in thread
From: Juri Linkov @ 2008-03-05 10:43 UTC (permalink / raw)
To: emacs-devel
> Wouldn't it be better if the emacs-lisp-mode menu used
> indent-for-tab-command instead of lisp-indent-line and
> comment-dwim instead of comment-region ?
> The former don't have key bindings, but the latter do, so the menus
> do not help users learn the key bindings.
If comment-dwim does the same that comment-region does
when transient-mark-mode is on by default then I think
comment-region could be replaced with comment-dwim.
> What about "Indent region"? Currently TAB does when
> transient-mark-mode is on...
"Indent region" would be useless when transient-mark-mode is on.
But perhaps we should keep it for users who has the habit of using it.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: lisp-indent-line and comment-region in emacs-lisp-mode menu
2008-03-05 10:40 ` Juri Linkov
@ 2008-03-05 15:33 ` Drew Adams
0 siblings, 0 replies; 9+ messages in thread
From: Drew Adams @ 2008-03-05 15:33 UTC (permalink / raw)
To: 'Juri Linkov'; +Cc: emacs-devel
> > 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.
>
> This is not the default anymore. TAB in emacs-lisp-mode now uses the
> default TAB binding `indent-for-tab-command'.
I'm using Emacs 22, but `indent-for-tab-command' still respects
`tab-always-indent' in Emacs 23, no?
> That's why Dan raised this question. In Emacs 22, the Emacs-Lisp
> menu has the item: Indent Line (TAB)
>
> Now in CVS it shows a menu item with non-default
> `lisp-indent-line' that has no key binding. I think it makes
> sense to replace it with the command `indent-for-tab-command'
> that is bound to TAB.
I have no problem with the menu reflecting the default binding, and I didn't
object to Dan's suggestion.
I objected to your proposal to do something like the code you sent, *if* you
also intend to bind that to TAB. IIUC, your code does not respect
`tab-always-indent' - it simply completes a symbol if there is no active
region and the preceding char is a symbol or word constituent. I don't want
such behavior to be the default.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: lisp-indent-line and comment-region in emacs-lisp-mode menu
2008-03-04 22:23 lisp-indent-line and comment-region in emacs-lisp-mode menu Dan Nicolaescu
2008-03-04 23:33 ` Juri Linkov
2008-03-05 10:43 ` Juri Linkov
@ 2008-03-05 18:41 ` Stefan Monnier
2008-03-05 19:00 ` Dan Nicolaescu
2 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2008-03-05 18:41 UTC (permalink / raw)
To: emacs-devel
> Wouldn't it be better if the emacs-lisp-mode menu used
> indent-for-tab-command instead of lisp-indent-line and
> comment-dwim instead of comment-region ?
For indent-line, it might be OK, although it suffers from the problem
that indent-for-tab-command doesn't necessarily indent the current line.
For comment-region, the problem is worse because as long as
transient-mark-mode is off, comment-dwim does not do comment-region.
Those DWIMish bindings (TAB, M-;) are problematic in this situation
because the menu entry text cannot faithfully describe the behavior.
> The former don't have key bindings, but the latter do, so the menus
> do not help users learn the key bindings.
Indeed.
> What about "Indent region"? Currently TAB does when
> transient-mark-mode is on...
So are you suggesting to put TAB on both "indent line" and "indent
region"?
Stefan
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: lisp-indent-line and comment-region in emacs-lisp-mode menu
2008-03-05 18:41 ` Stefan Monnier
@ 2008-03-05 19:00 ` Dan Nicolaescu
0 siblings, 0 replies; 9+ messages in thread
From: Dan Nicolaescu @ 2008-03-05 19:00 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> > Wouldn't it be better if the emacs-lisp-mode menu used
> > indent-for-tab-command instead of lisp-indent-line and
> > comment-dwim instead of comment-region ?
>
> For indent-line, it might be OK, although it suffers from the problem
> that indent-for-tab-command doesn't necessarily indent the current line.
Them maybe the solution is not to have a menu called "Indent Line". If
we don't provide a key binding for such a thing, then we shouldn't
bother with a menu binding for it. What would be a better name for the
menu entry?
> For comment-region, the problem is worse because as long as
> transient-mark-mode is off, comment-dwim does not do comment-region.
Would making the menu depend on transient-mark-mode be an option?
Any better ideas?
> Those DWIMish bindings (TAB, M-;) are problematic in this situation
> because the menu entry text cannot faithfully describe the behavior.
> > The former don't have key bindings, but the latter do, so the menus
> > do not help users learn the key bindings.
>
> Indeed.
>
> > What about "Indent region"? Currently TAB does when
> > transient-mark-mode is on...
>
> So are you suggesting to put TAB on both "indent line" and "indent
> region"?
That might be a good idea for the transient-mark-mode: show the users
that the only key binding they need to know for indenting is TAB.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2008-03-05 19:00 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-04 22:23 lisp-indent-line and comment-region in emacs-lisp-mode menu Dan Nicolaescu
2008-03-04 23:33 ` Juri Linkov
2008-03-05 0:49 ` Drew Adams
2008-03-05 10:40 ` Juri Linkov
2008-03-05 15:33 ` Drew Adams
2008-03-05 3:32 ` Dan Nicolaescu
2008-03-05 10:43 ` Juri Linkov
2008-03-05 18:41 ` Stefan Monnier
2008-03-05 19:00 ` Dan Nicolaescu
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.