GNU bug report logs - #56198
Request to delete window with mouse event

Previous Next

Package: emacs;

Reported by: carlmarcos <at> tutanota.com

Date: Fri, 24 Jun 2022 16:50:02 UTC

Severity: normal

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Visuwesh <visuweshm <at> gmail.com>
To: 56198 <at> debbugs.gnu.org
Cc: eliz <at> gnu.org, carlmarcos <at> tutanota.com
Subject: bug#56198: Request to delete window with mouse event
Date: Sat, 25 Jun 2022 19:44:05 +0530
[சனி ஜூன் 25, 2022] carlmarcos--- via "Bug reports for GNU Emacs, the Swiss army knife of text editors" wrote:

> Jun 25, 2022, 08:24 by eliz <at> gnu.org:
>
>>> Cc: 56198 <at> debbugs.gnu.org
>>> Date: Sat, 25 Jun 2022 09:35:21 +0200 (CEST)
>>> From: carlmarcos--- via "Bug reports for GNU Emacs,
>>>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>>>
>>> Actually, I have noticed a problem with using mouse-3 on mode-line.  Suppose
>>> you push mouse-3 on mode-line, the window is removed without giving me the 
>>> possibility to net remove it should I change my mind.
>>>
>>
>> Why is that a problem?  Removing a window doesn't lose any important
>> information, and you can easily restore it with "C-x 4 b" or somesuch.
>>
> If would be neater to activate only when the mouse-3 button release occurs on the mode-line
> or window.  If one moves the mouse pointer outside the window or outside emacs, then releasing
> the pressed mouse-3 button, would have no effect.  This would be consistent with how menus work. 

Ah indeed, that would be nice.  The following patch does the job for me
but maybe there's a cleaner way to do this?

diff --git a/lisp/mouse.el b/lisp/mouse.el
index 82c8a14693..1878709113 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -655,7 +655,9 @@ mouse-delete-window
   (interactive "e")
   (unless (one-window-p t)
     (mouse-minibuffer-check click)
-    (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))))))
 
 (defun mouse-select-window (click)
   "Select the window clicked on; don't move point."

The same should done for mouse-2 as well.




This bug report was last modified 2 years and 328 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.