]> git.eshelyaron.com Git - emacs.git/commitdiff
Reset 'gnus-current-window-configuration' on edit-form exit.
authorAndrew G Cohen <cohen@andy.bu.edu>
Thu, 9 Mar 2023 08:05:31 +0000 (16:05 +0800)
committerAndrew G Cohen <cohen@andy.bu.edu>
Sat, 1 Apr 2023 01:54:51 +0000 (09:54 +0800)
* lisp/gnus/gnus.el: New variable gnus-prev-cwc.
* lisp/gnus/gnus-art.el (gnus-article-edit-mode):
New local variable gnus-prev-cwc.
(gnus-article-edit-article):  Store original
gnus-current-window-configuration as gnus-prev-cwc.
(gnus-article-edit-done, gnus-article-edit-exit): Restore
gnus-current-window-configuration from gnus-prev-cwc.
* lisp/gnus/gnus-eform.el (gnus-edit-form-mode):
New local variable gnus-prev-cwc.
(gnus-edit-form):  Store original
gnus-current-window-configuration as gnus-prev-cwc.
(gnus-edit-form-done, gnus-edit-form-exit): Restore
gnus-current-window-configuration from gnus-prev-cwc.

lisp/gnus/gnus-art.el
lisp/gnus/gnus-eform.el
lisp/gnus/gnus.el

index ce7a4488a7fb00c13ad62b4d477bae869711b60a..6a7a3f417462facbbeea76d65fa1cf76485bace3 100644 (file)
@@ -7390,6 +7390,7 @@ This is an extended text-mode.
 \\{gnus-article-edit-mode-map}"
   (make-local-variable 'gnus-article-edit-done-function)
   (make-local-variable 'gnus-prev-winconf)
+  (make-local-variable 'gnus-prev-cwc)
   (setq-local font-lock-defaults '(message-font-lock-keywords t))
   (setq-local mail-header-separator "")
   (setq-local gnus-article-edit-mode t)
@@ -7420,7 +7421,8 @@ groups."
 
 (defun gnus-article-edit-article (start-func exit-func &optional quiet)
   "Start editing the contents of the current article buffer."
-  (let ((winconf (current-window-configuration)))
+  (let ((winconf (current-window-configuration))
+        (cwc gnus-current-window-configuration))
     (set-buffer gnus-article-buffer)
     (let ((message-auto-save-directory
           ;; Don't associate the article buffer with a draft file.
@@ -7431,6 +7433,7 @@ groups."
     (gnus-configure-windows 'edit-article)
     (setq gnus-article-edit-done-function exit-func)
     (setq gnus-prev-winconf winconf)
+    (setq gnus-prev-cwc cwc)
     (unless quiet
       (gnus-message 6 "C-c C-c to end edits"))))
 
@@ -7440,7 +7443,8 @@ groups."
   (let ((func gnus-article-edit-done-function)
        (buf (current-buffer))
        (start (window-start))
-       (winconf gnus-prev-winconf))
+       (winconf gnus-prev-winconf)
+        (cwc gnus-prev-cwc))
     (widen) ;; Widen it in case that users narrowed the buffer.
     (funcall func arg)
     (set-buffer buf)
@@ -7458,6 +7462,7 @@ groups."
     (set-text-properties (point-min) (point-max) nil)
     (gnus-article-mode)
     (set-window-configuration winconf)
+    (setq gnus-current-window-configuration cwc)
     (set-buffer buf)
     (set-window-start (get-buffer-window buf) start)
     (set-window-point (get-buffer-window buf) (point)))
@@ -7479,10 +7484,12 @@ groups."
       (erase-buffer)
       (if (gnus-buffer-live-p gnus-original-article-buffer)
          (insert-buffer-substring gnus-original-article-buffer))
-      (let ((winconf gnus-prev-winconf))
+      (let ((winconf gnus-prev-winconf)
+            (cwc gnus-prev-cwc))
        (kill-all-local-variables)
        (gnus-article-mode)
        (set-window-configuration winconf)
+        (setq gnus-current-window-configuration cwc)
        ;; Tippy-toe some to make sure that point remains where it was.
        (with-current-buffer curbuf
          (set-window-start (get-buffer-window (current-buffer)) window-start)
index 958d819048f3696d911694f207b35afb6e1149a4..cc5beb16a34376d3db057065a82ee34a345ae085 100644 (file)
@@ -70,17 +70,20 @@ It is a slightly enhanced `lisp-data-mode'.
   (when (gnus-visual-p 'group-menu 'menu)
     (gnus-edit-form-make-menu-bar))
   (make-local-variable 'gnus-edit-form-done-function)
-  (make-local-variable 'gnus-prev-winconf))
+  (make-local-variable 'gnus-prev-winconf)
+  (make-local-variable 'gnus-prev-cwc))
 
 (defun gnus-edit-form (form documentation exit-func &optional layout)
   "Edit FORM in a new buffer.
 Call EXIT-FUNC on exit.  Display DOCUMENTATION in the beginning
 of the buffer.
 The optional LAYOUT overrides the `edit-form' window layout."
-  (let ((winconf (current-window-configuration)))
+  (let ((winconf (current-window-configuration))
+        (cwc gnus-current-window-configuration))
     (set-buffer (gnus-get-buffer-create gnus-edit-form-buffer))
     (gnus-configure-windows (or layout 'edit-form))
     (gnus-edit-form-mode)
+    (setq gnus-prev-cwc cwc)
     (setq gnus-prev-winconf winconf)
     (setq gnus-edit-form-done-function exit-func)
     (erase-buffer)
@@ -113,9 +116,11 @@ The optional LAYOUT overrides the `edit-form' window layout."
 (defun gnus-edit-form-exit ()
   "Kill the current buffer."
   (interactive nil gnus-edit-form-mode)
-  (let ((winconf gnus-prev-winconf))
+  (let ((winconf gnus-prev-winconf)
+        (cwc gnus-prev-cwc))
     (kill-buffer (current-buffer))
-    (set-window-configuration winconf)))
+    (set-window-configuration winconf)
+    (setq gnus-current-window-configuration cwc)))
 
 (provide 'gnus-eform)
 
index efab58437e9e3878baa862053c626e3bb6bfb2a1..fc8518512eeaf4d8d952f4ec9ca52a8181c72343 100644 (file)
@@ -2445,6 +2445,7 @@ are always t.")
 
 ;; Save window configuration.
 (defvar gnus-prev-winconf nil)
+(defvar gnus-prev-cwc nil)
 
 (defvar gnus-reffed-article-number nil)