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: Sun, 26 Jun 2022 20:56:03 +0530 Message-ID: <878rpjbg50.fsf@gmail.com> References: <878rpmasxd.fsf@gmail.com-N5LgcGT----2> <83k095b161.fsf@gnu.org> <87k0943k5u.fsf@gmail.com> <87letjeafl.fsf@gnus.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="17486"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 56198@debbugs.gnu.org, carlmarcos@tutanota.com, eliz@gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jun 26 17:27:16 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 1o5UAN-0004Ph-7G for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 26 Jun 2022 17:27:15 +0200 Original-Received: from localhost ([::1]:53522 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5UAL-0004sn-RL for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 26 Jun 2022 11:27:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47174) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5UAA-0004sa-6C for bug-gnu-emacs@gnu.org; Sun, 26 Jun 2022 11:27:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54811) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5UA9-00084i-U7 for bug-gnu-emacs@gnu.org; Sun, 26 Jun 2022 11:27:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o5UA9-00058T-QA for bug-gnu-emacs@gnu.org; Sun, 26 Jun 2022 11:27:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Visuwesh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 26 Jun 2022 15:27:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56198 X-GNU-PR-Package: emacs Original-Received: via spool by 56198-submit@debbugs.gnu.org id=B56198.165625719219704 (code B ref 56198); Sun, 26 Jun 2022 15:27:01 +0000 Original-Received: (at 56198) by debbugs.gnu.org; 26 Jun 2022 15:26:32 +0000 Original-Received: from localhost ([127.0.0.1]:48708 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o5U9f-00057i-1i for submit@debbugs.gnu.org; Sun, 26 Jun 2022 11:26:32 -0400 Original-Received: from mail-pf1-f196.google.com ([209.85.210.196]:39709) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o5U9a-00057R-5g for 56198@debbugs.gnu.org; Sun, 26 Jun 2022 11:26:30 -0400 Original-Received: by mail-pf1-f196.google.com with SMTP id p14so6831225pfh.6 for <56198@debbugs.gnu.org>; Sun, 26 Jun 2022 08:26:26 -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=Gq7aJQ6Yo7rzzK+qW8cYcI9H1vqjKkRjLQzmeyXxHlE=; b=IEnTk5HpXtHM8qpgR4XwD1gj8WGMehp94SP7KpCzEYJAIluxhfSrE+dw+DHPsiHyNj KEK7n6ic+fDM33kJVr9LUXSql1yB6Ch24vdFXAKM3AG+O08ZsbxK2l+w+Bk07B9AXGwv bdRDOXqozMjhdEfZ8X1569bi39lJdMasoye39KYvp3VnVMRvI/paX0rFz21I+x2REYh4 JlAPQykEbChxX7nHPjZOdPI3YpajUHf9dL34c6PXkf7JxLendxTwMvrLHv0QsCo40cyF 5xybnJ9Rhevy2XjDvI7quAz1CZbx7MmePBwqs4Sw31U20TR8WUkYfSLSoaQhTS8Vqzc5 w40A== 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=Gq7aJQ6Yo7rzzK+qW8cYcI9H1vqjKkRjLQzmeyXxHlE=; b=ng++5voiwYMn27vPT9+nWHlbXVLY2KmtA+l5BsPttSAX/7jUmOjXvWeyJMLUyeLrws RPUQNg3eAGscBWuTwbDqqGXsJyk9jG5U8qt1iGTSEHEeHryN6lbDxo9vWL3JyrZ0l7rK vr5zbDDnJ7a9Cq5ewb8dNw1M1Ffr8/98nvgR/g3VilYu75TAZ4IXMDc392locIehpF3b OTloVJBXw/Oz6HcmJuyBsZCddvZBcNXtvAm5gUgebiU191AaVfI/UHx+55rEsl1fmNIM k90IiDwihbh5i6Y2f+blLmIGwe/jPw82a5N9mF6JvsHp/nyjf7hE+PK2iJK4qIMypPB4 Ea5g== X-Gm-Message-State: AJIora/kGJSzW7J7F+LzyMWoUfyrIpwqXKYz73JYUmcUeilGtnEhAmPm yTX3VFeDu3OefMnK+lNMeCk= X-Google-Smtp-Source: AGRyM1vF7Kbzi0KWyD4VLfrB223pGhVo5V8xd4M/jnGqXLeMj4w/oE/aSfH/4dlEMKZO4RktkI5ZNA== X-Received: by 2002:a63:5424:0:b0:405:230e:3d9f with SMTP id i36-20020a635424000000b00405230e3d9fmr8758379pgb.271.1656257180236; Sun, 26 Jun 2022 08:26:20 -0700 (PDT) Original-Received: from localhost ([49.204.136.42]) by smtp.gmail.com with ESMTPSA id t10-20020a170902dcca00b0015e8da1f9e8sm5294068pll.77.2022.06.26.08.26.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Jun 2022 08:26:19 -0700 (PDT) In-Reply-To: <87letjeafl.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sun, 26 Jun 2022 17:01:02 +0200") 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:235356 Archived-At: [=E0=AE=9E=E0=AE=BE=E0=AE=AF=E0=AE=BF=E0=AE=B1=E0=AF=81 =E0=AE=9C=E0=AF=82= =E0=AE=A9=E0=AF=8D 26, 2022] Lars Ingebrigtsen wrote: > Visuwesh 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., 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)))))) =20 (defun mouse-select-window (click) "Select the window clicked on; don't move point."