From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: pillule Newsgroups: gmane.emacs.bugs Subject: bug#48916: 28.0.50; allow windmove to select windows with the 'no-other-window parameter Date: Wed, 09 Jun 2021 19:37:15 +0200 Message-ID: <87mtryj28g.fsf@riseup.net> References: <878s3kzm66.fsf@riseup.net> <83czswfunl.fsf@gnu.org> <87zgw0xxya.fsf@riseup.net> <83y2bke98n.fsf@gnu.org> <878s3k76pe.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36324"; mail-complaints-to="usenet@ciao.gmane.io" Cc: pillule , 48916@debbugs.gnu.org, Juri Linkov To: Robert Pluim Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jun 09 21:00:41 2021 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 1lr3RQ-0009E8-AM for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 09 Jun 2021 21:00:40 +0200 Original-Received: from localhost ([::1]:52012 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lr3RP-0008Ls-8i for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 09 Jun 2021 15:00:39 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36532) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lr3Os-0005tP-EH for bug-gnu-emacs@gnu.org; Wed, 09 Jun 2021 14:58:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51385) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lr3Os-0000qm-68 for bug-gnu-emacs@gnu.org; Wed, 09 Jun 2021 14:58:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lr3Os-0005iU-61 for bug-gnu-emacs@gnu.org; Wed, 09 Jun 2021 14:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: pillule Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 09 Jun 2021 18:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48916 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 48916-submit@debbugs.gnu.org id=B48916.162326503021900 (code B ref 48916); Wed, 09 Jun 2021 18:58:02 +0000 Original-Received: (at 48916) by debbugs.gnu.org; 9 Jun 2021 18:57:10 +0000 Original-Received: from localhost ([127.0.0.1]:34698 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lr3O2-0005h7-4D for submit@debbugs.gnu.org; Wed, 09 Jun 2021 14:57:10 -0400 Original-Received: from mx1.riseup.net ([198.252.153.129]:56068) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lr3Nz-0005gu-PR for 48916@debbugs.gnu.org; Wed, 09 Jun 2021 14:57:08 -0400 Original-Received: from fews1.riseup.net (fews1-pn.riseup.net [10.0.1.83]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "*.riseup.net", Issuer "Sectigo RSA Domain Validation Secure Server CA" (not verified)) by mx1.riseup.net (Postfix) with ESMTPS id 4G0bv21RnlzDqlB; Wed, 9 Jun 2021 11:57:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1623265022; bh=Xhv4OSQr5xKoFLgW0ijYntB4iyFzEFpm47uTAwaE8yg=; h=References:From:To:Cc:Subject:Date:In-reply-to:From; b=l0OFlT/yyo8IRXpeW69Pl8o693frshYzA/p88r/Sa0e1ClAORpBpHITeu//0bzG5O ySd/sPHh505akmB3SqR6phStrWoF99+AbnTQ8M7pUQZkV46rE/qMZVuyk//WnZ9d51 lEhIRotWuqX1Q/JjKmaK2MG5tlwmFwlAwZ/lW/J8= X-Riseup-User-ID: 76A7FD06DFC53444448192DA7C301690626237C320C0344DB1FED25384A13CEF Original-Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews1.riseup.net (Postfix) with ESMTPSA id 4G0bty4WMgz5vSN; Wed, 9 Jun 2021 11:56:58 -0700 (PDT) In-reply-to: <878s3k76pe.fsf@gmail.com> 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:208303 Archived-At: --=-=-= Content-Type: text/plain; format=flowed Robert Pluim writes: > >> Maybe Magit have a something that I am not aware for this > >> purpose > >> ? > > Eli> AFAIK, Magit does have such a command, but don't ask me > what it is... > > 'magit-generate-changelog', which you can run from your Magit > commit > buffer. It's pretty much the same as C-x 4 A > (diff-add-change-log-entries-other-window), which you'd run from > a > *vc-diff* buffer. The main difference is that C-x 4 A and C-x 4 > a will > put entries into a ChangeLog file or buffer. Thanks you for the guidance, I think I would have had difficulties to find it myself because it seems dependant of the context (at least the magit one) and I couldn't find them directly with eg 'helpfull-function'. However it don't seems to always works and another annoyance but it is another topic. Very much appreciated. Juri Linkov writes: >>>> +(defcustom windmove-ignore-no-other-window nil >>> >>> This name is not the best one. For starters, "ignore-no" is a >>> kind of >>> double negation, which makes it harder to understand and >>> remember. >>> Can you come up with a better description of what exactly is >>> ignored >>> here? > >> Yes, i think 'windmove-move-in-all-windows' will be more >> explicit. > > Repeating words "...move-move..." doesn't look nice. Maybe a > better name > would be 'windmove-allow-all-windows'. That is better, indeed, thank you. >> Because it applies to `windmove-find-other-window', it allows >> the commands >> windmove-right, windmove-left, windmove-down, windmove-up to >> select windows >> with the no-other-window parameter, but not for the >> `windmove-display-*' >> functions. I suppose it is the desired behavior. > > You could try using new option in all functions that call > window-in-direction: > in windmove-display-in-direction, in > windmove-delete-in-direction, > in windmove-swap-states-in-direction. Done. I am in terra incognita for theses commands, The opportunity to add new keybindings in my configuration is always nice :p It was really simple and my tests seems to works fine with 'windmove-allow-all-windows' for all functions. See the patch attached. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0005-User-option-to-select-no-other-window-with-windmove.patch Content-Description: windmove-allow-all-windows >From f1e8eb238305b4c956fe3dc02edfa96bdbcb67c6 Mon Sep 17 00:00:00 2001 From: Trust me I am a doctor Date: Tue, 8 Jun 2021 11:51:55 +0200 Subject: [PATCH] User option to select 'no-other-window with windmove * lisp/windmove.el (windmove-wrap-around): Remove superfluous :group tag. (windmove-create-window): Remove superfluous :group tag. (windmove-window-distance-delta): Remove superfluous :group tag. (windmove-allow-all-windows): Add new user option to allow the commands of windmove to target windows with the 'no-other-window parameter. (windmove-find-other-window): Use windmove-allow-all-windows. (windmove-display-no-select): Remove superfluous :group tag. (windmove-display-in-direction): Use windmove-allow-all-windows. (windmove-delete-in-direction): Use windmove-allow-all-windows. (windmove-swap-states-in-direction): Use windmove-allow-all-windows. (windmove-default-keybindings): Remove superfluous :group tag. (windmove-display-default-keybindings): Remove superfluous :group tag. (windmove-delete-default-keybindings): Remove superfluous :group tag. (windmove-swap-states-default-keybindings): Remove superfluous :group tag. --- lisp/windmove.el | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/lisp/windmove.el b/lisp/windmove.el index f558903681..8ba1242519 100644 --- a/lisp/windmove.el +++ b/lisp/windmove.el @@ -138,8 +138,7 @@ windmove-wrap-around a frame will find the rightmost one, and similarly for the other directions. The minibuffer is skipped over in up/down movements if it is inactive." - :type 'boolean - :group 'windmove) + :type 'boolean) (defcustom windmove-create-window nil "Whether movement off the edge of the frame creates a new window. @@ -147,7 +146,6 @@ windmove-create-window a frame will create a new window on the left, and similarly for the other directions." :type 'boolean - :group 'windmove :version "27.1") ;; If your Emacs sometimes places an empty column between two adjacent @@ -157,11 +155,18 @@ windmove-window-distance-delta Measured in characters either horizontally or vertically; setting this to a value larger than 1 may be useful in getting around window- placement bugs in old versions of Emacs." - :type 'number - :group 'windmove) + :type 'number) (make-obsolete-variable 'windmove-window-distance-delta "no longer used." "27.1") +(defcustom windmove-allow-all-windows nil + "Whether the windmove commands are allowed to target all type of windows. +If this variable is set to non-nil, `windmove-find-other-window--side' and +subsequently all interactive windmove commands will ignore the +no-other-window parameter applied with `display-buffer-alist'." + :type 'boolean + :version "28.0.50") + ;; Note: ;; @@ -342,7 +347,8 @@ windmove-find-other-window Optional ARG, if negative, means to use the right or bottom edge of WINDOW as reference position, instead of `window-point'; if positive, use the left or top edge of WINDOW as reference point." - (window-in-direction dir window nil arg windmove-wrap-around t)) + (window-in-direction dir window windmove-allow-all-windows + arg windmove-wrap-around t)) ;; Selects the window that's hopefully at the location returned by ;; `windmove-find-other-window', or screams if there's no window there. @@ -480,7 +486,6 @@ windmove-default-keybindings (defcustom windmove-display-no-select nil "Whether the window should be selected after displaying the buffer in it." :type 'boolean - :group 'windmove :version "27.1") (defun windmove-display-in-direction (dir &optional arg) @@ -517,7 +522,7 @@ windmove-display-in-direction ((eq dir 'same-window) (selected-window)) (t (window-in-direction - dir nil nil + dir nil windmove-allow-all-windows (and arg (prefix-numeric-value arg)) windmove-wrap-around 'nomini))))) (unless window @@ -606,8 +611,8 @@ windmove-delete-in-direction select the window at direction DIR. When `windmove-wrap-around' is non-nil, takes the window from the opposite side of the frame." - (let ((other-window (window-in-direction dir nil nil arg - windmove-wrap-around 'nomini))) + (let ((other-window (window-in-direction dir nil windmove-allow-all-windows + arg windmove-wrap-around 'nomini))) (cond ((null other-window) (user-error "No window %s from selected window" dir)) (t @@ -680,8 +685,8 @@ windmove-swap-states-in-direction "Swap the states of the selected window and the window at direction DIR. When `windmove-wrap-around' is non-nil, takes the window from the opposite side of the frame." - (let ((other-window (window-in-direction dir nil nil nil - windmove-wrap-around 'nomini))) + (let ((other-window (window-in-direction dir nil windmove-allow-all-windows + nil windmove-wrap-around 'nomini))) (cond ((or (null other-window) (window-minibuffer-p other-window)) (user-error "No window %s from selected window" dir)) (t @@ -761,8 +766,7 @@ windmove-default-keybindings (null val)) (set-default sym val)) :type windmove--default-keybindings-type - :version "28.1" - :group 'windmove) + :version "28.1") (defcustom windmove-display-default-keybindings nil "Default keybindings for windmove directional buffer display commands. @@ -780,8 +784,7 @@ windmove-display-default-keybindings (null val)) (set-default sym val)) :type windmove--default-keybindings-type - :version "28.1" - :group 'windmove) + :version "28.1") (defcustom windmove-delete-default-keybindings nil "Default keybindings for windmove directional window deletion commands. @@ -796,8 +799,7 @@ windmove-delete-default-keybindings (null val)) (set-default sym val)) :type windmove--default-keybindings-type - :version "28.1" - :group 'windmove) + :version "28.1") (defcustom windmove-swap-states-default-keybindings nil "Default keybindings for windmove's directional window swap-state commands. @@ -812,8 +814,7 @@ windmove-swap-states-default-keybindings (null val)) (set-default sym val)) :type windmove--default-keybindings-type - :version "28.1" - :group 'windmove) + :version "28.1") (provide 'windmove) -- 2.20.1 --=-=-= Content-Type: text/plain; format=flowed As a side note, while reading these commands, I think 'windmove-display-same-window', 'windmove-display-new-frame', 'windmove-display-new-tab' are not really at they own place in windmove. We have already "C-x 4 1" (same-window-prefix) and "C-x 5 5" (other-frame-prefix) and (other-tab-prefix) --that is not bound to any key on my system but would eventually have its place in the "C-x t" map. Should we --for these windmove-commands : 1. keep them as they are 2. make aliases and clean-up 'windmove-display-in-direction' 3. delete them and clean-up 'windmove-display-in-direction' ? Since it becomes to get off the topic with the removal of the :group tag, I can start another patch "clean-up" if requested. --=-=-=--