unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#64619: [PATCH] Add toggle-window-dedicated command
@ 2023-07-14 15:38 Spencer Baugh
  2023-07-14 19:42 ` Philip Kaludercic
                   ` (2 more replies)
  0 siblings, 3 replies; 43+ messages in thread
From: Spencer Baugh @ 2023-07-14 15:38 UTC (permalink / raw)
  To: 64619

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

Tags: patch


It's sometimes useful to interactively make certain windows dedicated.
This allows a level of interactive control over which window
display-buffer uses.

* lisp/window.el (toggle-window-dedicated): Add.
(window-prefix-map): Add C-x w d binding.


In GNU Emacs 29.0.92 (build 5, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.15.12, Xaw scroll bars) of 2023-07-10 built on
 igm-qws-u22796a
Repository revision: dd15432ffacbeff0291381c0109f5b1245060b1d
Repository branch: emacs-29
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: CentOS Linux 7 (Core)

Configured using:
 'configure --config-cache --with-x-toolkit=lucid
 --with-gif=ifavailable'


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-toggle-window-dedicated-command.patch --]
[-- Type: text/patch, Size: 1814 bytes --]

From 2e8caf7d1f0a402568fac9e8767064a452499d60 Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh@janestreet.com>
Date: Fri, 14 Jul 2023 11:38:24 -0400
Subject: [PATCH] Add toggle-window-dedicated command

It's sometimes useful to interactively make certain windows dedicated.
This allows a level of interactive control over which window
display-buffer uses.

* lisp/window.el (toggle-window-dedicated): Add.
(window-prefix-map): Add C-x w d binding.
---
 lisp/window.el | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/lisp/window.el b/lisp/window.el
index d91bbabc010..f884d9aaf16 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -7463,6 +7463,20 @@ display-buffer-mark-dedicated
 The actual non-nil value of this variable will be copied to the
 `window-dedicated-p' flag.")
 
+(defun toggle-window-dedicated (&optional window interactive)
+  "Toggle whether WINDOW is dedicated.
+
+See `set-window-dedicated-p' for more details.  WINDOW defaults
+to the currently selected window."
+  (interactive "i\np")
+  (setq window (window-normalize-window window))
+  (if (window-dedicated-p window)
+      (progn
+        (set-window-dedicated-p window nil)
+        (when interactive (message "Window can now be used to display other buffers")))
+    (set-window-dedicated-p window 'dedicated)
+    (when interactive (message "Window will now display only its current buffer"))))
+
 (defconst display-buffer--action-function-custom-type
   '(choice :tag "Function"
 	   (const :tag "--" ignore) ; default for insertion
@@ -10746,6 +10760,7 @@ window-prefix-map
   "2" #'split-root-window-below
   "3" #'split-root-window-right
   "s" #'window-toggle-side-windows
+  "d" #'toggle-window-dedicated
   "^ f" #'tear-off-window
   "^ t" #'tab-window-detach
   "-" #'fit-window-to-buffer
-- 
2.39.3


^ permalink raw reply related	[flat|nested] 43+ messages in thread

end of thread, other threads:[~2023-10-25 13:46 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-14 15:38 bug#64619: [PATCH] Add toggle-window-dedicated command Spencer Baugh
2023-07-14 19:42 ` Philip Kaludercic
2023-07-14 21:17   ` Drew Adams
2023-07-14 23:58     ` sbaugh
2023-07-15 21:30       ` Drew Adams
2023-07-18 15:35   ` Spencer Baugh
2023-07-18 17:56     ` Philip Kaludercic
2023-07-15  5:44 ` Eli Zaretskii
2023-07-15  7:53   ` martin rudalics
2023-07-15 17:41     ` sbaugh
2023-07-15 18:16       ` martin rudalics
2023-07-18 15:34 ` Spencer Baugh
2023-08-19 13:34   ` sbaugh
2023-08-19 16:13     ` Philip Kaludercic
2023-08-19 16:20       ` sbaugh
2023-08-19 16:21         ` Philip Kaludercic
2023-08-19 20:02           ` sbaugh
2023-08-20  5:57             ` Eli Zaretskii
2023-08-21 13:00               ` sbaugh
2023-08-21 13:20                 ` Gregory Heytings
2023-08-21 14:02                   ` Eli Zaretskii
2023-08-21 19:22                     ` Eli Zaretskii
2023-08-21 19:20                 ` Eli Zaretskii
2023-10-13  1:33                   ` sbaugh
2023-10-25 13:46                     ` Eli Zaretskii
2023-08-19 16:43     ` Gregory Heytings
2023-08-19 20:06       ` sbaugh
2023-08-19 20:37         ` Gregory Heytings
2023-08-19 21:47           ` sbaugh
2023-08-19 22:36             ` Gregory Heytings
2023-08-20  6:13               ` Eli Zaretskii
2023-08-20  8:02                 ` Gregory Heytings
2023-08-20  8:30                   ` Eli Zaretskii
2023-08-20  8:41                     ` Gregory Heytings
2023-08-20  8:54                       ` Eli Zaretskii
2023-08-20  9:56                         ` Gregory Heytings
2023-08-20 10:11                           ` Eli Zaretskii
2023-08-20 10:25                             ` Gregory Heytings
2023-08-20 14:09                               ` sbaugh
2023-08-20 15:31                                 ` Eli Zaretskii
2023-08-20 21:56                                 ` Gregory Heytings
2023-08-21 11:23                                   ` sbaugh
2023-08-21  8:27           ` Augusto Stoffel

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).