unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [nongnu] elpa/meow 9860a7a218: Correct unused lexical variable (#411)
       [not found] ` <20230310010125.5A435C13A88@vcs2.savannah.gnu.org>
@ 2023-03-10 19:40   ` Stefan Monnier
  2023-03-10 19:43     ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Monnier @ 2023-03-10 19:40 UTC (permalink / raw)
  To: Campbell Barton; +Cc: emacs-devel

> @@ -1636,7 +1636,7 @@ This command is a replacement for built-in `kmacro-end-macro'."
>    (interactive (list (help--read-key-sequence)))
>    (if (= 1 (length key-list))
>        (let* ((key (format-kbd-macro (cdar key-list)))
> -             (cmd (key-binding (cdar key-list))))
> +             (cmd (key-binding key)))

Hmm... that doesn't look right: `format-kbd-macro` is like
`key-description`, i.e. it returns a human-readable version of a key
sequence.  That is (more or less) the format understood by `kbd` (and
`key-parse`) but is not the format accepted by `key-binding`, which
expects an actual vector of events (which can degenerate to a string if
the events are simple enough).


        Stefan




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

* Re: [nongnu] elpa/meow 9860a7a218: Correct unused lexical variable (#411)
  2023-03-10 19:40   ` [nongnu] elpa/meow 9860a7a218: Correct unused lexical variable (#411) Stefan Monnier
@ 2023-03-10 19:43     ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2023-03-10 19:43 UTC (permalink / raw)
  To: Campbell Barton; +Cc: emacs-devel

> Hmm... that doesn't look right: `format-kbd-macro` is like
> `key-description`, i.e. it returns a human-readable version of a key
> sequence.  That is (more or less) the format understood by `kbd` (and
> `key-parse`) but is not the format accepted by `key-binding`, which
> expects an actual vector of events (which can degenerate to a string if
> the events are simple enough).

BTW, here's a related patch I've had pending for a while.


        Stefan


diff --git a/meow-command.el b/meow-command.el
index 13602c6ffd..d19cb39217 100644
--- a/meow-command.el
+++ b/meow-command.el
@@ -1178,7 +1178,8 @@ with UNIVERSAL ARGUMENT, search both side."
 (defun meow-search (arg)
   " Search and select with the car of current `regexp-search-ring'.
 
-If the contents of selection doesn't match the regexp, will push it to `regexp-search-ring' before searching.
+If the contents of selection doesn't match the regexp, will push it to
+`regexp-search-ring' before searching.
 
 To search backward, use \\[negative-argument]."
   (interactive "P")
@@ -1632,24 +1633,26 @@ This command is a replacement for built-in `kmacro-end-macro'."
      (setq mouse-secondary-start next-marker)
      (meow--cancel-selection))))
 
-(defun meow-describe-key (key-list &optional buffer up-event)
+(defun meow-describe-key (key-list &rest args)
   (interactive (list (help--read-key-sequence)))
-  (if (= 1 (length key-list))
-      (let* ((key (format-kbd-macro (cdar key-list)))
-             (cmd (key-binding key)))
-        (if-let ((dispatch (and (commandp cmd)
-                                (get cmd 'meow-dispatch))))
-            (describe-key (kbd dispatch) buffer up-event)
-          (describe-key key-list buffer up-event)))
-    ;; for mouse events
-    (describe-key key-list buffer up-event)))
+  (apply #'describe-key
+         (if (= 1 (length key-list))
+             (let* (;; (key (format-kbd-macro (cdar key-list)))
+                    (cmd (key-binding (cdar key-list))))
+               (if-let ((dispatch (and (commandp cmd)
+                                       (get cmd 'meow-dispatch))))
+                   (kbd dispatch)
+                 key-list))
+           ;; for mouse events
+           key-list)
+         args))
 
 ;; aliases
-(defalias 'meow-backward-delete 'meow-backspace)
-(defalias 'meow-c-d 'meow-C-d)
-(defalias 'meow-c-k 'meow-C-k)
-(defalias 'meow-delete 'meow-C-d)
-(defalias 'meow-cancel 'meow-cancel-selection)
+(defalias 'meow-backward-delete #'meow-backspace)
+(defalias 'meow-c-d #'meow-C-d)
+(defalias 'meow-c-k #'meow-C-k)
+(defalias 'meow-delete #'meow-C-d)
+(defalias 'meow-cancel #'meow-cancel-selection)
 
 ;; removed commands
 




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

end of thread, other threads:[~2023-03-10 19:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <167841008488.32504.7948735471580268728@vcs2.savannah.gnu.org>
     [not found] ` <20230310010125.5A435C13A88@vcs2.savannah.gnu.org>
2023-03-10 19:40   ` [nongnu] elpa/meow 9860a7a218: Correct unused lexical variable (#411) Stefan Monnier
2023-03-10 19:43     ` Stefan Monnier

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