Fix fontification in short unintegrated changes logs (bug#81215)

Do not merge to master.

* lisp/vc/vc.el (vc--shortlog): New variable.
(vc-print-log-internal):
* lisp/vc/vc-git.el (vc-git-log-view-mode):
* lisp/vc/vc-hg.el (vc-hg-log-view-mode): Use it.
This commit is contained in:
Sean Whitton 2026-06-11 15:38:56 +01:00
parent 7b23e17eb8
commit 2c6a03b08c
3 changed files with 20 additions and 6 deletions

View file

@ -1975,17 +1975,22 @@ log entries."
(setq-local log-view-file-re regexp-unmatchable)
(setq-local log-view-per-file-logs nil)
(setq-local log-view-message-re
(if (not (memq vc-log-view-type '(long log-search with-diff)))
(if (if (eq vc-log-view-type 'log-unintegrated)
vc--shortlog
(not (memq vc-log-view-type '(long log-search with-diff))))
(cadr vc-git-root-log-format)
"^commit +\\([0-9a-z]+\\)"))
;; Allow expanding short log entries.
(when (memq vc-log-view-type
'(short log-outgoing log-incoming log-unintegrated mergebase))
(when (if (eq vc-log-view-type 'log-unintegrated)
vc--shortlog
(memq vc-log-view-type '(short log-outgoing log-incoming mergebase)))
(setq truncate-lines t)
(setq-local log-view-expanded-log-entry-function
'vc-git-expanded-log-entry))
(setq-local log-view-font-lock-keywords
(if (not (memq vc-log-view-type '(long log-search with-diff)))
(if (if (eq vc-log-view-type 'log-unintegrated)
vc--shortlog
(not (memq vc-log-view-type '(long log-search with-diff))))
(list (cons (nth 1 vc-git-root-log-format)
(nth 2 vc-git-root-log-format)))
(append

View file

@ -471,8 +471,9 @@ the log starting from that revision."
(define-derived-mode vc-hg-log-view-mode log-view-mode "Hg-Log-View"
(require 'add-log) ;; we need the add-log faces
(let ((shortp (memq vc-log-view-type
'(short log-incoming log-outgoing log-unintegrated))))
(let ((shortp (if (eq vc-log-view-type 'log-unintegrated)
vc--shortlog
(memq vc-log-view-type '(short log-incoming log-outgoing)))))
(setq-local log-view-file-re regexp-unmatchable)
(setq-local log-view-per-file-logs nil)
(setq-local log-view-message-re

View file

@ -4309,6 +4309,13 @@ button for. Same for CURRENT-REVISION. LIMIT means the usual."
"Show the log for the file name(s) %s the rename"
before-after))))
(defvar-local vc--shortlog nil
"Whether this is a shortlog.
This is a hack to fix bug#81215 which came up after the Emacs 31 freeze.
For Emacs 32 that bug is fixed by replacing `vc-log-view-type' with
`vc-log-view-types'.")
(put 'vc--shortlog 'permanent-local t)
(defun vc-print-log-internal (backend files working-revision
&optional is-start-revision limit type)
"For specified BACKEND and FILES, show the VC log.
@ -4328,6 +4335,7 @@ LIMIT can also be a string, which means the revision before which to stop."
(vc-log-internal-common
backend buffer-name files type
(lambda (bk buf _type-arg files-arg)
(with-current-buffer buf (setq-local vc--shortlog shortlog))
(vc-call-backend bk 'print-log files-arg buf shortlog
(when is-start-revision working-revision) limit)
(when log-view-vc-prev-fileset