GNU bug report logs -
#56198
Request to delete window with mouse event
Previous Next
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.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 56198 in the body.
You can then email your comments to 56198 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56198
; Package
emacs
.
(Fri, 24 Jun 2022 16:50:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
carlmarcos <at> tutanota.com
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 24 Jun 2022 16:50:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
I frequently split my windows, I usually kill the buffer using the menu bar. But this leaves me with the window open with some other buffer. Would like to request some facility to delete a window (delete-window) using the mouse, as I frequently do for `kill-buffer'. Perhaps the capability could be inserted in the window mode-line. Where one can usually turn off a minor-mode with the mouse.
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56198
; Package
emacs
.
(Fri, 24 Jun 2022 17:07:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 56198 <at> debbugs.gnu.org (full text, mbox):
> I frequently split my windows, I usually kill the buffer using the menu
> bar. But this leaves me with the window open with some other buffer.
> Would like to request some facility to delete a window (delete-window)
> using the mouse, as I frequently do for `kill-buffer'. Perhaps the
> capability could be inserted in the window mode-line. Where one can
> usually turn off a minor-mode with the mouse.
mouse-3 on the mode line deletes the window.
Also there is the built-in package emacs/lisp/strokes.el
for binding mouse strokes to commands.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56198
; Package
emacs
.
(Fri, 24 Jun 2022 17:11:02 GMT)
Full text and
rfc822 format available.
Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):
[வெள்ளி ஜூன் 24, 2022] carlmarcos--- via "Bug reports for GNU Emacs, the Swiss army knife of text editors" wrote:
> I frequently split my windows, I usually kill the buffer using the
> menu bar. But this leaves me with the window open with some other
> buffer. Would like to request some facility to delete a window
> (delete-window) using the mouse, as I frequently do for
> `kill-buffer'. Perhaps the capability could be inserted in the window
> mode-line. Where one can usually turn off a minor-mode with the
> mouse.
I think mouse-3 (i.e., Right Click) on the mode-line does what you want?
However, this does not kill the buffer that shown in the window though
but should be easy enough to change (search for "mouse-delete-window" in
mouse.el).
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56198
; Package
emacs
.
(Fri, 24 Jun 2022 17:12:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56198
; Package
emacs
.
(Sat, 25 Jun 2022 07:36:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 56198 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
--
Sent with Tutanota, enjoy secure & ad-free emails.
Jun 24, 2022, 17:10 by visuweshm <at> gmail.com:
> [வெள்ளி ஜூன் 24, 2022] carlmarcos--- via "Bug reports for GNU Emacs, the Swiss army knife of text editors" wrote:
>
>> I frequently split my windows, I usually kill the buffer using the
>> menu bar. But this leaves me with the window open with some other
>> buffer. Would like to request some facility to delete a window
>> (delete-window) using the mouse, as I frequently do for
>> `kill-buffer'. Perhaps the capability could be inserted in the window
>> mode-line. Where one can usually turn off a minor-mode with the
>> mouse.
>>
>
> I think mouse-3 (i.e., Right Click) on the mode-line does what you want?
> However, this does not kill the buffer that shown in the window though
> but should be easy enough to change (search for "mouse-delete-window" in
> mouse.el).
>
Was not aware of mouse-3 on mode-line. Just need to rewove the window,
without necessarily killing the buffer.
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.
It is different behaviour than for instance the mode-line options for minor-mode,
where you can decide not to take any action.
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56198
; Package
emacs
.
(Sat, 25 Jun 2022 08:15:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 56198 <at> debbugs.gnu.org (full text, mbox):
[சனி ஜூன் 25, 2022] carlmarcos <at> tutanota.com wrote:
> Jun 24, 2022, 17:10 by visuweshm <at> gmail.com:
>
> [வெள்ளி ஜூன் 24, 2022] carlmarcos--- via "Bug reports for GNU Emacs, the Swiss army knife of text editors"
> wrote:
>
> I frequently split my windows, I usually kill the buffer using the
> menu bar. But this leaves me with the window open with some other
> buffer. Would like to request some facility to delete a window
> (delete-window) using the mouse, as I frequently do for
> `kill-buffer'. Perhaps the capability could be inserted in the window
> mode-line. Where one can usually turn off a minor-mode with the
> mouse.
>
> I think mouse-3 (i.e., Right Click) on the mode-line does what you want?
> However, this does not kill the buffer that shown in the window though
> but should be easy enough to change (search for "mouse-delete-window" in
> mouse.el).
>
> Was not aware of mouse-3 on mode-line. Just need to rewove the window,
> without necessarily killing the buffer.
>
> 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.
>
> It is different behaviour than for instance the mode-line options for minor-mode,
> where you can decide not to take any action.
For this, I have winner-mode enabled. Should I regret my choice, I
simply say M-x winner-undo RET. Granted, this requires the keyboard but
this is not a frequent problem for me to care enough.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56198
; Package
emacs
.
(Sat, 25 Jun 2022 08:26:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 56198 <at> debbugs.gnu.org (full text, mbox):
> 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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56198
; Package
emacs
.
(Sat, 25 Jun 2022 12:35:02 GMT)
Full text and
rfc822 format available.
Message #26 received at 56198 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
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.
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56198
; Package
emacs
.
(Sat, 25 Jun 2022 14:16:01 GMT)
Full text and
rfc822 format available.
Message #29 received at submit <at> debbugs.gnu.org (full text, mbox):
[சனி ஜூன் 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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56198
; Package
emacs
.
(Sat, 25 Jun 2022 14:16:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56198
; Package
emacs
.
(Sun, 26 Jun 2022 15:02:02 GMT)
Full text and
rfc822 format available.
Message #35 received at 56198 <at> debbugs.gnu.org (full text, mbox):
Visuwesh <visuweshm <at> 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.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56198
; Package
emacs
.
(Sun, 26 Jun 2022 15:16:03 GMT)
Full text and
rfc822 format available.
Message #38 received at 56198 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Jun 26, 2022, 15:01 by larsi <at> gnus.org:
> Visuwesh <visuweshm <at> 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.
>
Have made a suggestion to remove the programming or hypertext major-mode name
in the mode-line. It is usually understood that programming and hypertext files use
the corresponding mode for the language.
> --
> (domestic pets only, the antidote for overdose, milk.)
> bloggy blog: http://lars.ingebrigtsen.no
>
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56198
; Package
emacs
.
(Sun, 26 Jun 2022 15:21:01 GMT)
Full text and
rfc822 format available.
Message #41 received at 56198 <at> debbugs.gnu.org (full text, mbox):
> Date: Sun, 26 Jun 2022 17:15:02 +0200 (CEST)
> From: carlmarcos <at> tutanota.com
> Cc: Visuwesh <visuweshm <at> gmail.com>, 56198 <at> debbugs.gnu.org, eliz <at> gnu.org
>
> Have made a suggestion to remove the programming or hypertext major-mode name
> in the mode-line.
Won't happen, sorry. Emacs always shows the major mode there, and
will continue to do so.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56198
; Package
emacs
.
(Sun, 26 Jun 2022 15:27:01 GMT)
Full text and
rfc822 format available.
Message #44 received at 56198 <at> debbugs.gnu.org (full text, mbox):
[ஞாயிறு ஜூன் 26, 2022] Lars Ingebrigtsen wrote:
> Visuwesh <visuweshm <at> 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."
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56198
; Package
emacs
.
(Sun, 26 Jun 2022 15:32:01 GMT)
Full text and
rfc822 format available.
Message #47 received at 56198 <at> debbugs.gnu.org (full text, mbox):
Visuwesh <visuweshm <at> 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.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
bug marked as fixed in version 29.1, send any further explanations to
56198 <at> debbugs.gnu.org and carlmarcos <at> tutanota.com
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Sun, 26 Jun 2022 15:32:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56198
; Package
emacs
.
(Sun, 26 Jun 2022 15:41:02 GMT)
Full text and
rfc822 format available.
Message #52 received at 56198 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
[ஞாயிறு ஜூன் 26, 2022] Lars Ingebrigtsen wrote:
> Visuwesh <visuweshm <at> 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)
[0001-Make-mouse-2-in-mode-line-more-careful-as-well.patch (text/x-diff, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56198
; Package
emacs
.
(Sun, 26 Jun 2022 15:47:02 GMT)
Full text and
rfc822 format available.
Message #55 received at 56198 <at> debbugs.gnu.org (full text, mbox):
Visuwesh <visuweshm <at> gmail.com> writes:
> How about doing this as well? (On hindsight, I should have included
> this in the other mail as well but oh well)
Thanks; makes sense to me, so pushed to Emacs 29 as well.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56198
; Package
emacs
.
(Wed, 29 Jun 2022 00:08:01 GMT)
Full text and
rfc822 format available.
Message #58 received at submit <at> debbugs.gnu.org (full text, mbox):
> I frequently split my windows, I usually kill the buffer using the
> menu bar. But this leaves me with the window open with some other
> buffer. Would like to request some facility to delete a window
> (delete-window) using the mouse, as I frequently do for `kill-buffer'.
> Perhaps the capability could be inserted in the window mode-line.
> Where one can usually turn off a minor-mode with the mouse.
How about having `Close' in context menu?
["Close"
(lambda () (interactive)
(if (one-window-p)
(if (> (length (visible-frame-list)) 1)
(call-interactively 'delete-frame)
(kill-buffer (window-buffer))) ; (quit-window)
(delete-window)))
:help "Remove this window or this frame, or kill this buffer"
:visible (not (region-active-p))
:active t]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56198
; Package
emacs
.
(Wed, 29 Jun 2022 00:08:01 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56198
; Package
emacs
.
(Wed, 29 Jun 2022 00:16:02 GMT)
Full text and
rfc822 format available.
Message #64 received at 56198 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Jun 29, 2022, 00:07 by homeros.misasa <at> gmail.com:
>> I frequently split my windows, I usually kill the buffer using the
>> menu bar. But this leaves me with the window open with some other
>> buffer. Would like to request some facility to delete a window
>> (delete-window) using the mouse, as I frequently do for `kill-buffer'.
>> Perhaps the capability could be inserted in the window mode-line.
>> Where one can usually turn off a minor-mode with the mouse.
>>
>
> How about having `Close' in context menu?
>
I cannot understand this terminology. How does one access the context menu?
What is it?
> ["Close"
> (lambda () (interactive)
> (if (one-window-p)
> (if (> (length (visible-frame-list)) 1)
> (call-interactively 'delete-frame)
> (kill-buffer (window-buffer))) ; (quit-window)
> (delete-window)))
> :help "Remove this window or this frame, or kill this buffer"
> :visible (not (region-active-p))
> :active t]
>
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56198
; Package
emacs
.
(Wed, 29 Jun 2022 09:17:01 GMT)
Full text and
rfc822 format available.
Message #67 received at 56198 <at> debbugs.gnu.org (full text, mbox):
> I frequently split my windows, I usually kill the buffer using the
> menu bar. But this leaves me with the window open with some other
> buffer. Would like to request some facility to delete a window
> (delete-window) using the mouse
> How about having `Close' in context menu?
> I cannot understand this terminology. How does one access the context
> menu?
Recent Emacs comes with an interface `context-menu'.
Customize context-menu to have a menu item that deletes window would
meet your request.
Such a menu is useful in general and I think it is good have it by
default.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56198
; Package
emacs
.
(Wed, 29 Jun 2022 10:38:02 GMT)
Full text and
rfc822 format available.
Message #70 received at 56198 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Jun 29, 2022, 09:16 by homeros.misasa <at> gmail.com:
>> I frequently split my windows, I usually kill the buffer using the
>> menu bar. But this leaves me with the window open with some other
>> buffer. Would like to request some facility to delete a window
>> (delete-window) using the mouse
>>
>> How about having `Close' in context menu?
>>
>> I cannot understand this terminology. How does one access the context
>> menu?
>>
>
> Recent Emacs comes with an interface `context-menu'.
>
I have GNU Emacs 27.2
> Customize context-menu to have a menu item that deletes window would
> meet your request.
>
> Such a menu is useful in general and I think it is good have it by
> default.
>
[Message part 2 (text/html, inline)]
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 27 Jul 2022 11:24:14 GMT)
Full text and
rfc822 format available.
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.