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

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

bug#56198: Request to delete window with mouse event


From: Visuwesh
Subject: bug#56198: Request to delete window with mouse event
Date: Sun, 26 Jun 2022 20:56:03 +0530
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

[ஞாயிறு ஜூன் 26, 2022] Lars Ingebrigtsen wrote:

> Visuwesh <visuweshm@gmail.com> writes:
>
>> Ah indeed, that would be nice.  The following patch does the job for me
>> but maybe there's a cleaner way to do this?
>
> [...]
>
>> -    (delete-window (posn-window (event-start click)))))
>> +    (when (eq (posn-window (event-end click))
>> +              (posn-window (event-start click)))
>> +      (delete-window (posn-window (event-start click))))))
>
> I think it makes sense to change the behaviour here, but this doesn't
> seem to do the trick for me?  I.e., <mouse-3> on the mode line, and then
> moving the pointer out of the mode line, and then releasing it still
> deletes the window.

I was kind of sloppy with that.  If you move the mouse to another
window, then it won't delete it.  But you're right, it should also bail
out if the end position wasn't the modeline so something like this
maybe?

diff --git a/lisp/mouse.el b/lisp/mouse.el
index 82c8a14693..3dc4e6b76c 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -655,7 +655,11 @@ mouse-delete-window
   (interactive "e")
   (unless (one-window-p t)
     (mouse-minibuffer-check click)
-    (delete-window (posn-window (event-start click)))))
+    (when (and (eq (posn-area (event-end click))
+                   'mode-line)
+               (eq (posn-window (event-end click))
+                   (posn-window (event-start click))))
+      (delete-window (posn-window (event-start click))))))
 
 (defun mouse-select-window (click)
   "Select the window clicked on; don't move point."






reply via email to

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