[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/agitate 7308cd6d99: Add way to show root log in "inform
From: |
ELPA Syncer |
Subject: |
[elpa] externals/agitate 7308cd6d99: Add way to show root log in "informative" log-edit |
Date: |
Sat, 1 Oct 2022 09:57:16 -0400 (EDT) |
branch: externals/agitate
commit 7308cd6d996f14d0e0c5d4113d0b797fd3768e74
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Add way to show root log in "informative" log-edit
Revise the 'agitate--log-edit-informative-setup' to use
'save-selected-window' instead of trying to use 'other-window'. That
worked, but probably fails in some scenario
---
README.org | 8 ++++++++
agitate.el | 40 ++++++++++++++++++++++++++++++++++------
2 files changed, 42 insertions(+), 6 deletions(-)
diff --git a/README.org b/README.org
index 85bf155601..8d7439e065 100644
--- a/README.org
+++ b/README.org
@@ -146,6 +146,10 @@ 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.
+#+vindex: agitate-log-edit-informative-show-root-log
+When the user option ~agitate-log-edit-informative-show-root-log~ is
+non-nil, the root log of the revisions is shown.
+
** Extras for log-view
:PROPERTIES:
:CUSTOM_ID: h:2a48ff74-6a8f-4fc6-9e14-c9e412857b2d
@@ -309,6 +313,10 @@ Everything is in place to set up the package.
(advice-add #'vc-git-push :override #'agitate-vc-git-push-prompt-for-remote)
+;; Also check: `agitate-log-edit-informative-show-files',
+;; `agitate-log-edit-informative-show-root-log'.
+(agitate-log-edit-informative-mode 1)
+
(let ((map global-map))
(define-key map (kbd "C-x v =") #'agitate-diff-buffer-or-file) ; replace
`vc-diff'
(define-key map (kbd "C-x v g") #'agitate-vc-git-grep) ; replace
`vc-annotate'
diff --git a/agitate.el b/agitate.el
index e0de89d623..8281c7e53f 100644
--- a/agitate.el
+++ b/agitate.el
@@ -225,14 +225,16 @@ Prompt for entry among those declared in
;;;;; 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)
+(defcustom agitate-log-edit-informative-show-root-log nil
+ "Show root revision log with `agitate-log-edit-informative-mode'."
+ :type 'boolean
+ :group 'agitate)
+
(defvar agitate--previous-window-configuration nil
"Store the last window configuration.")
@@ -255,17 +257,43 @@ Restore the last window configuration when finalising
log-view."
(remove-hook 'log-edit-hook #'agitate--log-edit-informative-setup)
(remove-hook 'log-edit-mode-hook
#'agitate--log-edit-informative-handle-kill-buffer)))
+;; TODO 2022-10-01: Display it below log edit buf? Or be
+;; unopinionated about it? I think placing it below the `log-edit'
+;; buffer looks best, with the `log-edit-show-files' further below it
+;; and the diff to their right.
+
+;; TODO 2022-10-01: Does the CURRENT-FILES make sense? Will it be
+;; helpful or will it cause confusion? If it is useful, the idea is
+;; to add a `defcustom' for it.
+
+;;;###autoload
+(defun agitate-log-edit-show-root-log (&optional current-files)
+ "PROTOTYPE Like `vc-print-root-log' for `log-edit' buffers.
+When optional CURRENT-FILES is non-nil, limit the revision log to
+the `log-edit-files'."
+ (when-let* ((files (log-edit-files))
+ ;; FIXME 2022-10-01: What happens with backends that do
+ ;; not support short logs? Do we need to handle
+ ;; anything here?
+ (vc-log-short-style '(file)))
+ (vc-print-log-internal
+ (vc-responsible-backend default-directory)
+ (when current-files files) nil nil vc-log-show-limit)))
+
(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)
+ (save-selected-window
+ (log-edit-show-diff))
(if agitate-log-edit-informative-show-files
(log-edit-show-files)
- (log-edit-hide-buf log-edit-files-buf)))
+ (log-edit-hide-buf log-edit-files-buf))
+ (when agitate-log-edit-informative-show-root-log
+ (save-selected-window
+ (agitate-log-edit-show-root-log))))
(defun agitate--log-edit-informative-restore ()
"Restore `agitate--previous-window-configuration'."
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/agitate 7308cd6d99: Add way to show root log in "informative" log-edit,
ELPA Syncer <=