unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* discrepancy between read-key-sequence and manual
@ 2006-09-11 13:42 David Kastrup
  2006-09-11 14:20 ` Kim F. Storm
  2006-09-11 19:58 ` Richard Stallman
  0 siblings, 2 replies; 5+ messages in thread
From: David Kastrup @ 2006-09-11 13:42 UTC (permalink / raw)



(info "(elisp) Active Keymaps")

states:

   Normally the active keymaps are the `keymap' property keymap, the
   keymaps of any enabled minor modes, the current buffer's local
   keymap, and the global keymap, in that order.  Therefore, Emacs
   searches for each input key sequence in all these keymaps.  Here is
   a pseudo-Lisp description of how this process works:

     (or (if overriding-terminal-local-map
             (FIND-IN overriding-terminal-local-map)
           (if overriding-local-map
               (FIND-IN overriding-local-map)
             (or (FIND-IN (get-text-property (point) 'keymap))
                 (FIND-IN-ANY emulation-mode-map-alists)
                 (FIND-IN-ANY minor-mode-overriding-map-alist)
                 (FIND-IN-ANY minor-mode-map-alist)
                 (if (get-text-property (point) 'local-map)
                     (FIND-IN (get-text-property (point) 'local-map))
                   (FIND-IN (current-local-map))))))
         (FIND-IN (current-global-map)))

However, the code in read-key-sequence actually does

    (or (if (or overriding-terminal-local-map
                overriding-local-map)
            (or (FIND-IN overriding-terminal-local-map)
                (FIND-IN overriding-local-map))
           [...]

Namely, if overriding-terminal-local-map is present but no match is
found in it, overriding-local-map is also searched for a match.

Should the code be made to match the documentation, or the other way
round?

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: discrepancy between read-key-sequence and manual
  2006-09-11 13:42 discrepancy between read-key-sequence and manual David Kastrup
@ 2006-09-11 14:20 ` Kim F. Storm
  2006-09-11 14:25   ` David Kastrup
  2006-09-11 19:58 ` Richard Stallman
  1 sibling, 1 reply; 5+ messages in thread
From: Kim F. Storm @ 2006-09-11 14:20 UTC (permalink / raw)
  Cc: emacs-devel

David Kastrup <dak@gnu.org> writes:

> Should the code be made to match the documentation, or the other way
> round?

The manual is supposed to document the current behaviour.
So please fix the manual.

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

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

* Re: discrepancy between read-key-sequence and manual
  2006-09-11 14:20 ` Kim F. Storm
@ 2006-09-11 14:25   ` David Kastrup
  0 siblings, 0 replies; 5+ messages in thread
From: David Kastrup @ 2006-09-11 14:25 UTC (permalink / raw)
  Cc: emacs-devel

storm@cua.dk (Kim F. Storm) writes:

> David Kastrup <dak@gnu.org> writes:
>
>> Should the code be made to match the documentation, or the other way
>> round?
>
> The manual is supposed to document the current behaviour.
> So please fix the manual.

Will do once I am through with this mess.  Good for headaches.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: discrepancy between read-key-sequence and manual
  2006-09-11 13:42 discrepancy between read-key-sequence and manual David Kastrup
  2006-09-11 14:20 ` Kim F. Storm
@ 2006-09-11 19:58 ` Richard Stallman
  2006-09-11 20:05   ` David Kastrup
  1 sibling, 1 reply; 5+ messages in thread
From: Richard Stallman @ 2006-09-11 19:58 UTC (permalink / raw)
  Cc: emacs-devel

Lots of documentation says that overriding-terminal-local-map
overrides overriding-local-map.  So I think we should make the code
fit all that documentation.

In practice, overriding-local-map is not used very much, so there is
not much chance for there to be code that depends on the current
behavior.

Does this patch do the job?


*** keyboard.c	11 Sep 2006 10:33:19 -0400	1.875
--- keyboard.c	11 Sep 2006 15:44:41 -0400	
***************
*** 8765,8781 ****
       the initial keymaps from the current buffer.  */
    nmaps = 0;
  
!   if (!NILP (current_kboard->Voverriding_terminal_local_map)
!       || !NILP (Voverriding_local_map))
      {
!       if (3 > nmaps_allocated)
  	{
! 	  submaps = (Lisp_Object *) alloca (3 * sizeof (submaps[0]));
! 	  defs    = (Lisp_Object *) alloca (3 * sizeof (defs[0]));
! 	  nmaps_allocated = 3;
  	}
        if (!NILP (current_kboard->Voverriding_terminal_local_map))
  	submaps[nmaps++] = current_kboard->Voverriding_terminal_local_map;
        if (!NILP (Voverriding_local_map))
  	submaps[nmaps++] = Voverriding_local_map;
      }
--- 8765,8789 ----
       the initial keymaps from the current buffer.  */
    nmaps = 0;
  
!   if (!NILP (current_kboard->Voverriding_terminal_local_map))
      {
!       if (2 > nmaps_allocated)
  	{
! 	  submaps = (Lisp_Object *) alloca (2 * sizeof (submaps[0]));
! 	  defs    = (Lisp_Object *) alloca (2 * sizeof (defs[0]));
! 	  nmaps_allocated = 2;
  	}
        if (!NILP (current_kboard->Voverriding_terminal_local_map))
  	submaps[nmaps++] = current_kboard->Voverriding_terminal_local_map;
+     }
+   else if (!NILP (Voverriding_local_map))
+     {
+       if (2 > nmaps_allocated)
+ 	{
+ 	  submaps = (Lisp_Object *) alloca (2 * sizeof (submaps[0]));
+ 	  defs    = (Lisp_Object *) alloca (2 * sizeof (defs[0]));
+ 	  nmaps_allocated = 2;
+ 	}
        if (!NILP (Voverriding_local_map))
  	submaps[nmaps++] = Voverriding_local_map;
      }

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

* Re: discrepancy between read-key-sequence and manual
  2006-09-11 19:58 ` Richard Stallman
@ 2006-09-11 20:05   ` David Kastrup
  0 siblings, 0 replies; 5+ messages in thread
From: David Kastrup @ 2006-09-11 20:05 UTC (permalink / raw)
  Cc: emacs-devel

Richard Stallman <rms@gnu.org> writes:

> Lots of documentation says that overriding-terminal-local-map
> overrides overriding-local-map.  So I think we should make the code
> fit all that documentation.
>
> In practice, overriding-local-map is not used very much, so there is
> not much chance for there to be code that depends on the current
> behavior.
>
> Does this patch do the job?

It would appear so, but I am currently "flying by instrument", namely
just doing a 666 (reading and writing code, but not yet executing it).

I'll holler when I am through.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

end of thread, other threads:[~2006-09-11 20:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-11 13:42 discrepancy between read-key-sequence and manual David Kastrup
2006-09-11 14:20 ` Kim F. Storm
2006-09-11 14:25   ` David Kastrup
2006-09-11 19:58 ` Richard Stallman
2006-09-11 20:05   ` David Kastrup

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