emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/gnorb 927e401 184/449: New function for restoring windo


From: Stefan Monnier
Subject: [elpa] externals/gnorb 927e401 184/449: New function for restoring window layout
Date: Fri, 27 Nov 2020 23:15:35 -0500 (EST)

branch: externals/gnorb
commit 927e40119ede04ebe8c1401c11db528dbdcdccea
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>

    New function for restoring window layout
    
    * lisp/gnorb-utils.el (gnorb-restore-layout): Interactive function for
      restoring window layout.
    
    * lisp/gnorb-gnus.el (gnorb-gnus-incoming-do-todo): Delete other
      windows, so we're left with a clear frame. `gnorb-restore-layout' can
      bring us back.
    
    * README.org: Document.
---
 README.org          |  4 ++++
 lisp/gnorb-gnus.el  |  3 +++
 lisp/gnorb-utils.el | 13 +++++++++++++
 3 files changed, 20 insertions(+)

diff --git a/README.org b/README.org
index cee1d66..1dc0872 100644
--- a/README.org
+++ b/README.org
@@ -168,6 +168,10 @@ you use on mail messages, and you'll be queried to 
re-attach the
 message's attachments onto the newly-captured heading. Or set
 `gnorb-gnus-capture-always-attach' to "t" to have Gnorb do this for
 all capture templates.
+** Restoring window layout
+Many Gnorb functions alter the window layout and value of point. In
+most of these cases, you can restore the previous layout using the
+interactive function `gnorb-restore-layout'.
 ** Gnorb-BBDB
 *** Interactive Functions
 **** gnorb-bbdb-tag-agenda
diff --git a/lisp/gnorb-gnus.el b/lisp/gnorb-gnus.el
index 78e6e4d..ec8aa3a 100644
--- a/lisp/gnorb-gnus.el
+++ b/lisp/gnorb-gnus.el
@@ -541,6 +541,9 @@ to t (it is, by default)."
              (sit-for 1))))
         targ)
     (gnorb-gnus-collect-all-attachments nil t)
+    ;; Delete other windows, users can restore with
+    ;; `gnorb-restore-layout'.
+    (delete-other-windows)
     (if id
        (gnorb-trigger-todo-action arg id)
       (if (and offer-heading
diff --git a/lisp/gnorb-utils.el b/lisp/gnorb-utils.el
index 538bdc3..43c7ba7 100644
--- a/lisp/gnorb-utils.el
+++ b/lisp/gnorb-utils.el
@@ -112,6 +112,19 @@ with `gnorb-window-conf'.")
             (mapconcat
              'identity ign-headers-list "|")))))
 
+(defun gnorb-restore-layout ()
+  "Restore window layout and value of point after a Gnorb command.
+
+Some Gnorb commands change the window layout (ie `gnorb-org-view'
+or incoming email triggering). This command restores the layout
+to what it was. Bind it to a global key, or to local keys in Org
+and Gnus and BBDB maps."
+  (interactive)
+  (when (window-configuration-p gnorb-window-conf)
+    (set-window-configuration gnorb-window-conf)
+    (when (buffer-live-p (marker-buffer gnorb-return-marker))
+      (goto-char gnorb-return-marker))))
+
 (defun gnorb-trigger-todo-action (arg &optional id)
   "Do the actual restore action. Two main things here. First: if
 we were in the agenda when this was called, then keep us in the



reply via email to

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