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: martin rudalics
Subject: bug#39181: 27.0.50; [PATCH] Allow users to store & restore gdb-mi layout
Date: Tue, 10 Mar 2020 09:48:52 +0100

> I updated the patch accordingly. Could you have a look at the docsting? I had 
a hard time writing it.

Please don't select WINDOW in 'with-window-undedicated'.  In general,
try to avoid selecting a window unless it is really needed.  This is
particularly important when WINDOW can be on another frame where
selecting WINDOW entails switching to that frame with all its overhead.

I would use something like the untested below.  This could be then
useful for 'ffap-other-frame' or 'ffap-dired-other-frame' as well.

martin


(defmacro with-window-undedicated (window &rest body)
  "Execute BODY with WINDOW temporarily undedicated.
WINDOW must be a live window and defaults to the selected one."
  (declare (indent 1) (debug t))
  (let ((window-dedicated-sym (gensym))
        (window-sym (gensym)))
    `(let* ((,window-sym (window-normalize-window window t))
            (,window-dedicated-sym (window-dedicated-p ,window-sym)))
       (set-window-dedicated-p ,window-sym nil)
       (unwind-protect
           (progn ,@body)
         (set-window-dedicated-p ,window-sym ,window-dedicated-sym)))))





reply via email to

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