* Sensible menu bindings (was Re: A doc typo?) [not found] ` <m1u0mvnxlj.fsf-monnier+emacs@gnu.org> @ 2005-03-29 9:43 ` Kim F. Storm 2005-03-29 10:31 ` Sensible menu bindings David Kastrup 2005-03-29 13:45 ` Stefan Monnier 0 siblings, 2 replies; 5+ messages in thread From: Kim F. Storm @ 2005-03-29 9:43 UTC (permalink / raw) Cc: Peter Dyballa, Eli Zaretskii, emacs-devel, emacs-pretest-bug Stefan Monnier <monnier@iro.umontreal.ca> writes: >> I recently suggested patches to report menu bindings using the real >> menu item texts rather than the internal names, like this: > >> File=>Print=>Print With Faces > > I agree it would be an improvement. But IIRC you did it by modifying > key-description, which also applies to things like C-h c where I think it's > important to keep a representation that can be passed directly to `kbd'. How do you copy/paste the output from C-h c? From *Messages* buffer? With C-h k, you get a buffer from which you can copy the original menu binding -- and with my patch, that binding is still shown for C-h k (see example below). > So I'd recommend to add an arg to key-description and then only use it at > those places where it makes sense (basically, for the keys returned by > `where-is'). With my patch, (key-description KEY t) will do just that. Making C-h c using that is trivial (I already did so). Anyway, Richard don't think this is an improvement, so unless more people speak up, it's a dead end. Please support RESEMBI aka. the "report sensible menu bindings initiative" :-) Some example of RESEMBI: C-h k "File" "New File..." reports: ,-------------------------- | File=>New File... runs the command find-file | which is an interactive compiled Lisp function in `files'. | It is also bound to <open>, C-x C-f. | | Menu binding: <menu-bar> <file> <new-file> | Lisp: (find-file filename &optional wildcards) | ... `-------------------------- instead of: ,-------------------------- | <menu-bar> <file> <new-file> runs the command find-file | which is an interactive compiled Lisp function in `files'. | It is bound to <open>, C-x C-f, <menu-bar> <file> <new-file>. | (find-file filename &optional wildcards) | ... `-------------------------- Apropos on "find-file" reports: ,-------------------------- | ... | find-file File=>New File..., C-x C-f, <open> | Command: Edit file FILENAME. | find-file-at-point M-x ... RET | Command: Find FILENAME, guessing a default from text around point. | find-file-existing File=>Open File... | Command: Edit the existing file FILENAME. | ... `-------------------------- instead of ,-------------------------- | ... | find-file <menu-bar> <file> <new-file>, C-x C-f, <open> | Command: Edit file FILENAME. | find-file-at-point M-x ... RET | Command: Find FILENAME, guessing a default from text around point. | find-file-existing <menu-bar> <file> <open-file> | Command: Edit the existing file FILENAME. | ... `-------------------------- -- Kim F. Storm <storm@cua.dk> http://www.cua.dk ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Sensible menu bindings 2005-03-29 9:43 ` Sensible menu bindings (was Re: A doc typo?) Kim F. Storm @ 2005-03-29 10:31 ` David Kastrup 2005-03-29 11:41 ` Kim F. Storm 2005-03-29 13:45 ` Stefan Monnier 1 sibling, 1 reply; 5+ messages in thread From: David Kastrup @ 2005-03-29 10:31 UTC (permalink / raw) Cc: Peter Dyballa, emacs-pretest-bug, emacs-devel storm@cua.dk (Kim F. Storm) writes: > Stefan Monnier <monnier@iro.umontreal.ca> writes: > >>> I recently suggested patches to report menu bindings using the real >>> menu item texts rather than the internal names, like this: >> >>> File=>Print=>Print With Faces >> >> I agree it would be an improvement. But IIRC you did it by >> modifying key-description, which also applies to things like C-h c >> where I think it's important to keep a representation that can be >> passed directly to `kbd'. > > How do you copy/paste the output from C-h c? From *Messages* buffer? > > With C-h k, you get a buffer from which you can copy the original menu > binding -- and with my patch, that binding is still shown for C-h k > (see example below). > >> So I'd recommend to add an arg to key-description and then only use >> it at those places where it makes sense (basically, for the keys >> returned by `where-is'). > > With my patch, (key-description KEY t) will do just that. > Making C-h c using that is trivial (I already did so). > > Anyway, Richard don't think this is an improvement, so > unless more people speak up, it's a dead end. I think it is an improvement since we are talking here mainly about user-level instead of programmer-accessible documentation. With regard to the duplication of information: how feasible would it be to make kbd accept File=>Print=>Print With Faces strings? Then there would be no necessity to report a different form. -- David Kastrup, Kriemhildstr. 15, 44793 Bochum ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Sensible menu bindings 2005-03-29 10:31 ` Sensible menu bindings David Kastrup @ 2005-03-29 11:41 ` Kim F. Storm 0 siblings, 0 replies; 5+ messages in thread From: Kim F. Storm @ 2005-03-29 11:41 UTC (permalink / raw) Cc: Peter Dyballa, emacs-pretest-bug, emacs-devel David Kastrup <dak@gnu.org> writes: > how feasible would it be to > make kbd accept File=>Print=>Print With Faces strings? Then there > would be no necessity to report a different form. Does kbd really generate proper menu bindings in its current form? Does it make sense at all to use kbd for that purpose? (kbd "<menu-bar> <file> <new-file>") => [menu-bar file new-file] In any case, the main problem is that parsing the new form must go through the active keymaps to find the relevant menu bindings. However, this is doable if we limit it to the global map: (defun kbd-menu-binding (menu-binding) (let ((items (split-string menu-binding "=>")) (map (lookup-key global-map [menu-bar])) m keys) (while (and items map) (setq m (car map) map (cdr map)) (when (consp m) (if (eq (nth 1 m) 'menu-item) (if (equal (car items) (nth 2 m)) (setq map (and (keymapp (nth 3 m)) (nth 3 m)) items (cdr items) keys (cons (car m) keys))) (if (equal (car items) (nth 1 m)) (setq map (if (and (symbolp (nthcdr 2 m)) (boundp (nthcdr 2 m)) (keymapp (symbol-value (nthcdr 2 m)))) (cdr (symbol-value (nthcdr 2 m))) (nthcdr 2 m)) items (cdr items) keys (cons (car m) keys)))))) (if items (error "No menu binding for %s" menu-binding) (apply 'vector 'menu-bar (reverse keys))))) (kbd-menu-binding "File=>New File...") => [menu-bar file new-file] (kbd-menu-binding "Options=>Mule (Multilingual Environment)=>Set Language Environment=>European=>Brazilian Portuguese") => [menu-bar options mule set-language-environment European Brazilian\ Portuguese] -- Kim F. Storm <storm@cua.dk> http://www.cua.dk ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Sensible menu bindings 2005-03-29 9:43 ` Sensible menu bindings (was Re: A doc typo?) Kim F. Storm 2005-03-29 10:31 ` Sensible menu bindings David Kastrup @ 2005-03-29 13:45 ` Stefan Monnier 2005-03-29 14:58 ` Kim F. Storm 1 sibling, 1 reply; 5+ messages in thread From: Stefan Monnier @ 2005-03-29 13:45 UTC (permalink / raw) Cc: Peter Dyballa, Eli Zaretskii, emacs-devel, emacs-pretest-bug > With my patch, (key-description KEY t) will do just that. > Making C-h c using that is trivial (I already did so). Great, then I strongly support it. > C-h k "File" "New File..." reports: > ,-------------------------- > | File=>New File... runs the command find-file > | which is an interactive compiled Lisp function in `files'. > | It is also bound to <open>, C-x C-f. > | > | Menu binding: <menu-bar> <file> <new-file> I wouldn't bother with this part of the change, just keep: > | <menu-bar> <file> <new-file> runs the command find-file > | which is an interactive compiled Lisp function in `files'. > | It is also bound to <open>, C-x C-f. Since after all the user has just selected the entry in the menu, so she knows damn well what many entry it was. > | find-file File=>New File..., C-x C-f, <open> > | Command: Edit file FILENAME. > | find-file-at-point M-x ... RET > | Command: Find FILENAME, guessing a default from text around point. > | find-file-existing File=>Open File... > | Command: Edit the existing file FILENAME. > | ... OTOH, this is much more readable than the current form. Stefan ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Sensible menu bindings 2005-03-29 13:45 ` Stefan Monnier @ 2005-03-29 14:58 ` Kim F. Storm 0 siblings, 0 replies; 5+ messages in thread From: Kim F. Storm @ 2005-03-29 14:58 UTC (permalink / raw) Cc: Peter Dyballa, emacs-devel, emacs-pretest-bug Stefan Monnier <monnier@iro.umontreal.ca> writes: >> With my patch, (key-description KEY t) will do just that. >> Making C-h c using that is trivial (I already did so). > > Great, then I strongly support it. Thanks. > >> C-h k "File" "New File..." reports: >> ,-------------------------- >> | File=>New File... runs the command find-file >> | which is an interactive compiled Lisp function in `files'. >> | It is also bound to <open>, C-x C-f. >> | >> | Menu binding: <menu-bar> <file> <new-file> > > I wouldn't bother with this part of the change, just keep: > >> | <menu-bar> <file> <new-file> runs the command find-file >> | which is an interactive compiled Lisp function in `files'. >> | It is also bound to <open>, C-x C-f. > > Since after all the user has just selected the entry in the menu, so she > knows damn well what many entry it was. But if I grab the help output and send it to somebody else, the new format is more readable there too. And sometimes, help buffers stay around for several minutes, and not everybody has that long memories :-) > >> | find-file File=>New File..., C-x C-f, <open> >> | Command: Edit file FILENAME. >> | find-file-at-point M-x ... RET >> | Command: Find FILENAME, guessing a default from text around point. >> | find-file-existing File=>Open File... >> | Command: Edit the existing file FILENAME. >> | ... > > OTOH, this is much more readable than the current form. This was actually the context that triggered the change in the first place -- the other uses came as a "mostly free" bonus. -- Kim F. Storm <storm@cua.dk> http://www.cua.dk ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-03-29 14:58 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <91a0b1e20a73068697a422453a2dcb7e@Web.DE> [not found] ` <01c53211$Blat.v2.4$99a09d00@zahav.net.il> [not found] ` <m34qevh0ag.fsf@kfs-l.imdomain.dk> [not found] ` <m1u0mvnxlj.fsf-monnier+emacs@gnu.org> 2005-03-29 9:43 ` Sensible menu bindings (was Re: A doc typo?) Kim F. Storm 2005-03-29 10:31 ` Sensible menu bindings David Kastrup 2005-03-29 11:41 ` Kim F. Storm 2005-03-29 13:45 ` Stefan Monnier 2005-03-29 14:58 ` Kim F. Storm
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).