emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Info-mode patch


From: Arthur Miller
Subject: Re: Info-mode patch
Date: Mon, 03 Jul 2023 00:43:15 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Juri Linkov <juri@linkov.net>
>> Cc: emacs-devel@gnu.org
>> Date: Sun, 02 Jul 2023 20:53:51 +0300
>> 
>> It seems you found a bug in 'key-valid-p'!
>> And indeed it returns nil:
>> 
>>   (key-valid-p "<tool-bar> <C-Back in history>")
>
> Why is it a bug?  "<tool-bar> <C-Back in history>" has no meaning,
> since it isn't a mouse event.

Is "remap" a mouse event? I am not familiar with the work behind the new
defvar-keymap, I was just looking at the existing code and expected it to be
consistent with the old vector syntax, since some other constructs seems to work
with it. It would be also nice if everything was in the same definition. It is
not necessary, but nice. Just an opinon.

#+begin_src emacs-lisp
(defvar-keymap Info-mode-map
  :doc "Keymap containing Info commands."
  :repeat t
  :suppress t
  "."         #'Info-beginning-of-buffer
  "SPC"       #'Info-scroll-up
  "S-SPC"     #'Info-scroll-down
  "C-m"       #'Info-follow-nearest-node
  "<tab>"     #'Info-next-reference
  "S-TAB"     #'Info-prev-reference
  "<backtab>" #'Info-prev-reference
  "1"         #'Info-nth-menu-item
  "2"         #'Info-nth-menu-item
  "3"         #'Info-nth-menu-item
  "4"         #'Info-nth-menu-item
  "5"         #'Info-nth-menu-item
  "6"         #'Info-nth-menu-item
  "7"         #'Info-nth-menu-item
  "8"         #'Info-nth-menu-item
  "9"         #'Info-nth-menu-item
  "0"         #'undefined
  "?"         #'Info-summary
  "]"         #'Info-forward-node
  "["         #'Info-backward-node
  "<"         #'Info-top-node
  ">"         #'Info-final-node
  "b"         #'Info-beginning-of-buffer
  "d"         #'Info-directory
  "e"         #'Info-end-of-buffer
  "f"         #'Info-follow-reference
  "g"         #'Info-goto-node
  "G"         #'Info-goto-node-web
  "h"         #'Info-help
    ;; This is for compatibility with standalone info (>~ version 5.2).
    ;; Though for some time, standalone info had H and h reversed.
    ;; See <https://debbugs.gnu.org/16455>.
  "H"         #'Info-describe-mode
  "i"         #'Info-index
  "I"         #'Info-virtual-index
  "l"         #'Info-history-back
  "L"         #'Info-history
  "m"         #'Info-menu
  "n"         #'Info-next
  "p"         #'Info-prev
  "q"         #'Info-quit-window
  "r"         #'Info-history-forward
  "s"         #'Info-search
  "S"         #'Info-search-case-sensitively
  "M-n"       #'clone-buffer
  "t"         #'Info-top-node
  "T"         #'Info-toc
  "u"         #'Info-up
    ;; `w' for consistency with `dired-copy-filename-as-kill'.
  "w"          #'Info-copy-current-node-name
  "c"          #'Info-copy-current-node-name
    ;; `^' for consistency with `dired-up-directory'.
  "^"                   #'Info-up
  ","                   #'Info-index-next
  "DEL"                 #'Info-scroll-down
  "<remap> <goto-line>" #'goto-line-relative
  "<mouse-2>"           #'Info-mouse-follow-nearest-node
  "<follow-link>"        'mouse-face
  "<XF86Back>"          #'Info-history-back
  "<XF86Forward>"       #'Info-history-forward)
#+end_src

By the way, as a last thing, is this a bug (found it while I was parsing
Info-mode-map and generated wrappers for commands in it some time ago):

(insert (pp Info-mode-map))

(keymap
 #^[nil nil keymap
        #^^[3 0 nil nil nil nil nil nil nil nil nil Info-next-reference nil nil 
nil Info-follow-nearest-node nil nil nil nil nil nil nil nil nil nil nil nil nil
        
I have removed rest of printed code for the brewity for the mail, but if you
eval above and place the cursor somewhere after the "keymap", or before the char
table, and then try to read the subtype with:

(char-table-subtype (read (current-buffer)))

Then Emacs dumps core in version 26 up to current master. Emacs 25 actually ends
up in debugger instead of crashing:

Debugger entered--Lisp error: (wrong-type-argument char-table-p 
#^^[3 0 nil nil nil nil nil nil nil nil nil Info-next-reference nil nil nil 
Info-follow-nearest-node nil nil nil nil nil nil nil nil nil nil nil nil nil 
(keymap (110 . clone-buffer) (9 . Info-prev-reference)) nil nil nil nil 
Info-scroll-up nil nil nil nil nil nil nil nil nil nil nil Info-index-next 
negative-argument beginning-of-buffer nil undefined Info-nth-menu-item 
Info-nth-menu-item Info-nth-menu-item Info-nth-menu-item Info-nth-menu-item 
Info-nth-menu-item Info-nth-menu-item Info-nth-menu-item Info-nth-menu-item nil 
nil Info-top-node nil Info-final-node Info-summary nil nil nil nil nil nil nil 
nil describe-mode Info-virtual-index nil nil Info-history nil nil nil nil nil 
nil Info-search-case-sensitively Info-toc nil nil nil nil nil nil 
Info-backward-node nil Info-forward-node Info-up nil nil nil 
beginning-of-buffer Info-copy-current-node-name Info-directory end-of-buffer 
Info-follow-reference Info-goto-node Info-help Info-index nil nil 
Info-history-back Info-menu Info-next nil Info-prev Info-exit 
Info-history-forward Info-search Info-top-node Info-up nil 
Info-copy-current-node-name nil nil nil nil nil nil nil Info-scroll-down])
#^^[3 0 nil nil nil nil nil nil nil nil nil Info-next-reference nil nil nil 
Info-follow-nearest-node nil nil nil nil nil nil nil nil nil nil nil nil nil 
(keymap (110 . clone-buffer) (9 . Info-prev-reference)) nil nil nil nil 
Info-scroll-up nil nil nil nil nil nil nil nil nil nil nil Info-index-next 
negative-argument beginning-of-buffer nil undefined ...]))
  char-table-subtype(
#^^[3 0 nil nil nil nil nil nil nil nil nil Info-next-reference nil nil nil 
Info-follow-nearest-node nil nil nil nil nil nil nil nil nil nil nil nil nil 
(keymap (110 . clone-buffer) (9 . Info-prev-reference)) nil nil nil nil 
Info-scroll-up nil nil nil nil nil nil nil nil nil nil nil Info-index-next 
negative-argument beginning-of-buffer nil undefined ...])
  eval((char-table-subtype (read (current-buffer))) nil)
  eval-expression((char-table-subtype (read (current-buffer))) nil)
  funcall-interactively(eval-expression (char-table-subtype (read 
(current-buffer))) nil)
  call-interactively(eval-expression nil nil)
  command-execute(eval-expression)

Not of crucial importance, but perhaps of inerest to know if it is not already
known. Perhaps it is known? I found it some time ago, but was testing today with
different Emacs versions, and found now it seems to appear first in version 26.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]