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

Previous Next

Package: emacs;

Reported by: Yuan Fu <casouri <at> gmail.com>

Date: Sat, 18 Jan 2020 20:58:02 UTC

Severity: normal

Tags: patch

Found in version 27.0.50

Done: Yuan Fu <casouri <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #53 received at 39181 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Štěpán Němec <stepnem <at> gmail.com>
Cc: martin rudalics <rudalics <at> gmx.at>, 39181 <at> debbugs.gnu.org
Subject: Re: bug#39181: 27.0.50; [PATCH] Allow users to store & restore gdb-mi
 layout
Date: Sat, 7 Mar 2020 14:17:14 -0500
[Message part 1 (text/plain, inline)]

> On Mar 7, 2020, at 2:07 PM, Štěpán Němec <stepnem <at> gmail.com> wrote:
> 
> 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

Thanks for spotting that. I added the unwind-protext form.

Yuan

[new-window.patch (application/octet-stream, attachment)]
[Message part 3 (text/plain, inline)]




This bug report was last modified 5 years and 122 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.