unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* minibuffer and current-local-map
@ 2007-11-07 16:30 Stephen Berman
  2007-11-08  4:42 ` Richard Stallman
  0 siblings, 1 reply; 10+ messages in thread
From: Stephen Berman @ 2007-11-07 16:30 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 2649 bytes --]

The value returned by current-local-map for the minibuffer seems to be
wrong (both in the trunk and in Emacs 22.1), containing partial
reduplication:

(keymap
 (C-tab . file-cache-minibuffer-complete)
 (10 . minibuffer-complete-and-exit)
 (13 . minibuffer-complete-and-exit)
 keymap
 (menu-bar keymap
	   (minibuf "Minibuf" keymap
		    (tab menu-item "Complete" minibuffer-complete
			 ([9]
			  . "  (TAB)")
			 :help "Complete as far as possible")
		    (space menu-item "Complete Word" minibuffer-complete-word
			   ([32]
			    . "  (SPC)")
			   :help "Complete at most one word")
		    (63 menu-item "List Completions" minibuffer-completion-help
			([63]
			 . "  (?)")
			:help "Display all possible completions")
		    "Minibuf" keymap
		    (return menu-item "Enter" exit-minibuffer
			    (nil)
			    :help "Terminate input and exit minibuffer")
		    (quit menu-item "Quit" keyboard-escape-quit
			  ([134217755 27]
			   . "  (M-ESC ESC)")
			  :help "Abort input and exit minibuffer")
		    "Minibuf")
	   keymap
	   (minibuf "Minibuf" keymap
		    (return menu-item "Enter" exit-minibuffer
			    (nil)
			    :help "Terminate input and exit minibuffer")
		    (quit menu-item "Quit" keyboard-escape-quit
			  ([134217755 27]
			   . "  (M-ESC ESC)")
			  :help "Abort input and exit minibuffer")
		    "Minibuf"))
 (27 keymap
     (118 . switch-to-completions)
     keymap
     (114 . previous-matching-history-element)
     (115 . next-matching-history-element)
     (112 . previous-history-element)
     (110 . next-history-element))
 (prior . switch-to-completions)
 (C-tab . file-cache-minibuffer-complete)
 (63 . minibuffer-completion-help)
 (32 . minibuffer-complete-word)
 (9 . minibuffer-complete)
 keymap
 (menu-bar keymap
	   (minibuf "Minibuf" keymap
		    (return menu-item "Enter" exit-minibuffer
			    (nil)
			    :help "Terminate input and exit minibuffer")
		    (quit menu-item "Quit" keyboard-escape-quit
			  ([134217755 27]
			   . "  (M-ESC ESC)")
			  :help "Abort input and exit minibuffer")
		    "Minibuf"))
 (C-tab . file-cache-minibuffer-complete)
 (9 . self-insert-command)
 (up . previous-history-element)
 (prior . previous-history-element)
 (down . next-history-element)
 (next . next-history-element)
 (27 keymap
     (114 . previous-matching-history-element)
     (115 . next-matching-history-element)
     (112 . previous-history-element)
     (110 . next-history-element))
 (10 . exit-minibuffer)
 (13 . exit-minibuffer)
 (7 . abort-recursive-edit))

As a result of this, typing <C-down-mouse-3> in the minibuffer pops up a
confusing context menu, see the attached screen shots.

Steve Berman


[-- Attachment #2: minibuf-menu1 --]
[-- Type: image/png, Size: 44545 bytes --]

[-- Attachment #3: minibuf-menu2 --]
[-- Type: image/png, Size: 33873 bytes --]

[-- Attachment #4: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

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

* Re: minibuffer and current-local-map
  2007-11-07 16:30 Stephen Berman
@ 2007-11-08  4:42 ` Richard Stallman
  2007-11-08  7:20   ` Stephen Berman
  0 siblings, 1 reply; 10+ messages in thread
From: Richard Stallman @ 2007-11-08  4:42 UTC (permalink / raw)
  To: Stephen Berman; +Cc: emacs-devel

    The value returned by current-local-map for the minibuffer

Inside which command?  What function was used to invoke the
minibuffer?  What map did it specify?

							       seems to be
    wrong (both in the trunk and in Emacs 22.1), containing partial
    reduplication:

Is the duplication present in the map that was passed as an argument
for use in the minibuffer?

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

* Re: minibuffer and current-local-map
  2007-11-08  4:42 ` Richard Stallman
@ 2007-11-08  7:20   ` Stephen Berman
  2007-11-08 23:37     ` Richard Stallman
  0 siblings, 1 reply; 10+ messages in thread
From: Stephen Berman @ 2007-11-08  7:20 UTC (permalink / raw)
  To: emacs-devel

On Wed, 07 Nov 2007 23:42:33 -0500 Richard Stallman <rms@gnu.org> wrote:

>     The value returned by current-local-map for the minibuffer
>
> Inside which command?  What function was used to invoke the
> minibuffer?  What map did it specify?

I noticed this after typing `M-x', thus activating the minibuffer, and
there typing C-down-mouse-3, popping up the confusing context menu seen
in the screen shots attached to my OP.  C-down-mouse-3 invokes
mouse-popup-menubar-stuff, which calls mouse-major-mode-menu, which
calls current-local-map.

> 							       seems to be
>     wrong (both in the trunk and in Emacs 22.1), containing partial
>     reduplication:
>
> Is the duplication present in the map that was passed as an argument
> for use in the minibuffer?

I'm not sure what you mean by "passed as an argument" here.  I saw the
value of current-local-map that I posted when I stepped through
mouse-major-mode-menu with edebug.  I also got this value by doing the
following (is step 4 an instance of passing the map as an argument for
use in the minibuffer?):

1. emacs -Q
2. M-: (setq enable-recursive-minibuffers t) RET
3. M-x
4. M-: (current-local-map) RET

Steve Berman

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

* Re: minibuffer and current-local-map
  2007-11-08  7:20   ` Stephen Berman
@ 2007-11-08 23:37     ` Richard Stallman
  2007-11-09 22:00       ` Richard Stallman
  0 siblings, 1 reply; 10+ messages in thread
From: Richard Stallman @ 2007-11-08 23:37 UTC (permalink / raw)
  To: Stephen Berman; +Cc: emacs-devel

    > Is the duplication present in the map that was passed as an argument
    > for use in the minibuffer?

    I'm not sure what you mean by "passed as an argument" here.

Whatever invokes the minibuffer specifies the map to use.  In this
case, the caller is in C code.  Now that we know it was M-x, we can
look in the source and see which map it is.

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

* Re: minibuffer and current-local-map
  2007-11-08 23:37     ` Richard Stallman
@ 2007-11-09 22:00       ` Richard Stallman
  2007-11-30 16:42         ` Jason Rumney
  0 siblings, 1 reply; 10+ messages in thread
From: Richard Stallman @ 2007-11-09 22:00 UTC (permalink / raw)
  To: Stephen.Berman, emacs-devel

I see the duplicate in the normal value of
minibuffer-local-completion-map.  The parent of that map is
minibuffer-local-map, and both of them have menu bar submaps.

I think there is nothing wrong with the keymaps.
When keymap A has B as its parent, keymap A's submap for a certain
prefix should have, as its parent, keymap B's submap for that prefix.
What you see here is that happening for the prefix `menu-bar' and
then again, within that, for the prefix `minibuf'.
Three levels of keymap `minibuffer-local-completion-map',
each inheriting from the corresponding level of the parent,
`minibuffer-local-map'.

The solution, I think, is to fix the menu code to avoid showing duplicates
in such a case.


Meanwhile, the bindings for C-tab really are duplicates.
I will get rid of the extra ones.

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

* Re: minibuffer and current-local-map
  2007-11-09 22:00       ` Richard Stallman
@ 2007-11-30 16:42         ` Jason Rumney
  2007-11-30 23:36           ` Richard Stallman
  0 siblings, 1 reply; 10+ messages in thread
From: Jason Rumney @ 2007-11-30 16:42 UTC (permalink / raw)
  To: rms; +Cc: Stephen.Berman, emacs-devel

Richard Stallman wrote:
> I see the duplicate in the normal value of
> minibuffer-local-completion-map.  The parent of that map is
> minibuffer-local-map, and both of them have menu bar submaps.
>   

The duplication seems to be related to this comment in menu-bar.el

 (dolist (map (list minibuffer-local-map
            ;; This shouldn't be necessary, but there's a funny
            ;; bug in keymap.c that I don't understand yet.  -stef
            minibuffer-local-completion-map))
    (define-key map [menu-bar minibuf]
      (cons "Minibuf" (make-sparse-keymap "Minibuf"))))

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

* Re: minibuffer and current-local-map
  2007-11-30 16:42         ` Jason Rumney
@ 2007-11-30 23:36           ` Richard Stallman
  0 siblings, 0 replies; 10+ messages in thread
From: Richard Stallman @ 2007-11-30 23:36 UTC (permalink / raw)
  To: Jason Rumney; +Cc: Stephen.Berman, emacs-devel

    > I see the duplicate in the normal value of
    > minibuffer-local-completion-map.  The parent of that map is
    > minibuffer-local-map, and both of them have menu bar submaps.
    >   

    The duplication seems to be related to this comment in menu-bar.el

     (dolist (map (list minibuffer-local-map
		;; This shouldn't be necessary, but there's a funny
		;; bug in keymap.c that I don't understand yet.  -stef
		minibuffer-local-completion-map))
	(define-key map [menu-bar minibuf]
	  (cons "Minibuf" (make-sparse-keymap "Minibuf"))))

There might be a bug in creating the submaps some other way,
which this works around.  But I think that is irrelevant here,
because the submap data looks correct to me.  If fixing the other 
bug makes it possible to create the same submaps in another way
that ought to be equivalent, that won't get rid of the bug in 
looking at them.

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

* Re: minibuffer and current-local-map
@ 2008-01-06 19:36 Glenn Morris
  2008-01-07 11:31 ` Richard Stallman
  0 siblings, 1 reply; 10+ messages in thread
From: Glenn Morris @ 2008-01-06 19:36 UTC (permalink / raw)
  To: Richard Stallman; +Cc: Stephen.Berman, emacs-devel


I no longer have the original message to reply to. I'm replying to:

http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg00602.html

  From:   Richard Stallman
  Subject:        Re: minibuffer and current-local-map
  Date:           Fri, 09 Nov 2007 17:00:03 -0500

The issue is:

emacs -Q
M-x
C-mouse-3 in the minibuffer brings up a menu with two "Minibuff" entries.

rms said:

  The solution, I think, is to fix the menu code to avoid showing
  duplicates in such a case.


Here is a simple patch that just takes the first of any duplicate
(same name) menus.


*** mouse.el.~1.315.2.4.~	2007-12-06 20:27:17.000000000 -0800
--- mouse.el	2008-01-06 11:11:51.000000000 -0800
***************
*** 173,183 ****
  	 ;; default to the edit menu.
  	 (newmap (if ancestor
  		     (make-sparse-keymap (concat mode-name " Mode"))
! 		   menu-bar-edit-menu)))
      (if ancestor
  	;; Make our menu inherit from the desired keymap which we want
  	;; to display as the menu now.
! 	(set-keymap-parent newmap ancestor))
      (popup-menu newmap event prefix)))
  
  
--- 173,190 ----
  	 ;; default to the edit menu.
  	 (newmap (if ancestor
  		     (make-sparse-keymap (concat mode-name " Mode"))
! 		   menu-bar-edit-menu))
!          uniq)
      (if ancestor
  	;; Make our menu inherit from the desired keymap which we want
  	;; to display as the menu now.
! 	(set-keymap-parent newmap
!                            (progn
!                              (dolist (e ancestor)
!                                (unless (and (listp e)
!                                             (assoc (car e) uniq))
!                                  (setq uniq (append uniq (list e)))))
!                              uniq)))
      (popup-menu newmap event prefix)))

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

* Re: minibuffer and current-local-map
  2008-01-06 19:36 minibuffer and current-local-map Glenn Morris
@ 2008-01-07 11:31 ` Richard Stallman
  2008-01-07 12:43   ` Stephen Berman
  0 siblings, 1 reply; 10+ messages in thread
From: Richard Stallman @ 2008-01-07 11:31 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Stephen.Berman, emacs-devel

If it works, please install it, and thanks.

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

* Re: minibuffer and current-local-map
  2008-01-07 11:31 ` Richard Stallman
@ 2008-01-07 12:43   ` Stephen Berman
  0 siblings, 0 replies; 10+ messages in thread
From: Stephen Berman @ 2008-01-07 12:43 UTC (permalink / raw)
  To: emacs-devel

On Mon, 07 Jan 2008 06:31:17 -0500 Richard Stallman <rms@gnu.org> wrote:

> If it works, please install it, and thanks.

It solves the problem I reported.  Thanks, Glenn.

Steve Berman

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

end of thread, other threads:[~2008-01-07 12:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-06 19:36 minibuffer and current-local-map Glenn Morris
2008-01-07 11:31 ` Richard Stallman
2008-01-07 12:43   ` Stephen Berman
  -- strict thread matches above, loose matches on Subject: below --
2007-11-07 16:30 Stephen Berman
2007-11-08  4:42 ` Richard Stallman
2007-11-08  7:20   ` Stephen Berman
2007-11-08 23:37     ` Richard Stallman
2007-11-09 22:00       ` Richard Stallman
2007-11-30 16:42         ` Jason Rumney
2007-11-30 23:36           ` Richard Stallman

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