unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Philip Kaludercic <philipk@posteo.net>
To: Spencer Baugh <sbaugh@janestreet.com>
Cc: 64619@debbugs.gnu.org
Subject: bug#64619: [PATCH] Add toggle-window-dedicated command
Date: Fri, 14 Jul 2023 19:42:47 +0000	[thread overview]
Message-ID: <87jzv2p9e0.fsf@posteo.net> (raw)
In-Reply-To: <ier7cr2iju4.fsf@janestreet.com> (Spencer Baugh's message of "Fri, 14 Jul 2023 11:38:59 -0400")

Spencer Baugh <sbaugh@janestreet.com> writes:

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

I think this sounds interesting, I think there is a lot that can be
improved when it comes to window management.

> * 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'
>
>>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."

Shouldn't "interactive" be documented as well?  

> +  (interactive "i\np")

How about

  (interactive (list (window-normalize-window window) t))

> +  (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





  reply	other threads:[~2023-07-14 19:42 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-14 15:38 bug#64619: [PATCH] Add toggle-window-dedicated command Spencer Baugh
2023-07-14 19:42 ` Philip Kaludercic [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87jzv2p9e0.fsf@posteo.net \
    --to=philipk@posteo.net \
    --cc=64619@debbugs.gnu.org \
    --cc=sbaugh@janestreet.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).