bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#59785: 30.0.50; mouse-2 > (wrong-type-argument listp #<frame *Calend


From: Eli Zaretskii
Subject: bug#59785: 30.0.50; mouse-2 > (wrong-type-argument listp #<frame *Calendar* 0x...>)
Date: Mon, 05 Dec 2022 16:32:55 +0200

> From: Michael Heerdegen <michael_heerdegen@web.de>
> Cc: 59785@debbugs.gnu.org
> Date: Sun, 04 Dec 2022 23:03:02 +0100
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > So if you cannot reproduce the org-capture case in "emacs -Q", perhaps
> > some other recipe which causes the same backtrace can be reproduced?
> 
> I tried all day and we are lucky, I finally found a recipe for emacs -Q,
> and it seems indeed to be a regression from at least 27.1:
> 
> #+begin_src emacs-lisp
>   (require 'org)
>   (require 'calendar)
> 
>   (setq org-read-date-popup-calendar t)
>   (setq calendar-setup 'calendar-only)
> 
>   ;; my probably a bit non-standard setup:
>   (global-set-key [down-mouse-2] #'mouse-drag-drag)
>   (define-key calendar-mode-map [down-mouse-2] nil)
> 
>   (setq debug-on-error t)
>   ;; this is only to allow to switch to the
>   ;; Debugger despite of the active minibuffer
>   (setq enable-recursive-minibuffers t)
> 
>   ;; Now select a date with mouse-2 in the calendar after
>   ;; evaluating this:
>   (org-read-date)
>   ;; then switch to the debugger buffer (e.g. with C-x C-b)
> #+end_src

Thanks, this helped a lot.  Please try the patch below; it seems to work
here, and doesn't break the mouse-drag-drag feature (which was my TIL
moment, although it exists since Emacs 20...):

diff --git a/lisp/mouse-drag.el b/lisp/mouse-drag.el
index f515cc8..1665bd1 100644
--- a/lisp/mouse-drag.el
+++ b/lisp/mouse-drag.el
@@ -275,6 +275,7 @@ mouse-drag-drag
         have-scrolled
         window-last-row
         col window-last-col
+         switch-frame-p
         (scroll-col-delta 0)
         ;; be conservative about allowing horizontal scrolling
         (col-scrolling-p (mouse-drag-should-do-col-scrolling)))
@@ -286,15 +287,16 @@ mouse-drag-drag
       (setq track-mouse 'drag-dragging)
       (while (progn
               (setq event (read--potential-mouse-event)
-                    end (event-end event)
-                    row (cdr (posn-col-row end))
-                    col (car (posn-col-row end)))
-              (or (mouse-movement-p event)
-                  (eq (car-safe event) 'switch-frame)))
+                     switch-frame-p (eq (car-safe event) 'switch-frame))
+               (or switch-frame-p
+                   (setq end (event-end event)
+                        row (cdr (posn-col-row end))
+                        col (car (posn-col-row end))))
+              (or (mouse-movement-p event) switch-frame-p))
        ;; Scroll if see if we're on the edge.
        ;; FIXME: should handle mouse-in-other window.
        (cond
-        ((not (eq start-window (posn-window end)))
+        ((or switch-frame-p (not (eq start-window (posn-window end))))
          t) ; wait for return to original window
         ((<= row 0) (mouse-drag-repeatedly-safe-scroll -1 0))
         ((>= row window-last-row) (mouse-drag-repeatedly-safe-scroll 1 0))





reply via email to

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