From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Visuwesh Newsgroups: gmane.emacs.bugs Subject: bug#56198: Request to delete window with mouse event Date: Sat, 25 Jun 2022 19:44:05 +0530 Message-ID: <87k0943k5u.fsf@gmail.com> References: <878rpmasxd.fsf@gmail.com-N5LgcGT----2> <83k095b161.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33790"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: eliz@gnu.org, carlmarcos@tutanota.com To: 56198@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jun 25 16:17:21 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o56bB-0008er-Kq for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 Jun 2022 16:17:21 +0200 Original-Received: from localhost ([::1]:48180 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o56bA-00016K-4m for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 Jun 2022 10:17:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44450) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o56Zu-0000DR-3L for bug-gnu-emacs@gnu.org; Sat, 25 Jun 2022 10:16:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52060) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o56Zt-00076L-RE for bug-gnu-emacs@gnu.org; Sat, 25 Jun 2022 10:16:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o56Zt-0003w0-M3 for bug-gnu-emacs@gnu.org; Sat, 25 Jun 2022 10:16:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Visuwesh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 25 Jun 2022 14:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56198 X-GNU-PR-Package: emacs X-Debbugs-Original-To: carlmarcos--- via "Bug reports for GNU Emacs, the Swiss army knife of text editors" X-Debbugs-Original-Cc: Eli Zaretskii , carlmarcos@tutanota.com, 56198@debbugs.gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.165616654615095 (code B ref -1); Sat, 25 Jun 2022 14:16:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 25 Jun 2022 14:15:46 +0000 Original-Received: from localhost ([127.0.0.1]:45957 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o56Zc-0003vO-BX for submit@debbugs.gnu.org; Sat, 25 Jun 2022 10:15:46 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:54404) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o56ZM-0003ux-B3 for submit@debbugs.gnu.org; Sat, 25 Jun 2022 10:15:43 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44374) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o56ZM-0008Rq-1y for bug-gnu-emacs@gnu.org; Sat, 25 Jun 2022 10:15:28 -0400 Original-Received: from mail-pj1-x1042.google.com ([2607:f8b0:4864:20::1042]:45050) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o56ZK-0006qG-A9; Sat, 25 Jun 2022 10:15:27 -0400 Original-Received: by mail-pj1-x1042.google.com with SMTP id n16-20020a17090ade9000b001ed15b37424so5362572pjv.3; Sat, 25 Jun 2022 07:15:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=D4GDonT0uo3t73jVS9DXrvDp8BxTyT0b4UPsIQkC55k=; b=DsVdue0gwvQog8wTKq/DPcp1JhKyjEAAoDebe7B6HuB5yfLxBKSug9OmEwpceP+IbM 4idySZYrFyFteGGYAXBV8B+R70/dYrsesRum0VQOs/O2V3IFWTEBDSTgcXTB1aAu0l2s pRfBzJVsKX34Ug4dgDmrMzShbGEuZl9SQi/Rqf5fQy+bavyRad81E/fgLHg7tnbvZ5a5 46wvhoTUSd8G+faZfDAuaCm5JxTsQobBCkglAY1i3vBKlqPHRaA2Fc+qVmT+ppuxvtq+ 9OFAnMzT+jg1RI1LaPW073SDgmvMzv9OFCuuiZjErXn518jM+z/tDSbcR15EMsNSN/wK ktfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=D4GDonT0uo3t73jVS9DXrvDp8BxTyT0b4UPsIQkC55k=; b=uIxqV+G1dog4PIqo7Kfjz5FpqGc+l2i8yQGVLFBfVjDChS+jkxspFX0zBP3JqAGSQy gc0R3WPiXbGouEWXSMPJh0FlBM6UTtFkAsu5oq8+e6Ed5ZyeJNt0ipxUr1cF2vDj5ahO XxwVtJznAAmOTfws0J1qwwz0llA6XWPWCKTVwm1U2u6SWwNW3xL4hwkrxDWVRONZO/22 gAdm26Tl0mPZcZDVZ2AmWym+ffec3l3SIFHHk0dF1bftsTVL/gl0ZPXQdxpt5xTHKap9 yRW/1ZVa6sUA0rntyvEpTpq7xu5n1WWWe0Q/TnVMqhH5YTdo1S9C0mzCA7jHI+XY515z 2p3w== X-Gm-Message-State: AJIora+wQocEtQokFGK9dwq+FVYMWpywWZnLDZeiFcv08Vj3fNS5NRlo k6CCueir7ZiPfMdH9gnJdbeXwsO+pdw= X-Google-Smtp-Source: AGRyM1svgxWFl6iyfY8HOS/8q2qRxdMJNAiuyZWfRRBLbsXR96PRWifQC1rabB7Cj6u9qLsC/fD1Dw== X-Received: by 2002:a17:902:d5c3:b0:168:f037:98d7 with SMTP id g3-20020a170902d5c300b00168f03798d7mr4615390plh.117.1656166499763; Sat, 25 Jun 2022 07:14:59 -0700 (PDT) Original-Received: from localhost ([49.204.119.36]) by smtp.gmail.com with ESMTPSA id n1-20020a170902dc8100b00163c6ac211fsm3782552pld.111.2022.06.25.07.14.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Jun 2022 07:14:31 -0700 (PDT) In-Reply-To: (carlmarcos's message of "Sat, 25 Jun 2022 14:34:47 +0200 (CEST)") Received-SPF: pass client-ip=2607:f8b0:4864:20::1042; envelope-from=visuweshm@gmail.com; helo=mail-pj1-x1042.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:235270 Archived-At: [=E0=AE=9A=E0=AE=A9=E0=AE=BF =E0=AE=9C=E0=AF=82=E0=AE=A9=E0=AF=8D 25, 2022]= carlmarcos--- via "Bug reports for GNU Emacs, the Swiss army knife of text= editors" wrote: > Jun 25, 2022, 08:24 by eliz@gnu.org: > >>> Cc: 56198@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" >>> >>> Actually, I have noticed a problem with using mouse-3 on mode-line. Su= ppose >>> you push mouse-3 on mode-line, the window is removed without giving me = the=20 >>> 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 occur= s on the mode-line > or window.=C2=A0 If one moves the mouse pointer outside the window or out= side emacs, then releasing > the pressed mouse-3 button, would have no effect.=C2=A0 This would be con= sistent with how menus work.=20 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)))))) =20 (defun mouse-select-window (click) "Select the window clicked on; don't move point." The same should done for mouse-2 as well.