From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#55039: [PATCH] Use VC-relative file names in ChangeLog entries Date: Wed, 07 Sep 2022 15:53:29 +0000 Message-ID: <87h71jnpty.fsf@posteo.net> References: <8735i7zvk4.fsf@posteo.net> <83v8v3sq0n.fsf@gnu.org> <87czc8u56q.fsf@gnus.org> <87fsh4e01q.fsf@posteo.net> <83wnafgvre.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9739"; mail-complaints-to="usenet@ciao.gmane.io" Cc: larsi@gnus.org, 55039@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Sep 07 17:55:21 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oVxOb-0002OA-2p for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 07 Sep 2022 17:55:21 +0200 Original-Received: from localhost ([::1]:53718 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oVxOY-0008JD-9f for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 07 Sep 2022 11:55:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57146) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVxNK-0007h0-GR for bug-gnu-emacs@gnu.org; Wed, 07 Sep 2022 11:54:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38958) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oVxNK-0004Ko-81 for bug-gnu-emacs@gnu.org; Wed, 07 Sep 2022 11:54:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oVxNJ-0003kA-Ow for bug-gnu-emacs@gnu.org; Wed, 07 Sep 2022 11:54:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 07 Sep 2022 15:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55039 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo patch Original-Received: via spool by 55039-submit@debbugs.gnu.org id=B55039.166256601914344 (code B ref 55039); Wed, 07 Sep 2022 15:54:01 +0000 Original-Received: (at 55039) by debbugs.gnu.org; 7 Sep 2022 15:53:39 +0000 Original-Received: from localhost ([127.0.0.1]:55887 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oVxMx-0003jH-1D for submit@debbugs.gnu.org; Wed, 07 Sep 2022 11:53:39 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:48773) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oVxMv-0003j3-4E for 55039@debbugs.gnu.org; Wed, 07 Sep 2022 11:53:37 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id EE024240103 for <55039@debbugs.gnu.org>; Wed, 7 Sep 2022 17:53:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1662566011; bh=TmPGrI4G9etV/1QNg1mzXxX6UtkHKumt63tEoDgrxLY=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=dhstjyWQqX3OGGbIxJ9Ft4SLJwYiSvS/1sYsUofyJxSl0Mi3DyJP6jomhbWc7jYQh tIhzakhVMEJEfsupD6ARx51i3CoXjk+XZSlwqr8gAV6P55MNjsHDciB2QKA1qQ4tM2 nfyXD4o1ZJ1oOs5yD8BpN46dyEty85ZCHXpy4XUf6dtQ6lhnIZg84sU9YtqsS2wLYf zNJz42mDE1c5eC9UOxDFLxc3umKUlo9gzsC8E3A97D+MVIo9mWuN1mWKucXd2bLKvA nxIEuugsKEgfYVC/514YgQd4FOxWJTDVnt+TizIyrPDxp7VfiBEHpe+6Iv13Xbqqf1 nQCgzodHdLq8w== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4MN6HF6Cj0z6tpY; Wed, 7 Sep 2022 17:53:29 +0200 (CEST) In-Reply-To: <83wnafgvre.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 07 Sep 2022 16:27:17 +0300") Autocrypt: addr=philipk@posteo.net; prefer-encrypt=nopreference; keydata= mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:241785 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Philip Kaludercic >> Cc: Eli Zaretskii , 55039@debbugs.gnu.org >> Date: Tue, 06 Sep 2022 20:10:41 +0000 >> >> --- a/doc/emacs/maintaining.texi >> +++ b/doc/emacs/maintaining.texi >> @@ -694,7 +694,10 @@ Log Buffer >> (@code{log-edit-generate-changelog-from-diff}), to generate skeleton >> ChangeLog entries, listing all changed file and function names based >> on the diff of the VC fileset. Consecutive entries left empty will be >> -combined by @kbd{C-q} (@code{fill-paragraph}). >> +combined by @kbd{C-q} (@code{fill-paragraph}). By default the >> +inserted file names will just be the files without a path. If >> +@code{diff-add-log-relative-names} is non-nil, a partial path relative >> +to the VC root directory will be inserted instead. > > GNU Coding Standards frown on using "path" for anything but PATH-style > directory lists. Please use "leading directories" or somesuch here, > as that's what you mean. I've just remove the changes to the manual from my patch. >> +*** New user option 'diff-relative-names-in-changelog'. >> +If non-nil insert file names in ChangeLog skeletons relative to the > ^ > Comma missing there. Done. >> +(defcustom diff-add-log-relative-names nil >> + "Use relative file names when generating ChangeLog messages." > > This doesn't say relative to what. It also doesn't mention the > commands which are affected. Added. >> (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...)), >> -where DEFUN... is a list of function names found in FILE." >> +where DEFUN... is a list of function names found in FILE. If >> +`diff-add-log-relative-names' is non-nil, insert file names >> +relative to the VC root directory." > > The "insert" part is out of place here, since there's no insertion. > > How about > > If `diff-add-log-relative-names' is non-nil, file names in the alist > are relative to the root directory of the VC repository. > > instead? I like it. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Add-new-user-option-diff-add-log-use-relative-names.patch >From 8ef441e5d5340b06dd04d294a384ae05bf7f5615 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Tue, 6 Sep 2022 22:06:29 +0200 Subject: [PATCH] Add new user option 'diff-add-log-use-relative-names' * .dir-locals.el: Set 'diff-add-log-use-relative-names' to t * etc/NEWS: Mention 'diff-add-log-relative-names' * lisp/vc/diff-mode.el (diff-add-log-use-relative-names): Add new option. (diff-add-log-current-defuns): Use new option. --- .dir-locals.el | 3 ++- etc/NEWS | 5 +++++ lisp/vc/diff-mode.el | 20 ++++++++++++++++++-- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/.dir-locals.el b/.dir-locals.el index 1c90ddcf56..9882a19f85 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -5,7 +5,8 @@ (sentence-end-double-space . t) (fill-column . 70) (emacs-lisp-docstring-fill-column . 65) - (bug-reference-url-format . "https://debbugs.gnu.org/%s"))) + (bug-reference-url-format . "https://debbugs.gnu.org/%s") + (diff-add-log-use-relative-names . t))) (c-mode . ((c-file-style . "GNU") (c-noise-macro-names . ("INLINE" "ATTRIBUTE_NO_SANITIZE_UNDEFINED" "UNINIT" "CALLBACK" "ALIGN_STACK")) (electric-quote-comment . nil) diff --git a/etc/NEWS b/etc/NEWS index b61b88d6fb..76c66a8e39 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1340,6 +1340,11 @@ Sets the value of the buffer-local variable 'whitespace-style' in 'diff-mode' buffers. By default, this variable is '(face trailing)', which preserves behavior from previous Emacs versions. ++++ +*** New user option 'diff-add-log-use-relative-names'. +If non-nil insert file names in ChangeLog skeletons relative to the +VC root directory. + ** Ispell --- diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index a01943437c..1d2fbca0e5 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -2336,10 +2336,21 @@ diff-undo (let ((inhibit-read-only t)) (undo arg))) +(defcustom diff-add-log-use-relative-names nil + "Use relative file names when generating ChangeLog skeletons. +The files will be relative to the root directory of the VC +repository. This option affects the behaviour of +`diff-add-log-current-defuns'." + :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...)), -where DEFUN... is a list of function names found in FILE." +where DEFUN... is a list of function names found in FILE. If +`diff-add-log-use-relative-names' is non-nil, file names in the alist +are relative to the root directory of the VC repository." (save-excursion (goto-char (point-min)) (let* ((defuns nil) @@ -2373,7 +2384,12 @@ diff-add-log-current-defuns ;; hunks (e.g., "diff --git ..." etc). (re-search-forward diff-hunk-header-re nil t) (setq hunk-end (save-excursion (diff-end-of-hunk))) - (pcase-let* ((filename (substring-no-properties (diff-find-file-name))) + (pcase-let* ((filename (substring-no-properties + (if diff-add-log-use-relative-names + (file-relative-name + (diff-find-file-name) + (vc-root-dir)) + (diff-find-file-name)))) (=lines 0) (+lines 0) (-lines 0) -- 2.30.2 --=-=-=--