unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Stefan Monnier" <monnier+gnu/emacs@rum.cs.yale.edu>
Cc: andrew.maguire@ps.ge.com
Subject: Re: [andrew.maguire@ps.ge.com: RE: menu entries missing display of equivalent keyboard sequence]
Date: Wed, 15 Jan 2003 19:13:17 -0500	[thread overview]
Message-ID: <200301160013.h0G0DHP11708@rum.cs.yale.edu> (raw)
In-Reply-To: E18QEHY-00040s-00@fencepost.gnu.org

> The problem below is caused by the where_is_cache, which I believe you
> added.

Actually, the problem is not caused by this at all.  It's caused by another
problem: the way `nomenus' was implemented in Emacs-20 was that any binding
that had a "menu-item" shape (either old-style or new-style) was considered
as a menu binding and was thus not listed in the shortcuts.
I wanted to change that so that "Edit => Text Properties => Face => Bold"
shows the "M-g b" shortcut (even though the M-g prefix uses the HierarKey
thingy to display a "menu in the minibuffer", which relies on menu-items
as well, which is why the M-g b shortcut is missing in Emacs-20).

So now, the problem is "what is a menu binding" ?
In Emacs-21, I defined it as "a key sequence whose first key is
a symbol".  Clearly, it's pretty arbitrary as well, since as is seen
in Andrew's example, it rules out "f8 d", but it was chosen because
it correctly rules out the menu-bar bindings, the tool-bar bindings,
and the FOO-down-mouse-N popup menus bindings.

The offending lines are in keymap.c:

      /* if (nomenus && !ascii_sequence_p (this)) */
      if (nomenus && XINT (last) >= 0
	  && !INTEGERP (Faref (this, make_number (0))))
	/* If no menu entries should be returned, skip over the
	   keymaps bound to `menu-bar' and `tool-bar' and other
	   non-ascii prefixes like `C-down-mouse-2'.  */
	continue;


-- Stefan


> I think the simplest fix is to get rid of that cache.  As far as I can
> see, it is active only in the case of lookup for menu items equivalent
> key bindings, and it's unnecessary in that case because the menu
> itself caches the equivalent key bindings.
> 
> Is there some case where where_is_cache really provides service?
> If so, would you like to fix this bug?
> 
> Please respond.
> 
> ------- Start of forwarded message -------
> From: andrew.maguire@ps.ge.com
> To: bug-gnu-emacs@gnu.org
> Date: Fri, 20 Dec 2002 12:29:40 -0500
> cc: andrew.maguire@ps.ge.com
> Subject: RE: menu entries missing display of equivalent keyboard sequence 
> Sender: bug-gnu-emacs-bounces+rms=gnu.org@gnu.org
> 
> Here is some example lisp that works in 20.7 but not in 21.2
> 
> (defun andrew-fn ()
> "Test"
> (interactive)
> (message "Hello"))
> 
> 
> (progn
>   (setq andrew-map (make-sparse-keymap "Andrew"))
>   (put 'andrew-fn 'menu-enable t)
>   ;(define-key andrew-map "F" nil)
>   (define-key andrew-map [andrew-function] '("My function" . andrew-fn))
>   (define-key global-map [menu-bar andrew] andrew-map)
>   (define-key-after (lookup-key global-map [menu-bar]) [andrew]
>     (cons "Andrew" andrew-map) 'dev)
>   (setq f8-map (make-sparse-keymap))
>   (fset 'f8-map f8-map)
>   (define-key f8-map "d" 'andrew-fn)
>   (define-key global-map [f8] 'f8-map)
> )
> 
> > -----Original Message-----
> > From: Andrew Maguire [mailto:Andrew.Maguire@Smallworld.co.uk]
> > Sent: 20 December 2002 15:42
> > To: bug-gnu-emacs@gnu.org; Maguire, Andrew (PS, GENS)
> > Subject: menu entries missing display of equivalent keyboard sequence 
> > 
> > 
> > This bug report will be sent to the Free Software Foundation,
> > not to your local site managers!
> > Please write in English, because the Emacs maintainers do not have
> > translators to read other languages for them.
> > 
> > Your bug report will be posted to the bug-gnu-emacs@gnu.org 
> > mailing list,
> > and to the gnu.emacs.bug news group.
> > 
> > In GNU Emacs 21.2.1 (sparc-sun-solaris2.6, X toolkit)
> >  of 2002-07-11 on albany
> > configured using `configure  --libexecdir=/usr/local/lib'
> > Important settings:
> >   value of $LC_ALL: nil
> >   value of $LC_COLLATE: en_GB.ISO8859-15
> >   value of $LC_CTYPE: en_GB.ISO8859-15
> >   value of $LC_MESSAGES: C
> >   value of $LC_MONETARY: en_GB.ISO8859-15
> >   value of $LC_NUMERIC: en_GB.ISO8859-15
> >   value of $LC_TIME: en_GB.ISO8859-15
> >   value of $LANG: en_GB.ISO8859-15
> >   locale-coding-system: iso-latin-9
> >   default-enable-multibyte-characters: t
> > 
> > Please describe exactly what actions triggered the bug
> > and the precise symptoms of the bug:
> > 
> > The code I have defines various global keys, creates a couple of
> > menu-bar general entries and some major mode specific ones
> > but the menu entries do not show their equivalent keyboard shortcuts.
> > (Apart from one that is defined on f1.) I am just using the simple
> > method for defining menu entries i.e. I am not using (menu-item ...).
> > 
> > The problem alsoo occurs on the Windows build 21.2.1 on buffy.
> > The menu entries for the standard menus is there, Fil, Edit, Help etc.
> > It just seems that the is something up with the mechanism that
> > calculates the shortcut keys and the caching in the keymap definition.
> > 
> > My code is fine on Emacs 20.7.
> > 
> > Can I force a recalculation of the caching of keysequences?
> > 
> > Thanks in advance,
> > 
> > Andrew Maguire
> > 
> > Recent input:
> > <down> <return> <help-echo> <down-mouse-2> <help-echo> 
> > <mouse-2> <down-mouse-1> <mouse-1> <next> <next> <next> 
> > <prior> <prior> <C-home> <next> <next> <next> <next> 
> > <next> <next> <next> C-s c o n s C-s C-s C-s C-s C-s 
> > C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s <down> 
> > <next> C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s 
> > C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s <down> 
> > <down> <down> <down> <down> <down> <down> <down> <down> 
> > <down> <help-echo> <down-mouse-1> <mouse-1> C-h C-g 
> > C-x b * i n <tab> <return> <prior> <help-echo> <help-echo> 
> > <help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
> > <help-echo> <menu-bar> <help-menu> <report-emacs-b
> > ug>
> > 
> > Recent messages:
> > setq: Quit [2 times]
> > Starting gis version selection...
> > 
> > Type C-x 1 to remove help window.  C-M-v to scroll the help.
> > call-interactively: Quit
> > list: Quit
> > sw-half-scroll-down: Beginning of buffer
> > Mark set
> > Mark saved where search started [2 times]
> > Loading emacsbug...done
> > 
> 
> 
> _______________________________________________
> Bug-gnu-emacs mailing list
> Bug-gnu-emacs@gnu.org
> http://mail.gnu.org/mailman/listinfo/bug-gnu-emacs
> ------- End of forwarded message -------
> 

       reply	other threads:[~2003-01-16  0:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E18QEHY-00040s-00@fencepost.gnu.org>
2003-01-16  0:13 ` Stefan Monnier [this message]
2003-01-18  0:45   ` [andrew.maguire@ps.ge.com: RE: menu entries missing display of equivalent keyboard sequence] Richard Stallman
2003-01-28 22:50     ` Stefan Monnier
2003-01-29 21:17       ` Richard Stallman
2003-01-30 15:21         ` Stefan Monnier
2003-01-31 19:20           ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200301160013.h0G0DHP11708@rum.cs.yale.edu \
    --to=monnier+gnu/emacs@rum.cs.yale.edu \
    --cc=andrew.maguire@ps.ge.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).