all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: jm@pub.pink, 68213@debbugs.gnu.org
Subject: bug#68213: 30.0.50; completion-preview-tests failure in --without-x build
Date: Sun, 07 Jan 2024 12:46:27 -0500	[thread overview]
Message-ID: <jwv1qatf3rn.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <83le91qde5.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 07 Jan 2024 19:09:06 +0200")

> So in that case we need something like
>
>   (or (boundp 'mouse-wheel-up-event)
>       (defvar mouse-wheel-up-event nil))

That's basically equivalent to

    (defvar mouse-wheel-up-event nil)

But no, it would be wrong for completion-preview.el to define
mwheel.el's variables.

Instead we should either (require 'mwheel) or test `boundp` when we
*use* the variable.

Sadly, `defvar-keymap` does not offer any convenient way to specify
conditional bindings, tho we could use a hack like

    (key-description
     (vector (or (bound-and-true-p mouse-wheel-up-event)
                 'completion-preview--dummy-wheel-up)))

Overall, we can work around the limitations of `defvar-keymap` with the
ugly patch below.

> But I guess I will wait until Po Lu explains why these are defined as
> they are before doing something about this test failure.

I have the impression that `mwheel.el` should just blindly always use
`wheel-up/down/..` events (i.e. hard code them), and optionally
also obey `mouse-5/4` on those systems that need them (based on
`mouse-wheel-up/down-event` custom vars).


        Stefan


diff --git a/lisp/completion-preview.el b/lisp/completion-preview.el
index baadb4714b1..8d7ad97d2c3 100644
--- a/lisp/completion-preview.el
+++ b/lisp/completion-preview.el
@@ -128,19 +128,31 @@ completion-preview-active-mode-map
   ;; "M-p" #'completion-preview-prev-candidate
   )
 
-(defvar mouse-wheel-up-event)
-(defvar mouse-wheel-up-alternate-event)
-(defvar mouse-wheel-down-event)
-(defvar mouse-wheel-down-alternate-event)
 (defvar-keymap completion-preview--mouse-map
   :doc "Keymap for mouse clicks on the completion preview."
   "<down-mouse-1>" #'completion-preview-insert
   "C-<down-mouse-1>" #'completion-at-point
   "<down-mouse-2>" #'completion-at-point
-  (format "<%s>" mouse-wheel-up-event)             #'completion-preview-prev-candidate
-  (format "<%s>" mouse-wheel-up-alternate-event)   #'completion-preview-prev-candidate
-  (format "<%s>" mouse-wheel-down-event)           #'completion-preview-next-candidate
-  (format "<%s>" mouse-wheel-down-alternate-event) #'completion-preview-next-candidate)
+  (key-description (vector (or (bound-and-true-p mouse-wheel-up-event)
+                               'completion-preview--dummy-wheel-up)))
+  #'completion-preview-prev-candidate
+  (key-description
+   (vector (let ((event (bound-and-true-p mouse-wheel-up-alternate-event)))
+             (if (and event (not (eq event (bound-and-true-p
+                                            mouse-wheel-up-event))))
+                 event
+               'completion-preview--dummy-wheel-up-alt))))
+  #'completion-preview-prev-candidate
+  (key-description (vector (or (bound-and-true-p mouse-wheel-down-event)
+                               'completion-preview--dummy-wheel-down)))
+  #'completion-preview-next-candidate
+  (key-description
+   (vector (let ((event (bound-and-true-p mouse-wheel-down-alternate-event)))
+             (if (and event (not (eq event (bound-and-true-p
+                                            mouse-wheel-down-event))))
+                 event
+               'completion-preview--dummy-wheel-down-alt))))
+  #'completion-preview-next-candidate)
 
 (defvar-local completion-preview--overlay nil)
 






  reply	other threads:[~2024-01-07 17:46 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-02 16:42 bug#68213: 30.0.50; completion-preview-tests failure in --without-x build john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-02 17:11 ` Eli Zaretskii
2024-01-02 17:20   ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-02 17:42     ` john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-03  7:20       ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-03 17:27         ` Eli Zaretskii
2024-01-03 18:45           ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-03 19:18             ` Eli Zaretskii
2024-01-05  7:17               ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-05 11:54                 ` Eli Zaretskii
2024-01-07 17:15                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-07 17:19                   ` Eli Zaretskii
2024-01-07 16:54             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-08  1:51               ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-08  3:19                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-08  6:16                   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-08 12:48                     ` Eli Zaretskii
2024-01-08 14:20                       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-08 17:12                         ` Eli Zaretskii
2024-01-09  1:01                         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-08 15:21                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-09  1:39                       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-09  4:11                         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-09  6:07                           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-09 14:44                             ` Drew Adams
2024-01-02 17:48     ` Eli Zaretskii
2024-01-07 16:46       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-02 17:48   ` john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-02 19:15     ` Eli Zaretskii
2024-01-02 22:49       ` john muhl via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-06  9:42         ` Eli Zaretskii
2024-01-07 17:03           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-07 17:09             ` Eli Zaretskii
2024-01-07 17:46               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-01-13  0:16           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-13  6:55             ` Eli Zaretskii
2024-01-13  7:17               ` Stefan Kangas
2024-01-20  9:15                 ` Eli Zaretskii
2024-01-20 20:19                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

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

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

  git send-email \
    --in-reply-to=jwv1qatf3rn.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=68213@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=jm@pub.pink \
    --cc=monnier@iro.umontreal.ca \
    /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 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.