bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#55039: [PATCH] Use VC-relative file names in ChangeLog entries


From: Philip Kaludercic
Subject: bug#55039: [PATCH] Use VC-relative file names in ChangeLog entries
Date: Tue, 06 Sep 2022 14:34:58 +0000

Philip Kaludercic <philipk@posteo.net> writes:

> Lars Ingebrigtsen <larsi@gnus.org> writes:
>
>> Eli Zaretskii <eliz@gnu.org> writes:
>>
>>> First, I think this must be customizable, because different projects
>>> have different conventions.
>>
>> This was several months ago -- Philip, did you do any further work in
>> this direction?
>
> No I hadn't, but I can take tackle it again as this shouldn't be that
> difficult.

Something like this should be enough, at least functionality wise,
right?

diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index 322d4abd31..1f0eec0d66 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -2336,6 +2336,12 @@ diff-undo
   (let ((inhibit-read-only t))
     (undo arg)))
 
+(defcustom diff-relative-names-in-changelog nil
+  "Use relative file names when generating ChangeLog messages."
+  :type 'boolean
+  :safe #'booleanp
+  :version "29.1")
+
 (defun diff-add-log-current-defuns ()
   "Return an alist of defun names for the current diff.
 The elements of the alist are of the form (FILE . (DEFUN...)),
@@ -2374,9 +2380,11 @@ diff-add-log-current-defuns
           (re-search-forward diff-hunk-header-re nil t)
         (setq hunk-end (save-excursion (diff-end-of-hunk)))
         (pcase-let* ((filename (substring-no-properties
-                                (file-relative-name
-                                   (diff-find-file-name)
-                                   (vc-root-dir))))
+                                (if diff-relative-names-in-changelog
+                                    (file-relative-name
+                                     (diff-find-file-name)
+                                     (vc-root-dir))
+                                  (diff-find-file-name))))
                      (=lines 0)
                      (+lines 0)
                      (-lines 0)
Assuming nobody objects to the name of the option, should this be
documented in NEWS and/or in the Manual?  Also, as the entire point of
the patch was that emacs.git is using relative path names, should a
.dir-locals.el variable be set to ensure this is done?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]