all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#60101: 29.0.60; help-quick should use C-/ for undo
@ 2022-12-15 19:21 Philip Kaludercic
  2022-12-15 19:34 ` Juri Linkov
  2022-12-17 17:10 ` Juri Linkov
  0 siblings, 2 replies; 7+ messages in thread
From: Philip Kaludercic @ 2022-12-15 19:21 UTC (permalink / raw)
  To: 60101


The new help-quick command makes use of `where-is-internal' to find the
binding for a command ti displays.  This works fine if a command has
only one binding, but in the case of `undo', C-_ is the first one it
suggests, since

    (mapcar #'key-description (where-is-internal 'undo))
    ;; => ("C-_" "<undo>" "C-/" "<menu-bar> <edit> <undo>")

    (key-description (where-is-internal 'undo nil t))
    ;; => "C-_"

It appears this issue can be resolved by setting

    (setq where-is-preferred-modifier 'C)

    (mapcar #'key-description (where-is-internal 'undo))
    ;; => ("C-_" "<undo>" "C-/" "<menu-bar> <edit> <undo>")

    (key-description (where-is-internal 'undo nil t))
    ;; => "C-/"

But to be honest, I don't understand why, nor do I think the solution is
particularly robust.

I think some general mechanism to associate preferred binding with keys
would be nice to have.  What I wonder is if this is general enough of a
use-case to be added to where-is-internal, or should this be fixed
inside of help-quick?

The other issue is how does one determine what binding is preferable.  I
had previously generalised that C-/ is obviously preferable, but that
differs from layout to layout and depending on what keys Emacs can even
detect (I believe C-x u is often the only key that can be used in TUI
mode).

In GNU Emacs 29.0.60 (build 5, x86_64-pc-linux-gnu, GTK+ Version
 3.24.35, cairo version 1.16.0) of 2022-12-14 built on quetzal
Repository revision: 622838b957e240d700585050e9ddbd036e690513
Repository branch: emacs-29
System Description: Debian GNU/Linux bookworm/sid

Configured using:
 'configure --with-pgtk --with-imagemagick'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ
IMAGEMAGICK JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES
NOTIFY INOTIFY PDUMPER PGTK PNG RSVG SECCOMP SOUND THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER XIM GTK3 ZLIB

Important settings:
  value of $EMACSLOADPATH: 
  value of $LC_MONETARY: en_US.UTF-8
  value of $LC_NUMERIC: en_US.UTF-8
  value of $LC_TIME: en_US.UTF-8
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
  rcirc-color-mode: t
  rcirc-track-minor-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  server-mode: t
  shell-dirtrack-mode: t
  editorconfig-mode: t
  repeat-mode: t
  display-battery-mode: t
  display-time-mode: t
  diff-hl-flydiff-mode: t
  winner-mode: t
  windmove-mode: t
  corfu-history-mode: t
  vertico-multiform-mode: t
  vertico-mode: t
  electric-pair-mode: t
  recentf-mode: t
  save-place-mode: t
  savehist-mode: t
  pixel-scroll-precision-mode: t
  pixel-scroll-mode: t
  xterm-mouse-mode: t
  which-function-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tab-bar-mode: t
  file-name-shadow-mode: t
  context-menu-mode: t
  global-font-lock-mode: t
  buffer-read-only: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/philip/.config/emacs/site-lisp/sbbs-pld/sbbs hides /home/philip/.config/emacs/site-lisp/sbbs/sbbs
/home/philip/.config/emacs/site-lisp/flymake-proselint/flymake-proselint hides /home/philip/.config/emacs/elpa/flymake-proselint-0.3.0/flymake-proselint
/home/philip/.config/emacs/site-lisp/writegood-mode/writegood-mode hides /home/philip/.config/emacs/elpa/writegood-mode-2.2.0/writegood-mode
/home/philip/.config/emacs/site-lisp/writegood-mode/writegood-mode-autoloads hides /home/philip/.config/emacs/elpa/writegood-mode-2.2.0/writegood-mode-autoloads
/home/philip/.config/emacs/site-lisp/writegood-mode/writegood-mode-pkg hides /home/philip/.config/emacs/elpa/writegood-mode-2.2.0/writegood-mode-pkg
/home/philip/.config/emacs/elpa/transient-0.3.7/transient hides /home/philip/Source/emacs/lisp/transient

Features:
(shadow emacsbug tutorial goto-addr emacs-authors-mode view find-dired
macrostep flymake-proselint mhtml-mode css-mode js sgml-mode facemenu
trace flow-fill ibuf-ext flymake-cc ox-texinfo org-timer org-tempo
org-protocol org-num org-lint org-feed org-datetree org-colview
org-duration org-capture org-attach-git org-archive test-ox
org-inlinetask ob-sed ob-plantuml ob-lilypond org-test ert-x org-clock
tempo ox-odt rng-loc rng-uri rng-parse rng-match rng-pttrn nxml-parse
nxml-ns nxml-enc xmltok nxml-util ox-latex ox-icalendar ox-html table
ox-ascii ox-publish ox org-agenda org-attach esh-mode ob-sql geiser
python ob-octave eshell esh-cmd esh-ext esh-opt esh-proc esh-io esh-arg
esh-module esh-groups esh-util calc-store calc-trail calc-ext calc
calc-loaddefs rect calc-macs cc-mode cc-fonts cc-guess cc-menus cc-cmds
cc-styles cc-align cc-engine cc-vars cc-defs org-autoloads avy 0x0
0x0-autoloads tar-mode arc-mode archive-mode term/xterm xterm eat ert
eat-autoloads nndoc gnus-dup debbugs-gnu debbugs-compat debbugs
soap-client rng-xsd rng-dt rng-util xsd-regexp rcirc-color rcirc
cap-words superword subword go-mode find-file etags fileloop nroff-mode
org-element org-persist org-id org-refile avl-tree generator oc-basic
ol-eww eww xdg url-queue mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus
nnselect ol-docview doc-view jka-compr image-mode exif ol-bibtex bibtex
ol-bbdb ol-w3m ol-doi org-link-doi org ob ob-tangle ob-ref ob-lob
ob-table ob-exp org-macro org-src ob-comint org-pcomplete org-list
org-footnote org-faces org-entities ob-emacs-lisp ob-core ob-eval
org-cycle org-table ol org-fold org-fold-core org-keys oc org-loaddefs
cal-menu calendar cal-loaddefs org-version org-compat org-macs
modus-vivendi-theme vc-filewise follow magit-extras face-remap
magit-bookmark magit-submodule magit-obsolete magit-blame magit-stash
magit-reflog magit-bisect magit-push magit-pull magit-fetch magit-clone
magit-remote magit-commit magit-sequence magit-notes magit-worktree
magit-tag magit-merge magit-branch magit-reset magit-files magit-refs
magit-status magit magit-repos magit-apply magit-wip magit-log
magit-diff git-commit log-edit add-log magit-core magit-autorevert
autorevert filenotify magit-margin magit-transient magit-process
with-editor server magit-mode transient edmacro magit-git magit-section
magit-utils crm dash vc-src vc-sccs vc-cvs vc-rcs vertico-buffer
mailalias smtpmail ecomplete bug-reference dictionary
dictionary-connection ibuffer ibuffer-loaddefs whitespace vc-annotate
descr-text pulse color shortdoc ffap edebug reposition consult-imenu
cl-print debug backtrace find-func grep agda2-mode xref agda2-abbrevs
skeleton agda2-highlight agda2 agda-input quail eri char-fold misearch
multi-isearch smerge-mode mule-util package-vc inline url-cache url-http
url-auth url-gw display-line-numbers vc-hg vc-bzr vertico-directory
sh-script smie treesit executable orderless vertico-flat vc-svn vc-git
tramp-cache tramp-sh tramp tramp-loaddefs trampver tramp-integration
cus-start tramp-compat shell pcomplete ls-lisp consult-register
consult-vertico consult compat-28 kmacro bookmark files-x vc-backup
copyright time-stamp mm-archive dired-aux gnus-dired buffer-env compat
compat-macs sort smiley gnus-cite mail-extr textsec uni-scripts
idna-mapping ucs-normalize uni-confusable textsec-check gnus-async
gnus-bcklg qp gnus-ml disp-table nndraft nnmh utf-7 nnfolder epa-file
network-stream nsm gnus-agent gnus-srvr gnus-score score-mode nnvirtual
gnus-msg gnus-art mm-uu mml2015 mm-view mml-smime smime gnutls dig nntp
gnus-cache gnus-sum shr pixel-fill kinsoku url-file svg dom gnus-group
gnus-undo gnus-start gnus-dbus gnus-cloud nnimap nnmail mail-source utf7
nnoo parse-time iso8601 gnus-spec gnus-int gnus-range message yank-media
puny dired-x dired dired-loaddefs rfc822 mml mml-sec epa derived epg
rfc6068 epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader gnus-win noutline outline checkdoc
flymake-proc flymake yasnippet-snippets warnings yasnippet editorconfig
editorconfig-core editorconfig-core-handle editorconfig-fnmatch flyspell
ispell init repeat project format-spec battery dbus xml shell-command+
thingatpt rx time sendmail rfc2047 rfc2045 ietf-drums gnus nnheader
gnus-util time-date mail-utils range mm-util mail-prsvr finder-inf
diff-hl-flydiff diff diff-hl log-view pcvs-util vc-dir ewoc vc
vc-dispatcher diff-mode easy-mmode hippie-exp winner windmove
corfu-history corfu vertico-multiform vertico cl-extra elec-pair recentf
tree-widget saveplace savehist pixel-scroll cua-base xt-mouse
modus-operandi-theme modus-themes pcase which-func imenu cus-edit pp
cus-load icons wid-edit package browse-url url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-domsuf url-util
mailcap url-handlers url-parse auth-source cl-seq eieio eieio-core
cl-macs password-cache json subr-x map byte-opt gv url-vars setup
site-lisp auto-site compile text-property-search comint ansi-osc
ansi-color bytecomp byte-compile loaddefs-gen generate-lisp-file
lisp-mnt info caml-autoloads consult-autoloads
flymake-proselint-autoloads corfu-autoloads diff-hl-autoloads
focus-autoloads haskell-mode-autoloads buffer-env-autoloads
avy-autoloads yasnippet-snippets-autoloads magit-autoloads
geiser-mit-autoloads inspector-autoloads bash-completion-autoloads
ef-themes-autoloads auctex-autoloads tex-site git-commit-autoloads
with-editor-autoloads geiser-guile-autoloads geiser-impl help-fns
radix-tree help-mode cl-loaddefs cl-lib geiser-custom geiser-base ring
geiser-autoloads transient-autoloads magit-section-autoloads
vertico-autoloads debbugs-autoloads compat-autoloads
editorconfig-autoloads rcirc-color-autoloads orderless-autoloads
yasnippet-autoloads markdown-mode-autoloads slime-autoloads
macrostep-autoloads writegood-mode-autoloads go-mode-autoloads
dash-autoloads rmc iso-transl tooltip cconv eldoc paren electric
uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/pgtk-win pgtk-win term/common-win pgtk-dnd tool-bar dnd fontset
image regexp-opt fringe tabulated-list replace newcomment text-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify
dynamic-setting system-font-setting font-render-setting cairo gtk pgtk
lcms2 multi-tty make-network-process emacs)

Memory information:
((conses 16 2434927 285156)
 (symbols 48 80808 3175)
 (strings 32 393048 106951)
 (string-bytes 1 11497968)
 (vectors 16 174618)
 (vector-slots 8 3411953 405729)
 (floats 8 3321 2460)
 (intervals 56 128930 7495)
 (buffers 984 158))





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

* bug#60101: 29.0.60; help-quick should use C-/ for undo
  2022-12-15 19:21 bug#60101: 29.0.60; help-quick should use C-/ for undo Philip Kaludercic
@ 2022-12-15 19:34 ` Juri Linkov
  2022-12-16 19:18   ` Philip Kaludercic
  2022-12-17 17:10 ` Juri Linkov
  1 sibling, 1 reply; 7+ messages in thread
From: Juri Linkov @ 2022-12-15 19:34 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 60101

> I think some general mechanism to associate preferred binding with keys
> would be nice to have.  What I wonder is if this is general enough of a
> use-case to be added to where-is-internal, or should this be fixed
> inside of help-quick?

In lisp/bindings.el its preferred binding is defined by this line:

  (put 'undo :advertised-binding [?\C-x ?u])





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

* bug#60101: 29.0.60; help-quick should use C-/ for undo
  2022-12-15 19:34 ` Juri Linkov
@ 2022-12-16 19:18   ` Philip Kaludercic
  2022-12-17 17:16     ` Juri Linkov
  0 siblings, 1 reply; 7+ messages in thread
From: Philip Kaludercic @ 2022-12-16 19:18 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 60101

Juri Linkov <juri@linkov.net> writes:

>> I think some general mechanism to associate preferred binding with keys
>> would be nice to have.  What I wonder is if this is general enough of a
>> use-case to be added to where-is-internal, or should this be fixed
>> inside of help-quick?
>
> In lisp/bindings.el its preferred binding is defined by this line:
>
>   (put 'undo :advertised-binding [?\C-x ?u])

That is good, but it only solves the problem by providing the means.
The other issue is figuring out how the advertised binding can
automatically be set to whatever is preferred on the current system.  Is
there a way to find out what keyboard layout is being used, or at least
what modifiers have to be pressed for a key to be input?





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

* bug#60101: 29.0.60; help-quick should use C-/ for undo
  2022-12-15 19:21 bug#60101: 29.0.60; help-quick should use C-/ for undo Philip Kaludercic
  2022-12-15 19:34 ` Juri Linkov
@ 2022-12-17 17:10 ` Juri Linkov
  2022-12-17 18:03   ` Philip Kaludercic
  1 sibling, 1 reply; 7+ messages in thread
From: Juri Linkov @ 2022-12-17 17:10 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 60101

> The new help-quick command makes use of `where-is-internal' to find the
> binding for a command ti displays.  This works fine if a command has
> only one binding, but in the case of `undo', C-_ is the first one it
> suggests

I tried to reproduce this problem, and typed 'C-h C-h' that showed:

  Other Help Commands

     C-e 	Extending Emacs with external packages
     p 	Search for Emacs packages (see also M-x list-packages)
     P 	Describe a specific Emacs package

     t 	Start the Emacs tutorial
     M-x help-quick-or-quit 	Display the quick help buffer.
     e 	Show recent messages (from echo area)
     l 	Show last 300 input keystrokes (lossage)
     . 	Show local help at point

I wonder if typing the suggested 'M-x help-quick-or-quit'
is really a quick way to get help?

Then I typed 'M-x help-quick-or-quit RET' but it doesn't exist
with "[No match]".

Then after 'C-h C-h' I tried to type 'q' (that means 'quick')
but it closed the Help window.

Finally, I opened the source code and found the command
'M-x cheat-sheet RET' that displayed the Help buffer.

But there is 'undo' displayed as bound to 'C-x u', not to other keys.





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

* bug#60101: 29.0.60; help-quick should use C-/ for undo
  2022-12-16 19:18   ` Philip Kaludercic
@ 2022-12-17 17:16     ` Juri Linkov
  2022-12-17 18:04       ` Philip Kaludercic
  0 siblings, 1 reply; 7+ messages in thread
From: Juri Linkov @ 2022-12-17 17:16 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 60101

>> In lisp/bindings.el its preferred binding is defined by this line:
>>
>>   (put 'undo :advertised-binding [?\C-x ?u])
>
> That is good, but it only solves the problem by providing the means.
> The other issue is figuring out how the advertised binding can
> automatically be set to whatever is preferred on the current system.  Is
> there a way to find out what keyboard layout is being used, or at least
> what modifiers have to be pressed for a key to be input?

If a key would be unbound on a tty, this could help to exclude it
from the preferred keybindings.  For example, if C-/ was unbound
depending on a tty type, then this would fall back to 'C-x u':

  (put 'undo :advertised-binding '([?\C-/] [?\C-x ?u]))

But otherwise, could you formulate a clear criteria for excluding
some keys from the set of preferred keys?  Do you know how to
query the current keyboard layout, or to find the preferred modifiers?





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

* bug#60101: 29.0.60; help-quick should use C-/ for undo
  2022-12-17 17:10 ` Juri Linkov
@ 2022-12-17 18:03   ` Philip Kaludercic
  0 siblings, 0 replies; 7+ messages in thread
From: Philip Kaludercic @ 2022-12-17 18:03 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 60101

Juri Linkov <juri@linkov.net> writes:

>> The new help-quick command makes use of `where-is-internal' to find the
>> binding for a command ti displays.  This works fine if a command has
>> only one binding, but in the case of `undo', C-_ is the first one it
>> suggests
>
> I tried to reproduce this problem, and typed 'C-h C-h' that showed:
>
>   Other Help Commands
>
>      C-e 	Extending Emacs with external packages
>      p 	Search for Emacs packages (see also M-x list-packages)
>      P 	Describe a specific Emacs package
>
>      t 	Start the Emacs tutorial
>      M-x help-quick-or-quit 	Display the quick help buffer.
>      e 	Show recent messages (from echo area)
>      l 	Show last 300 input keystrokes (lossage)
>      . 	Show local help at point
>
> I wonder if typing the suggested 'M-x help-quick-or-quit'
> is really a quick way to get help?

The intended way to display the buffer is C-h q.

> Then I typed 'M-x help-quick-or-quit RET' but it doesn't exist
> with "[No match]".
>
> Then after 'C-h C-h' I tried to type 'q' (that means 'quick')
> but it closed the Help window.
>
> Finally, I opened the source code and found the command
> 'M-x cheat-sheet RET' that displayed the Help buffer.
>
> But there is 'undo' displayed as bound to 'C-x u', not to other keys.

Hmm, interestingly this is also the case for me using emacs -Q, but I
don't recally customising anything to change this...





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

* bug#60101: 29.0.60; help-quick should use C-/ for undo
  2022-12-17 17:16     ` Juri Linkov
@ 2022-12-17 18:04       ` Philip Kaludercic
  0 siblings, 0 replies; 7+ messages in thread
From: Philip Kaludercic @ 2022-12-17 18:04 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 60101

Juri Linkov <juri@linkov.net> writes:

>>> In lisp/bindings.el its preferred binding is defined by this line:
>>>
>>>   (put 'undo :advertised-binding [?\C-x ?u])
>>
>> That is good, but it only solves the problem by providing the means.
>> The other issue is figuring out how the advertised binding can
>> automatically be set to whatever is preferred on the current system.  Is
>> there a way to find out what keyboard layout is being used, or at least
>> what modifiers have to be pressed for a key to be input?
>
> If a key would be unbound on a tty, this could help to exclude it
> from the preferred keybindings.  For example, if C-/ was unbound
> depending on a tty type, then this would fall back to 'C-x u':
>
>   (put 'undo :advertised-binding '([?\C-/] [?\C-x ?u]))
>
> But otherwise, could you formulate a clear criteria for excluding
> some keys from the set of preferred keys?  Do you know how to
> query the current keyboard layout, or to find the preferred modifiers?

No, I don't know.  What I had in mind was a sort of ordering to find the
key with the fewest modifiers, depending on the keyboard layout.





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

end of thread, other threads:[~2022-12-17 18:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-15 19:21 bug#60101: 29.0.60; help-quick should use C-/ for undo Philip Kaludercic
2022-12-15 19:34 ` Juri Linkov
2022-12-16 19:18   ` Philip Kaludercic
2022-12-17 17:16     ` Juri Linkov
2022-12-17 18:04       ` Philip Kaludercic
2022-12-17 17:10 ` Juri Linkov
2022-12-17 18:03   ` Philip Kaludercic

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.