bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#39181: 27.0.50; [PATCH] Allow users to store & restore gdb-mi layout


From: Štěpán Němec
Subject: bug#39181: 27.0.50; [PATCH] Allow users to store & restore gdb-mi layout
Date: Sat, 07 Mar 2020 20:07:37 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

On Sat, 7 Mar 2020 13:09:53 -0500
Yuan Fu wrote:

[...]

> diff --git a/lisp/window.el b/lisp/window.el
> index bd825c09e1..229400966a 100644
> --- a/lisp/window.el
> +++ b/lisp/window.el
> @@ -278,6 +278,19 @@ with-displayed-buffer-window
>            (funcall ,vquit-function ,window ,value)
>          ,value)))))
>  
> +(defmacro with-selected-window-undedicated (&rest body)
> +  "Run BODY in the selected window temporarily undedicated."
> +  (let ((window-dedicated-sym (gensym)))
> +    `(let ((,window-dedicated-sym (window-dedicated-p)))
> +       (when ,window-dedicated-sym
> +         (set-window-dedicated-p nil nil))
> +       ,@body
> +       (when ,window-dedicated-sym
> +         ;; `window-dedicated-p' returns the value set by
> +         ;; `set-window-dedicated-p', which differentiates
> +         ;; non-nil and t, so we cannot simply set to t.
> +         (set-window-dedicated-p nil ,window-dedicated-sym)))))
> +
>  ;; The following two functions are like `window-next-sibling' and
>  ;; `window-prev-sibling' but the WINDOW argument is _not_ optional (so
>  ;; they don't substitute the selected window for nil), and they return

I'm sorry, I only skimmed through your patch, but shouldn't this use
'unwind-protect'? Otherwise the "temporarily" won't hold in case of
abnormal exit from BODY, unless I'm missing something.

-- 
Štěpán





reply via email to

[Prev in Thread] Current Thread [Next in Thread]