all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: 59785@debbugs.gnu.org
Subject: bug#59785: 30.0.50; mouse-2 > (wrong-type-argument listp #<frame *Calendar* 0x...>)
Date: Mon, 05 Dec 2022 16:32:55 +0200	[thread overview]
Message-ID: <83mt819azs.fsf@gnu.org> (raw)
In-Reply-To: <87359ultd5.fsf@web.de> (message from Michael Heerdegen on Sun, 04 Dec 2022 23:03:02 +0100)

> 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	other threads:[~2022-12-05 14:32 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-02 19:19 bug#59785: 30.0.50; mouse-2 > (wrong-type-argument listp #<frame *Calendar* 0x...>) Michael Heerdegen
2022-12-02 19:53 ` Eli Zaretskii
2022-12-02 20:00   ` Eli Zaretskii
2022-12-03 11:58     ` Michael Heerdegen
2022-12-03 12:04       ` Michael Heerdegen
2022-12-03 13:50         ` Eli Zaretskii
2022-12-03 15:07           ` Michael Heerdegen
2022-12-03 15:15             ` Eli Zaretskii
2022-12-03 17:22               ` Michael Heerdegen
2022-12-03 17:53                 ` Michael Heerdegen
2022-12-03 18:17                   ` Eli Zaretskii
2022-12-03 18:34                     ` Eli Zaretskii
2022-12-03 19:46                       ` Michael Heerdegen
2022-12-03 20:19                         ` Michael Heerdegen
2022-12-04  6:19                           ` Eli Zaretskii
2022-12-04  6:17                         ` Eli Zaretskii
2022-12-04 22:03                           ` Michael Heerdegen
2022-12-05 14:32                             ` Eli Zaretskii [this message]
2022-12-05 19:15                               ` Michael Heerdegen
2022-12-05 19:57                                 ` Eli Zaretskii
2022-12-03 18:03                 ` Eli Zaretskii
2022-12-03 18:54                   ` Michael Heerdegen
2022-12-03 19:27                     ` Eli Zaretskii
2022-12-03 12:24       ` Eli Zaretskii
2022-12-03 14:58         ` Michael Heerdegen

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=83mt819azs.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=59785@debbugs.gnu.org \
    --cc=michael_heerdegen@web.de \
    /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.