From: "Alfred M. Szmidt" <ams@gnu.org>
To: emacs-devel@gnu.org
Subject: vc-modify-change-comment for "modern" backend fix
Date: Tue, 17 May 2022 03:04:53 -0400 [thread overview]
Message-ID: <E1nqrGH-0007Mj-2O@fencepost.gnu.org> (raw)
I'm trying to add vc-modify-change-comment functionality to vc-fossil,
but running into a small issue in log-view.el, namley the following
mentioned in vc.el:
;; - Second, `log-view-modify-change-comment' doesn't seem to support
;; modern backends at all because `log-view-extract-comment'
;; unconditionally calls `log-view-current-file'. This should be easy to
;; fix.
There are two ways to fix it, one is to just check if
log-view-per-file-logs is set before calling log-view-extract-comment,
or simply make sure that log-view-current-file behaves.
Attached two patches, the first modifies all calleers and
log-view-current-file, the second just log-view-extract-comment. I
think the first one is preferable...
Thoughts?
diff --git a/lisp/vc/log-view.el b/lisp/vc/log-view.el
index 415b1564ed..791ef66c92 100644
--- a/lisp/vc/log-view.el
+++ b/lisp/vc/log-view.el
@@ -282,22 +282,24 @@ log-view-dir-re
(defun log-view-current-file ()
"Return the current file."
- (save-excursion
- (forward-line 1)
- (or (re-search-backward log-view-file-re nil t)
- (re-search-forward log-view-file-re nil t)
- (error "Unable to determine the current file"))
- (let* ((file (match-string 1))
- (cvsdir (and (re-search-backward log-view-dir-re nil t)
- (match-string 1)))
- (pcldir (and (boundp 'cvs-pcl-cvs-dirchange-re)
- (re-search-backward cvs-pcl-cvs-dirchange-re nil t)
- (match-string 1)))
- (dir ""))
- (let ((default-directory ""))
- (when pcldir (setq dir (expand-file-name pcldir dir)))
- (when cvsdir (setq dir (expand-file-name cvsdir dir))))
- (expand-file-name file dir))))
+ (if log-view-per-file-logs
+ (save-excursion
+ (forward-line 1)
+ (or (re-search-backward log-view-file-re nil t)
+ (re-search-forward log-view-file-re nil t)
+ (error "Unable to determine the current file"))
+ (let* ((file (match-string 1))
+ (cvsdir (and (re-search-backward log-view-dir-re nil t)
+ (match-string 1)))
+ (pcldir (and (boundp 'cvs-pcl-cvs-dirchange-re)
+ (re-search-backward cvs-pcl-cvs-dirchange-re nil t)
+ (match-string 1)))
+ (dir ""))
+ (let ((default-directory ""))
+ (when pcldir (setq dir (expand-file-name pcldir dir)))
+ (when cvsdir (setq dir (expand-file-name cvsdir dir))))
+ (expand-file-name file dir)))
+ (car log-view-vc-fileset)))
(defun log-view-current-entry (&optional pos move)
"Return the position and revision tag of the Log View entry at POS.
@@ -512,9 +514,7 @@ log-view-find-revision
(user-error "Multiple files shown in this buffer, cannot use this command here")))
(save-excursion
(goto-char pos)
- (switch-to-buffer (vc-find-revision (if log-view-per-file-logs
- (log-view-current-file)
- (car log-view-vc-fileset))
+ (switch-to-buffer (vc-find-revision (log-view-current-file)
(log-view-current-tag)))))
@@ -541,9 +541,7 @@ log-view-extract-comment
(defun log-view-modify-change-comment ()
"Edit the change comment displayed at point."
(interactive)
- (vc-modify-change-comment (list (if log-view-per-file-logs
- (log-view-current-file)
- (car log-view-vc-fileset)))
+ (vc-modify-change-comment (list (log-view-current-file))
(log-view-current-tag)
(log-view-extract-comment)))
@@ -558,9 +556,7 @@ log-view-annotate-version
(user-error "Multiple files shown in this buffer, cannot use this command here")))
(save-excursion
(goto-char pos)
- (vc-annotate (if log-view-per-file-logs
- (log-view-current-file)
- (car log-view-vc-fileset))
+ (vc-annotate (log-view-current-file)
(log-view-current-tag))))
;;
@@ -620,9 +616,7 @@ log-view-diff-common
;; diff for all the files in the changeset, pass NIL for
;; the file list.
(unless whole-changeset
- (if log-view-per-file-logs
- (list (log-view-current-file))
- log-view-vc-fileset)))
+ (list (log-view-current-file))))
fr to)))
(provide 'log-view)
diff --git a/lisp/vc/log-view.el b/lisp/vc/log-view.el
index 415b1564ed..83557402fc 100644
--- a/lisp/vc/log-view.el
+++ b/lisp/vc/log-view.el
@@ -521,7 +521,10 @@ log-view-find-revision
(defun log-view-extract-comment ()
"Parse comment from around the current point in the log."
(save-excursion
- (let (st en (backend (vc-backend (log-view-current-file))))
+ (let (st en (backend (vc-backend
+ (if log-view-per-file-logs
+ (log-view-current-file)
+ (car log-view-vc-fileset)))))
(log-view-end-of-defun)
(cond ((eq backend 'SVN)
(forward-line -1)))
next reply other threads:[~2022-05-17 7:04 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-17 7:04 Alfred M. Szmidt [this message]
2022-05-17 8:36 ` vc-modify-change-comment for "modern" backend fix Alfred M. Szmidt
2022-05-17 12:02 ` Eli Zaretskii
2022-05-17 18:31 ` Stefan Monnier
2022-05-17 19:10 ` Alfred M. Szmidt
2022-05-17 23:20 ` Dmitry Gutov
2022-05-18 6:34 ` Alfred M. Szmidt
2022-05-18 11:29 ` Eli Zaretskii
2022-05-19 6:11 ` Alfred M. Szmidt
2022-05-19 14:47 ` Stefan Monnier
2022-05-19 0:05 ` Dmitry Gutov
2022-05-19 6:11 ` Alfred M. Szmidt
2022-05-19 9:25 ` Dmitry Gutov
2022-05-19 9:58 ` Alfred M. Szmidt
2022-05-19 10:24 ` Dmitry Gutov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1nqrGH-0007Mj-2O@fencepost.gnu.org \
--to=ams@gnu.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).