unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Visuwesh <visuweshm@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 56198@debbugs.gnu.org, carlmarcos@tutanota.com, eliz@gnu.org
Subject: bug#56198: Request to delete window with mouse event
Date: Sun, 26 Jun 2022 21:10:35 +0530	[thread overview]
Message-ID: <874k07bfgs.fsf@gmail.com> (raw)
In-Reply-To: <87bkufe91n.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sun, 26 Jun 2022 17:31:00 +0200")

[-- Attachment #1: Type: text/plain, Size: 552 bytes --]

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

> Visuwesh <visuweshm@gmail.com> writes:
>
>> 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?
>
> Thanks; that works well for me, too, so I've now pushed your patch to
> Emacs 29.

How about doing this as well?  (On hindsight, I should have included
this in the other mail as well but oh well)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Make-mouse-2-in-mode-line-more-careful-as-well.patch --]
[-- Type: text/x-diff, Size: 1213 bytes --]

From 6dc4f29dbfcf6c40ef0808bf04987d918df98972 Mon Sep 17 00:00:00 2001
From: Visuwesh <visuweshm@gmail.com>
Date: Sun, 26 Jun 2022 21:10:09 +0530
Subject: [PATCH] Make <mouse-2> in mode line more careful as well

* lisp/mouse.el (mouse-delete-other-windows): Only delete other
windows if the user didn't move the cursor off the mode-line. (bug#56198)
---
 lisp/mouse.el | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lisp/mouse.el b/lisp/mouse.el
index 82c8a14693..f7ada4f1ec 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -681,10 +681,13 @@ tear-off-window
     (switch-to-buffer buf)
     (delete-window window)))
 
-(defun mouse-delete-other-windows ()
+(defun mouse-delete-other-windows (click)
   "Delete all windows except the one you click on."
-  (interactive "@")
-  (delete-other-windows))
+  (interactive "e")
+  (when (and (eq (posn-area (event-end click)) 'mode-line)
+             (eq (posn-window (event-start click))
+                 (posn-window (event-end click))))
+    (delete-other-windows (posn-window (event-start click)))))
 
 (defun mouse-split-window-vertically (click)
   "Select Emacs window mouse is on, then split it vertically in half.
-- 
2.35.1


  reply	other threads:[~2022-06-26 15:40 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-24 15:27 bug#56198: Request to delete window with mouse event carlmarcos--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-24 17:05 ` Juri Linkov
2022-06-24 17:10 ` Visuwesh
     [not found] ` <878rpmasxd.fsf@gmail.com-N5LgcGT----2>
2022-06-25  7:35   ` carlmarcos--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-25  8:14     ` Visuwesh
2022-06-25  8:24     ` Eli Zaretskii
2022-06-25 12:34       ` carlmarcos--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-25 14:14         ` Visuwesh
2022-06-26 15:01           ` Lars Ingebrigtsen
2022-06-26 15:26             ` Visuwesh
2022-06-26 15:31               ` Lars Ingebrigtsen
2022-06-26 15:40                 ` Visuwesh [this message]
2022-06-26 15:46                   ` Lars Ingebrigtsen
     [not found]           ` <87letjeafl.fsf@gnus.org-N5VXCNa--7-2>
2022-06-26 15:15             ` carlmarcos--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-26 15:20               ` Eli Zaretskii
2022-06-29  0:07 ` Tak Kunihiro
     [not found] ` <m1v8skib7p.fsf@misasa.okayama-u.ac.jp-N5gmMGf--N-2>
2022-06-29  0:15   ` carlmarcos--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-29  9:16     ` Tak Kunihiro
     [not found]     ` <m1k08zhlt0.fsf@misasa.okayama-u.ac.jp-N5io4Li----2>
2022-06-29 10:37       ` carlmarcos--- 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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=874k07bfgs.fsf@gmail.com \
    --to=visuweshm@gmail.com \
    --cc=56198@debbugs.gnu.org \
    --cc=carlmarcos@tutanota.com \
    --cc=eliz@gnu.org \
    --cc=larsi@gnus.org \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).