unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* `C-x n s' binding in org-mode
@ 2008-06-22  7:30 Miles Bader
  2008-06-22  9:20 ` Bastien
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Miles Bader @ 2008-06-22  7:30 UTC (permalink / raw)
  To: emacs-devel

Org-mode adds a local binding to the `C-x n' keymap.

This really confused me for a while because I global rebind `C-x n' to
be something entirely different, so in org-mode, I ended up with a
keymap containing _only_ the org-mode binding, erasing my personal
binding.

Anyway, this binding seemed pretty dodgy to me; what do others think?

-Miles

-- 
I'd rather be consing.




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: `C-x n s' binding in org-mode
  2008-06-22  7:30 `C-x n s' binding in org-mode Miles Bader
@ 2008-06-22  9:20 ` Bastien
  2008-06-22  9:23 ` Lennart Borgman (gmail)
  2008-06-22 12:05 ` Stefan Monnier
  2 siblings, 0 replies; 11+ messages in thread
From: Bastien @ 2008-06-22  9:20 UTC (permalink / raw)
  To: emacs-devel

Miles Bader <miles@gnu.org> writes:

> Org-mode adds a local binding to the `C-x n' keymap.
>
> This really confused me for a while because I global rebind `C-x n' to
> be something entirely different, so in org-mode, I ended up with a
> keymap containing _only_ the org-mode binding, erasing my personal
> binding.

I thought personal keybindings should rather be of the form `C-c [key]'

> Anyway, this binding seemed pretty dodgy to me; what do others think?

Looks quite natural to me.  The `s' stands for `subtree'.  `C-x n s'
narrows the buffer to the current subtree.

I remember I proposed this feature with a different keybinding -- I
think it was `C-x n h', with `h' for "headline".  But, as usual,
Carsten's proposal didn't take long to convince me.

-- 
Bastien




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: `C-x n s' binding in org-mode
  2008-06-22  7:30 `C-x n s' binding in org-mode Miles Bader
  2008-06-22  9:20 ` Bastien
@ 2008-06-22  9:23 ` Lennart Borgman (gmail)
  2008-06-22 12:05 ` Stefan Monnier
  2 siblings, 0 replies; 11+ messages in thread
From: Lennart Borgman (gmail) @ 2008-06-22  9:23 UTC (permalink / raw)
  To: Miles Bader; +Cc: Carsten Dominik, emacs-devel

Miles Bader wrote:
> Org-mode adds a local binding to the `C-x n' keymap.
> 
> This really confused me for a while because I global rebind `C-x n' to
> be something entirely different, so in org-mode, I ended up with a
> keymap containing _only_ the org-mode binding, erasing my personal
> binding.
> 
> Anyway, this binding seemed pretty dodgy to me; what do others think?

org-mode binds `C-x n s' to `narrow-to-subtree'. I guess that is because 
the `C-x n' prefix is used for other narrowing/widening functions.

Maybe org-mode could remap narrow-to-defun to narrow-to-subtree? Or 
maybe `C-x n s' should be reserved in the global map for major mode 
special narrowing functions?




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: `C-x n s' binding in org-mode
  2008-06-22  7:30 `C-x n s' binding in org-mode Miles Bader
  2008-06-22  9:20 ` Bastien
  2008-06-22  9:23 ` Lennart Borgman (gmail)
@ 2008-06-22 12:05 ` Stefan Monnier
  2008-06-22 12:15   ` Carsten Dominik
  2 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2008-06-22 12:05 UTC (permalink / raw)
  To: Miles Bader; +Cc: emacs-devel

> Org-mode adds a local binding to the `C-x n' keymap.
> This really confused me for a while because I global rebind `C-x n' to
> be something entirely different, so in org-mode, I ended up with a
> keymap containing _only_ the org-mode binding, erasing my personal
> binding.

> Anyway, this binding seemed pretty dodgy to me; what do others think?

The binding seems to make sense, although it's obviously not following
the major mode binding conventions.

Of course, org-mode should not bind "C-x n s" blindly, but should
instead use the same prefix as the one used by the "narrow submap".
But since (contrary to C-x and a few others) we do not have such an
explicit submap, it's pretty difficult.  I guess it could use where-is
on both narrow-to-region and widen and try to find the common
ancestor... Or we could simply define ctl-x-n-prefix, and then org-mode
could use where-is on that one.


        Stefan





^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: `C-x n s' binding in org-mode
  2008-06-22 12:05 ` Stefan Monnier
@ 2008-06-22 12:15   ` Carsten Dominik
  2008-06-22 12:39     ` Lennart Borgman (gmail)
                       ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Carsten Dominik @ 2008-06-22 12:15 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel, Miles Bader


On Jun 22, 2008, at 2:05 PM, Stefan Monnier wrote:

>> Org-mode adds a local binding to the `C-x n' keymap.
>> This really confused me for a while because I global rebind `C-x n'  
>> to
>> be something entirely different, so in org-mode, I ended up with a
>> keymap containing _only_ the org-mode binding, erasing my personal
>> binding.
>
>> Anyway, this binding seemed pretty dodgy to me; what do others think?
>
> The binding seems to make sense, although it's obviously not following
> the major mode binding conventions.

When making this binding, I loosely justified it for myself with this
section from the Emacs Lips Manual, "Major Mode Conventions"

      It is legitimate for a major mode to rebind a standard key
      sequence if it provides a command that does "the same job" in a
      way better suited to the text this mode is used for.  For example,
      a major mode for editing a programming language might redefine
      `C-M-a' to "move to the beginning of a function" in a way that
      works better for that language.

      It is also legitimate for a major mode to rebind a standard key
      sequence whose standard meaning is rarely useful in that mode.   
For
      instance, minibuffer modes rebind `M-r', whose standard meaning is
      rarely of any use in the minibuffer.  Major modes such as Dired or
      Rmail that do not allow self-insertion of text can reasonably
      redefine letters and other printing characters as special  
commands.


Using this philosophy, Org rebinds C-a, C-e, and C-k to slightly modify
the behavior of these functions in headlines with tags.

C-x n s  seemed a logical key for this.

- Carsten





^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: `C-x n s' binding in org-mode
  2008-06-22 12:15   ` Carsten Dominik
@ 2008-06-22 12:39     ` Lennart Borgman (gmail)
  2008-06-22 21:35     ` Stefan Monnier
  2008-06-23 14:14     ` Richard M Stallman
  2 siblings, 0 replies; 11+ messages in thread
From: Lennart Borgman (gmail) @ 2008-06-22 12:39 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Miles Bader, Stefan Monnier, emacs-devel

Carsten Dominik wrote:
> C-x n s  seemed a logical key for this.


It is more mnemonic than C-x n d, but is narrow-to-defun of any use in 
org-mode?




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: `C-x n s' binding in org-mode
  2008-06-22 12:15   ` Carsten Dominik
  2008-06-22 12:39     ` Lennart Borgman (gmail)
@ 2008-06-22 21:35     ` Stefan Monnier
  2008-06-23  0:38       ` Miles Bader
  2008-06-23 14:14     ` Richard M Stallman
  2 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2008-06-22 21:35 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-devel, Miles Bader

>> The binding seems to make sense, although it's obviously not following
>> the major mode binding conventions.

> C-x n s  seemed a logical key for this.

I agree in the first sentence above, so I'm not going to argue
any further.  I'd just point out that maybe we should update the manual
to indicate that `remap'ing may often be a beter choice, although in
this specific instance it would either not be applicable (since C-x
n s has no other binding currently) or require using another key
(e.g. C-x n d).


        Stefan





^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: `C-x n s' binding in org-mode
  2008-06-22 21:35     ` Stefan Monnier
@ 2008-06-23  0:38       ` Miles Bader
  2008-06-23  1:20         ` Stefan Monnier
  0 siblings, 1 reply; 11+ messages in thread
From: Miles Bader @ 2008-06-23  0:38 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel, Carsten Dominik

Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> C-x n s  seemed a logical key for this.
>
> I agree in the first sentence above, so I'm not going to argue
> any further.  I'd just point out that maybe we should update the manual
> to indicate that `remap'ing may often be a beter choice, although in
> this specific instance it would either not be applicable (since C-x
> n s has no other binding currently) or require using another key
> (e.g. C-x n d).

I'd like to change the code to add a "narrowing-map" or something -- the
fewer hardwired bindings in random code, the better.

-Miles

-- 
Mayonnaise, n. One of the sauces that serve the French in place of a state
religion.




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: `C-x n s' binding in org-mode
  2008-06-23  0:38       ` Miles Bader
@ 2008-06-23  1:20         ` Stefan Monnier
  0 siblings, 0 replies; 11+ messages in thread
From: Stefan Monnier @ 2008-06-23  1:20 UTC (permalink / raw)
  To: Miles Bader; +Cc: emacs-devel, Carsten Dominik

>>> C-x n s  seemed a logical key for this.
>> 
>> I agree in the first sentence above, so I'm not going to argue
>> any further.  I'd just point out that maybe we should update the manual
>> to indicate that `remap'ing may often be a beter choice, although in
>> this specific instance it would either not be applicable (since C-x
>> n s has no other binding currently) or require using another key
>> (e.g. C-x n d).

> I'd like to change the code to add a "narrowing-map" or something -- the
> fewer hardwired bindings in random code, the better.

Please do,


        Stefan




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: `C-x n s' binding in org-mode
  2008-06-22 12:15   ` Carsten Dominik
  2008-06-22 12:39     ` Lennart Borgman (gmail)
  2008-06-22 21:35     ` Stefan Monnier
@ 2008-06-23 14:14     ` Richard M Stallman
  2008-06-23 14:17       ` Miles Bader
  2 siblings, 1 reply; 11+ messages in thread
From: Richard M Stallman @ 2008-06-23 14:14 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: miles, monnier, emacs-devel

    Using this philosophy, Org rebinds C-a, C-e, and C-k to slightly modify
    the behavior of these functions in headlines with tags.

    C-x n s  seemed a logical key for this.

It seems logical to me, too.  If there is a flaw here, I think it is
not in Org mode.

Perhaps our conclusion should be that a user that rebinds C-x n and
uses Org mode should put something in org-mode-hook to clean up for
this.

Or perhaps Org mode should be changed to bind C-x n d instead.
Not that it's wrong to bind C-x n s, but if changing that to C-x n d
would save hassles for some people, why not?

Or maybe Org mode can verify that C-x n n is bound to
`narrow-to-region' before it binds C-x n s.

Or that map could be given a name.

One could also propose more elegant solutions involving additional
mechanisms in Emacs, but I think they would take a lot of time and it
would not be well spent.  It is better to take an easy way out, for
this, and spend our time on something more useful.




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: `C-x n s' binding in org-mode
  2008-06-23 14:14     ` Richard M Stallman
@ 2008-06-23 14:17       ` Miles Bader
  0 siblings, 0 replies; 11+ messages in thread
From: Miles Bader @ 2008-06-23 14:17 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel, monnier, Carsten Dominik

Richard M Stallman <rms@gnu.org> writes:
> Or that map could be given a name.

This is what I want to do.

-Miles

-- 
Patience, n. A minor form of despair, disguised as a virtue.




^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2008-06-23 14:17 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-22  7:30 `C-x n s' binding in org-mode Miles Bader
2008-06-22  9:20 ` Bastien
2008-06-22  9:23 ` Lennart Borgman (gmail)
2008-06-22 12:05 ` Stefan Monnier
2008-06-22 12:15   ` Carsten Dominik
2008-06-22 12:39     ` Lennart Borgman (gmail)
2008-06-22 21:35     ` Stefan Monnier
2008-06-23  0:38       ` Miles Bader
2008-06-23  1:20         ` Stefan Monnier
2008-06-23 14:14     ` Richard M Stallman
2008-06-23 14:17       ` Miles Bader

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).