[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/agitate cf0e85c0a3: Add PROTOTYPE agitate-log-edit-info
From: |
ELPA Syncer |
Subject: |
[elpa] externals/agitate cf0e85c0a3: Add PROTOTYPE agitate-log-edit-informative-mode |
Date: |
Sat, 1 Oct 2022 07:57:15 -0400 (EDT) |
branch: externals/agitate
commit cf0e85c0a32c5ba05c283af0b6e9c5b62e493dd2
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Add PROTOTYPE agitate-log-edit-informative-mode
---
README.org | 18 ++++++++++++++++++
agitate.el | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 71 insertions(+)
diff --git a/README.org b/README.org
index 45464b1bc6..85bf155601 100644
--- a/README.org
+++ b/README.org
@@ -128,6 +128,24 @@ The emoji commits are inspired by <https://gitmoji.dev/>,
though I
think most of those are superfluous. Less is more. The "conventional
commits" are documented here: <https://www.conventionalcommits.org/en/v1.0.0/>.
+*** Informative log-edit window configuration mode
+:PROPERTIES:
+:CUSTOM_ID: h:7f50cff1-4abd-4155-a57b-07f283db7630
+:END:
+
+#+findex: agitate-log-edit-informative-mode
+#+vindex: agitate-log-edit-informative-mode
+The ~agitate-log-edit-informative-mode~ is the PROTOTYPE of a global
+minor mode that rearranges the window configuration (layout) while
+bringing up a log-edit buffer (such as what happens when =C-x v v=
+(~vc-next-action~) is about to commit the changes). It shows the
+log-edit buffer on the left and the corresponding diff on the right.
+
+#+vindex: agitate-log-edit-informative-show-files
+When the user option ~agitate-log-edit-informative-show-files~ is
+non-nil (the default), the list of files pertinent to the current
+action is shown below the log-edit buffer.
+
** Extras for log-view
:PROPERTIES:
:CUSTOM_ID: h:2a48ff74-6a8f-4fc6-9e14-c9e412857b2d
diff --git a/agitate.el b/agitate.el
index 3b9a03cf45..e0de89d623 100644
--- a/agitate.el
+++ b/agitate.el
@@ -223,6 +223,59 @@ Prompt for entry among those declared in
'agitate--log-edit-conventional-commits-history)
": ")))
+;;;;; log-edit "informative" window configuration mode
+
+;; TODO 2022-10-01: defcustom to show vc-print-root-log? Display it
+;; below log edit buf?
+
+(defcustom agitate-log-edit-informative-show-files t
+ "Show applicable files with `agitate-log-edit-informative-mode'."
+ :type 'boolean
+ :group 'agitate)
+
+(defvar agitate--previous-window-configuration nil
+ "Store the last window configuration.")
+
+;; FIXME 2022-10-01: What happens if the user changes the window
+;; layout after they entre this view but before finalising the
+;; log-edit? That would restore the last window configuration, but is
+;; that the right thing? Should we dedicate buffers to their windows
+;; and make it unbreakable? Feels too much... I think keeping it
+;; simple is better.
+;;;###autoload
+(define-minor-mode agitate-log-edit-informative-mode
+ "PROTOTYPE Apply a specific window configuation when entering log-view mode.
+Restore the last window configuration when finalising log-view."
+ :init-value nil
+ :global t
+ (if agitate-log-edit-informative-mode
+ (progn
+ (add-hook 'log-edit-hook #'agitate--log-edit-informative-setup)
+ (add-hook 'log-edit-mode-hook
#'agitate--log-edit-informative-handle-kill-buffer))
+ (remove-hook 'log-edit-hook #'agitate--log-edit-informative-setup)
+ (remove-hook 'log-edit-mode-hook
#'agitate--log-edit-informative-handle-kill-buffer)))
+
+(defun agitate--log-edit-informative-setup ()
+ "Set up informative `log-edit' window configuration."
+ (setq agitate--previous-window-configuration (current-window-configuration))
+ (delete-other-windows)
+ (log-edit-show-diff)
+ (other-window -1)
+ (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)
+ (if agitate-log-edit-informative-show-files
+ (log-edit-show-files)
+ (log-edit-hide-buf log-edit-files-buf)))
+
+(defun agitate--log-edit-informative-restore ()
+ "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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/agitate cf0e85c0a3: Add PROTOTYPE agitate-log-edit-informative-mode,
ELPA Syncer <=