[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/agitate ae200ade05 1/8: Fix how windows are saved
From: |
ELPA Syncer |
Subject: |
[elpa] externals/agitate ae200ade05 1/8: Fix how windows are saved |
Date: |
Wed, 19 Oct 2022 09:57:26 -0400 (EDT) |
branch: externals/agitate
commit ae200ade05ded96cc0480006dd7b3c353722fe5e
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Fix how windows are saved
This addresses the underlying problem with the storing and restoring
of the window configuration. It also simplifies the code.
---
agitate.el | 27 ++++++++++++---------------
1 file changed, 12 insertions(+), 15 deletions(-)
diff --git a/agitate.el b/agitate.el
index c4e11fef55..b840fb5b9f 100644
--- a/agitate.el
+++ b/agitate.el
@@ -255,22 +255,24 @@ Restore the last window configuration when finalising
log-view."
:global t
(if agitate-log-edit-informative-mode
(progn
+ (add-hook 'vc-before-checkin-hook
#'agitate--log-edit-informative-save-windows)
(add-hook 'log-edit-hook #'agitate--log-edit-informative-setup)
- (add-hook 'log-edit-mode-hook
#'agitate--log-edit-informative-handle-kill-buffer))
+ (advice-add #'log-edit-done :after
#'agitate--log-edit-informative-restore))
+ (remove-hook 'vc-before-checkin-hook
#'agitate--log-edit-informative-save-windows)
(remove-hook 'log-edit-hook #'agitate--log-edit-informative-setup)
- (remove-hook 'log-edit-mode-hook
#'agitate--log-edit-informative-handle-kill-buffer)))
+ (advice-remove #'log-edit-done #'agitate--log-edit-informative-restore)))
+
+(defun agitate--log-edit-informative-save-windows ()
+ "Save `current-window-configuration'."
+ (setq agitate--previous-window-configuration (current-window-configuration)))
(defun agitate--log-edit-informative-setup ()
"Set up informative `log-edit' window configuration."
- ;; FIXME 2022-10-13: The window configuration needs to be saved at
- ;; an earlier stage. Hooking it to 'vc-before-checkin-hook' or
- ;; `vc-checkin-hook' seems appropriate, though it then breaks the
- ;; C-c C-c in log-edit buffers (the C-c C-k works).
- (setq agitate--previous-window-configuration (current-window-configuration))
(delete-other-windows)
- (add-hook 'log-edit-done-hook #'agitate--log-edit-informative-restore nil t)
- (add-hook 'log-edit-hook #'agitate--log-edit-informative-restore nil t)
- ;; FIXME 2022-10-18: Fails in an empty repo.
+ (add-hook 'kill-buffer-hook #'agitate--log-edit-informative-restore nil t)
+ ;; FIXME 2022-10-18: Fails in an empty repo. It is not nice to use
+ ;; `ignore-errors', as we should not display any window in such a
+ ;; scenario.
(save-selected-window
(log-edit-show-diff))
(if agitate-log-edit-informative-show-files
@@ -289,11 +291,6 @@ Restore the last window configuration when finalising
log-view."
"Restore `agitate--previous-window-configuration'."
(set-window-configuration agitate--previous-window-configuration))
-(defun agitate--log-edit-informative-handle-kill-buffer ()
- "Restore `agitate--previous-window-configuration' if killed."
- (when (derived-mode-p 'log-edit-mode)
- (add-hook 'kill-buffer-hook #'agitate--log-edit-informative-restore 0 t)))
-
;;;; Commands for log-view (listings of commits)
;;;###autoload
- [elpa] externals/agitate updated (39666a34b3 -> ae6efefc56), ELPA Syncer, 2022/10/19
- [elpa] externals/agitate 6d0ed1dfa4 4/8: Add missing full stop, ELPA Syncer, 2022/10/19
- [elpa] externals/agitate 4f9ce39a84 6/8: Reposition private variables, ELPA Syncer, 2022/10/19
- [elpa] externals/agitate ae200ade05 1/8: Fix how windows are saved,
ELPA Syncer <=
- [elpa] externals/agitate d6795e8aff 2/8: Update agitate-log-edit-informative-mode docstring, ELPA Syncer, 2022/10/19
- [elpa] externals/agitate 3df4c0e152 3/8: Tweak agitate-log-edit-informative-mode docs, ELPA Syncer, 2022/10/19
- [elpa] externals/agitate d69588a055 5/8: Restore point after "informative" window reconfiguration, ELPA Syncer, 2022/10/19
- [elpa] externals/agitate ae6efefc56 8/8: Expand FIXME to find VC fn that checks empty repo, ELPA Syncer, 2022/10/19
- [elpa] externals/agitate ff63e3a968 7/8: Explain agitate-log-edit-informative-mode win conf, ELPA Syncer, 2022/10/19