update packages

This commit is contained in:
2025-06-22 17:08:08 +02:00
parent 54e5633369
commit 16a0a6db93
558 changed files with 68349 additions and 26568 deletions

View File

@@ -154,7 +154,8 @@ FOOTER are showed at start and end."
diff-hl-inline-popup--current-footer)))
;; https://debbugs.gnu.org/38563, `company--replacement-string'.
(add-face-text-property 0 (length str) 'default t str)
(overlay-put diff-hl-inline-popup--current-popup 'after-string str))))
(put-text-property 0 1 'cursor 0 str)
(overlay-put diff-hl-inline-popup--current-popup 'before-string str))))
(defun diff-hl-inline-popup--popup-down()
"Scrolls one line down."

View File

@@ -1,6 +1,6 @@
;;; diff-hl-margin.el --- Highlight buffer changes on margins -*- lexical-binding: t -*-
;; Copyright (C) 2012-2017 Free Software Foundation, Inc.
;; Copyright (C) 2012-2025 Free Software Foundation, Inc.
;; This file is part of GNU Emacs.
@@ -147,7 +147,15 @@ You probably shouldn't use this function directly."
,(propertize char 'face
(intern (format "diff-hl-margin-%s" type)))))))))
(defun diff-hl-margin-ensure-visible ()
(let ((width-var (intern (format "%s-margin-width" diff-hl-side))))
(when (zerop (symbol-value width-var))
(set width-var 1)
(dolist (win (get-buffer-window-list))
(set-window-buffer win (current-buffer))))))
(defun diff-hl-highlight-on-margin (ovl type _shape)
(diff-hl-margin-ensure-visible)
(let ((spec (cdr (assoc (cons type diff-hl-side)
(diff-hl-margin-spec-cache)))))
(overlay-put ovl 'before-string spec)))

View File

@@ -1,15 +1,11 @@
(define-package "diff-hl" "20250223.2320" "Highlight uncommitted changes using VC"
;; -*- no-byte-compile: t; lexical-binding: nil -*-
(define-package "diff-hl" "20250613.2144"
"Highlight uncommitted changes using VC."
'((cl-lib "0.2")
(emacs "25.1"))
:commit "685e99135001da13caecdff71acea1ee20bed373" :authors
'(("Dmitry Gutov" . "dmitry@gutov.dev"))
:maintainers
'(("Dmitry Gutov" . "dmitry@gutov.dev"))
:maintainer
'("Dmitry Gutov" . "dmitry@gutov.dev")
:keywords
'("vc" "diff")
:url "https://github.com/dgutov/diff-hl")
;; Local Variables:
;; no-byte-compile: t
;; End:
(emacs "26.1"))
:url "https://github.com/dgutov/diff-hl"
:commit "830b05253ba8f35b80448e5de2201aecb6943840"
:revdesc "830b05253ba8"
:keywords '("vc" "diff")
:authors '(("Dmitry Gutov" . "dmitry@gutov.dev"))
:maintainers '(("Dmitry Gutov" . "dmitry@gutov.dev")))

View File

@@ -76,15 +76,7 @@ Customize it to change the base properties of the text.")
(interactive)
(diff-hl-show-hunk-posframe--transient-mode -1)
(when (frame-live-p diff-hl-show-hunk--frame)
(make-frame-invisible diff-hl-show-hunk--frame))
(when diff-hl-show-hunk--original-frame
(when (frame-live-p diff-hl-show-hunk--original-frame)
(let ((frame diff-hl-show-hunk--original-frame))
(select-frame-set-input-focus frame)
;; In Gnome, sometimes the input focus is not restored to the
;; original frame, so we try harder in a while
(run-with-timer 0.1 nil (lambda () (select-frame-set-input-focus frame)))))
(setq diff-hl-show-hunk--original-frame nil)))
(make-frame-invisible diff-hl-show-hunk--frame)))
(defvar diff-hl-show-hunk-posframe--transient-mode-map
(let ((map (make-sparse-keymap)))
@@ -179,7 +171,6 @@ The button calls an ACTION."
(user-error
"Package `posframe' is not workable. Please customize diff-hl-show-hunk-function"))
(diff-hl-show-hunk--posframe-hide)
(setq diff-hl-show-hunk--hide-function #'diff-hl-show-hunk--posframe-hide)
;; put an overlay to override read-only-mode keymap
@@ -192,10 +183,14 @@ The button calls an ACTION."
'keymap diff-hl-show-hunk-posframe--transient-mode-map)))
(setq posframe-mouse-banish nil)
(setq diff-hl-show-hunk--original-frame last-event-frame)
(setq diff-hl-show-hunk--original-frame (selected-frame))
(let* ((hunk-overlay diff-hl-show-hunk--original-overlay)
(position (overlay-end hunk-overlay)))
(let* ((overlay diff-hl-show-hunk--original-overlay)
(type (overlay-get overlay 'diff-hl-hunk-type))
(position (save-excursion
(goto-char (overlay-end overlay))
(forward-line -1)
(point))))
(setq
diff-hl-show-hunk--frame
(posframe-show buffer
@@ -207,12 +202,12 @@ The button calls an ACTION."
:internal-border-color diff-hl-show-hunk-posframe-internal-border-color
:hidehandler nil
;; Sometimes, header-line is not taken into account, so put a min height and a min width
:min-height (when diff-hl-show-hunk-posframe-show-header-line 10)
:min-width (when diff-hl-show-hunk-posframe-show-header-line
(length (diff-hl-show-hunk-posframe--header-line)))
:respect-header-line diff-hl-show-hunk-posframe-show-header-line
:respect-tab-line nil
:respect-mode-line nil
:y-pixel-offset (if (eq type 'delete) (- (default-line-height)))
:override-parameters diff-hl-show-hunk-posframe-parameters)))
(set-frame-parameter diff-hl-show-hunk--frame 'drag-internal-border t)
@@ -231,8 +226,7 @@ The button calls an ACTION."
(setq cursor-type 'box)
;; Recenter around point
(recenter)))
(select-frame-set-input-focus diff-hl-show-hunk--frame))
(recenter))))
(provide 'diff-hl-show-hunk-posframe)
;;; diff-hl-show-hunk-posframe.el ends here

View File

@@ -132,6 +132,7 @@ point in that buffer to the corresponding line of the original
buffer."
(defvar vc-sentinel-movepoint)
(let* ((buffer (or (buffer-base-buffer) (current-buffer)))
(diff-hl-update-async nil)
(line (line-number-at-pos))
(dest-buffer diff-hl-show-hunk-diff-buffer-name))
(with-current-buffer buffer
@@ -338,7 +339,8 @@ end of the OVERLAY, so posframe/inline is placed below the hunk."
(set-window-start nil (point)))
((> (point) pt)
(redisplay))))
(goto-char (1- (overlay-end overlay)))))
(goto-char (1- (overlay-end overlay)))
(forward-line 0)))
;;;###autoload
(defun diff-hl-show-hunk-next ()
@@ -347,7 +349,8 @@ end of the OVERLAY, so posframe/inline is placed below the hunk."
(let* ((point (if diff-hl-show-hunk--original-overlay
(overlay-start diff-hl-show-hunk--original-overlay)
nil))
(next-overlay (diff-hl-show-hunk--next-hunk nil point)))
(next-overlay (diff-hl-show-hunk--next-hunk nil point))
(inhibit-redisplay t))
(if (not next-overlay)
(message "There is no next change")
(diff-hl-show-hunk-hide)
@@ -361,10 +364,6 @@ end of the OVERLAY, so posframe/inline is placed below the hunk."
The backend is determined by `diff-hl-show-hunk-function'."
(interactive)
;; Close any previous hunk
(save-excursion
(diff-hl-show-hunk-hide))
(unless (vc-backend buffer-file-name)
(user-error "The buffer is not under version control"))

View File

@@ -1,12 +1,13 @@
;;; diff-hl.el --- Highlight uncommitted changes using VC -*- lexical-binding: t -*-
;; Copyright (C) 2012-2024 Free Software Foundation, Inc.
;; Copyright (C) 2012-2025 Free Software Foundation, Inc.
;; Author: Dmitry Gutov <dmitry@gutov.dev>
;; URL: https://github.com/dgutov/diff-hl
;; Keywords: vc, diff
;; Version: 1.10.0
;; Package-Requires: ((cl-lib "0.2") (emacs "25.1"))
;; Package-Version: 20250613.2144
;; Package-Revision: 830b05253ba8
;; Package-Requires: ((cl-lib "0.2") (emacs "26.1"))
;; This file is part of GNU Emacs.
@@ -116,6 +117,20 @@
:group 'diff-hl
:type 'boolean)
(defcustom diff-hl-fallback-to-margin t
"Non-nil to use margin instead of fringe on non-graphic displays.
This resizes the margin to 1 if it's not visible."
:group 'diff-hl
:type 'boolean)
(defcustom diff-hl-autohide-margin nil
"Non-nil to reset margin width to 0 when no indicators shown.
When you use it, it's recommended to verify first that other enabled
features don't use margin for their indicators."
:type 'boolean)
(defcustom diff-hl-highlight-function 'diff-hl-highlight-on-fringe
"Function to highlight the current line. Its arguments are
overlay, change type and position within a hunk."
@@ -147,6 +162,12 @@
(set-default var value)
(when on (global-diff-hl-mode 1)))))
(defcustom diff-hl-bmp-max-width 16
"Maximum width of the fringe indicator bitmaps, in pixels.
The bitmap width is decided by comparing this value with the current width
of the fringe. When the fringe is hidden, this value is also used."
:type 'integer)
(defcustom diff-hl-highlight-revert-hunk-function
#'diff-hl-revert-narrow-to-hunk
"Function to emphasize the current hunk in `diff-hl-revert-hunk'.
@@ -230,8 +251,8 @@ It can be a relative expression as well, such as \"HEAD^\" with Git, or
(truncate (* (frame-char-height) spacing))
spacing)))
(w (min (frame-parameter nil (intern (format "%s-fringe" diff-hl-side)))
16))
(_ (when (zerop w) (setq w 16)))
diff-hl-bmp-max-width))
(_ (when (zerop w) (setq w diff-hl-bmp-max-width)))
(middle (make-vector h (expt 2 (1- w))))
(ones (1- (expt 2 w)))
(top (copy-sequence middle))
@@ -302,6 +323,7 @@ It can be a relative expression as well, such as \"HEAD^\" with Git, or
(defvar vc-svn-diff-switches)
(defvar vc-fossil-diff-switches)
(defvar vc-jj-diff-switches)
(defmacro diff-hl-with-diff-switches (body)
`(let ((vc-git-diff-switches
@@ -317,6 +339,7 @@ It can be a relative expression as well, such as \"HEAD^\" with Git, or
(vc-hg-diff-switches nil)
(vc-svn-diff-switches nil)
(vc-fossil-diff-switches '("-c" "0"))
(vc-jj-diff-switches '("--git" "--context=0"))
(vc-diff-switches '("-U0"))
,@(when (boundp 'vc-disable-async-diff)
'((vc-disable-async-diff t))))
@@ -342,21 +365,24 @@ It can be a relative expression as well, such as \"HEAD^\" with Git, or
(if (and (eq backend 'Git)
(not diff-hl-reference-revision)
(not diff-hl-show-staged-changes))
(apply #'vc-git-command buffer 1
(apply #'vc-git-command buffer
(if (diff-hl--use-async-p) 'async 1)
(list file)
"diff-files"
(cons "-p" (vc-switches 'git 'diff)))
(condition-case err
(vc-call-backend backend 'diff (list file)
diff-hl-reference-revision nil
buffer)
buffer
(diff-hl--use-async-p))
(error
;; https://github.com/dgutov/diff-hl/issues/117
(when (string-match-p "\\`Failed (status 128)" (error-message-string err))
(vc-call-backend backend 'diff (list file)
"4b825dc642cb6eb9a060e54bf8d69288fbee4904"
nil
buffer)))))
buffer
(diff-hl--use-async-p))))))
buffer)
(defun diff-hl-changes ()
@@ -373,14 +399,19 @@ It can be a relative expression as well, such as \"HEAD^\" with Git, or
((eq state 'removed)
`((1 ,(line-number-at-pos (point-max)) delete))))))))
(defun diff-hl-process-wait (buf)
(let ((proc (get-buffer-process buf)))
(while (process-live-p proc)
(accept-process-output proc 0.01))))
(defun diff-hl-changes-from-buffer (buf)
(diff-hl-process-wait buf)
(with-current-buffer buf
(let (res)
(goto-char (point-min))
(unless (eobp)
;; TODO: When 27.1 is the minimum requirement, we can drop
;; these bindings: that version, in addition to switching over
;; to the diff-refine var, also added the
;; called-interactively-p check, so refinement can't be
;; triggered by code calling the navigation functions, only by
;; direct interactive invocations.
@@ -407,14 +438,30 @@ It can be a relative expression as well, such as \"HEAD^\" with Git, or
(push (list line len type) res)))))
(nreverse res))))
(defun diff-hl--use-async-p ()
(and diff-hl-update-async
(not
(run-hook-with-args-until-success 'diff-hl-async-inhibit-functions
default-directory))))
(defun diff-hl-update ()
"Updates the diff-hl overlay."
(if (and diff-hl-update-async
(not
(run-hook-with-args-until-success 'diff-hl-async-inhibit-functions
default-directory)))
(if (diff-hl--use-async-p)
;; TODO: debounce if a thread is already running.
(make-thread 'diff-hl--update-safe "diff-hl--update-safe")
(let ((buf (current-buffer))
(temp-buffer
(if (< emacs-major-version 28)
(generate-new-buffer " *temp*")
(generate-new-buffer " *temp*" t))))
;; Switch buffer temporarily, to "unlock" it for other threads.
(with-current-buffer temp-buffer
(make-thread
(lambda ()
(kill-buffer temp-buffer)
(when (buffer-live-p buf)
(set-buffer buf)
(diff-hl--update-safe)))
"diff-hl--update-safe")))
(diff-hl--update)))
(defun diff-hl-with-editor-p (_dir)
@@ -433,6 +480,8 @@ It can be a relative expression as well, such as \"HEAD^\" with Git, or
(let ((changes (diff-hl-changes))
(current-line 1))
(diff-hl-remove-overlays)
(when (not changes)
(diff-hl--autohide-margin))
(save-excursion
(save-restriction
(widen)
@@ -463,6 +512,16 @@ It can be a relative expression as well, such as \"HEAD^\" with Git, or
(overlay-put h 'insert-in-front-hooks hook)
(overlay-put h 'insert-behind-hooks hook)))))))))
(defun diff-hl--autohide-margin ()
(let ((width-var (intern (format "%s-margin-width" diff-hl-side))))
(when (and diff-hl-autohide-margin
(> (symbol-value width-var) 0))
(if (eql (default-value width-var) 0)
(kill-local-variable width-var)
(set width-var 0))
(dolist (win (get-buffer-window-list))
(set-window-buffer win (current-buffer))))))
(defvar-local diff-hl--modified-tick nil)
(put 'diff-hl--modified-tick 'permanent-local t)
@@ -478,9 +537,14 @@ It can be a relative expression as well, such as \"HEAD^\" with Git, or
(funcall diff-hl-highlight-function o type shape)
o))
(autoload 'diff-hl-highlight-on-margin "diff-hl-margin")
(defun diff-hl-highlight-on-fringe (ovl type shape)
(overlay-put ovl 'before-string (diff-hl-fringe-spec type shape
diff-hl-side)))
(if (and diff-hl-fallback-to-margin
(not (display-graphic-p)))
(diff-hl-highlight-on-margin ovl type shape)
(overlay-put ovl 'before-string (diff-hl-fringe-spec type shape
diff-hl-side))))
(defun diff-hl-remove-overlays (&optional beg end)
(save-restriction
@@ -526,7 +590,11 @@ It can be a relative expression as well, such as \"HEAD^\" with Git, or
(let ((revs (diff-hl-diff-read-revisions rev1)))
(setq rev1 (car revs)
rev2 (cdr revs))))
(vc-diff-internal t (vc-deduce-fileset) rev1 rev2 t)
(vc-diff-internal
(if (boundp 'vc-allow-async-diff)
vc-allow-async-diff
t)
(vc-deduce-fileset) rev1 rev2 t)
(vc-run-delayed (if (< (line-number-at-pos (point-max)) 3)
(with-current-buffer buffer (diff-hl-remove-overlays))
(when (or (not rev2) diff-hl-goto-hunk-old-revisions)
@@ -615,6 +683,7 @@ in the source file, or the last line of the hunk above it."
(let* ((diff-buffer (get-buffer-create
(generate-new-buffer-name "*diff-hl*")))
(buffer (current-buffer))
(diff-hl-update-async nil)
(line (save-excursion
(diff-hl-find-current-hunk)
(line-number-at-pos)))
@@ -755,7 +824,7 @@ its end position."
(user-error "Only Git supports staging; this file is controlled by %s" backend))))
(defun diff-hl-stage-diff (orig-buffer)
(let ((patchfile (make-temp-file "diff-hl-stage-patch"))
(let ((patchfile (make-nearby-temp-file "diff-hl-stage-patch"))
success)
(write-region (point-min) (point-max) patchfile
nil 'silent)
@@ -763,7 +832,7 @@ its end position."
(with-current-buffer orig-buffer
(with-output-to-string
(vc-git-command standard-output 0
patchfile
(file-local-name patchfile)
"apply" "--cached" )
(setq success t)))
(delete-file patchfile))
@@ -786,7 +855,9 @@ Only supported with Git."
(with-current-buffer dest-buffer
(let ((inhibit-read-only t))
(erase-buffer)))
(diff-hl-diff-buffer-with-reference file dest-buffer nil 3)
(let (diff-hl-reference-revision
diff-hl-update-async)
(diff-hl-diff-buffer-with-reference file dest-buffer nil 3))
(with-current-buffer dest-buffer
(with-no-warnings
(let (diff-auto-refine-mode)
@@ -961,7 +1032,8 @@ The value of this variable is a mode line template as in
(remove-hook 'magit-revert-buffer-hook 'diff-hl-update t)
(remove-hook 'magit-not-reverted-hook 'diff-hl-update t)
(remove-hook 'text-scale-mode-hook 'diff-hl-maybe-redefine-bitmaps t)
(diff-hl-remove-overlays)))
(diff-hl-remove-overlays)
(diff-hl--autohide-margin)))
(defun diff-hl-after-checkin ()
(let ((fileset (vc-deduce-fileset t)))
@@ -1096,6 +1168,11 @@ the user should be returned."
(declare-function diff-no-select "diff")
(defvar diff-hl-temporary-directory (if (and (eq system-type 'gnu/linux)
(file-directory-p "/dev/shm/"))
"/dev/shm/"
temporary-file-directory))
(defun diff-hl-diff-buffer-with-reference (file &optional dest-buffer backend context-lines)
"Compute the diff between the current buffer contents and reference in BACKEND.
The diffs are computed in the buffer DEST-BUFFER. This requires
@@ -1106,10 +1183,7 @@ CONTEXT-LINES is the size of the unified diff context, defaults to 0."
(save-current-buffer
(let* ((dest-buffer (or dest-buffer "*diff-hl-diff-buffer-with-reference*"))
(backend (or backend (vc-backend file)))
(temporary-file-directory
(if (and (eq system-type 'gnu/linux) (file-directory-p "/dev/shm/"))
"/dev/shm/"
temporary-file-directory))
(temporary-file-directory diff-hl-temporary-directory)
(rev
(if (and (eq backend 'Git)
(not diff-hl-reference-revision)
@@ -1122,12 +1196,10 @@ CONTEXT-LINES is the size of the unified diff context, defaults to 0."
(or (diff-hl-resolved-reference-revision backend)
(diff-hl-working-revision file backend)))))
(switches (format "-U %d --strip-trailing-cr" (or context-lines 0))))
(diff-no-select rev (current-buffer) switches 'noasync
(diff-no-select rev (current-buffer) switches (not (diff-hl--use-async-p))
(get-buffer-create dest-buffer))
(with-current-buffer dest-buffer
(let ((inhibit-read-only t))
;; Function `diff-sentinel' adds a final line, so remove it
(delete-matching-lines "^Diff finished.*")))
;; Function `diff-sentinel' adds a summary line, but that seems fine.
;; In all commands which use exact text we call it synchronously.
(get-buffer-create dest-buffer))))
(defun diff-hl-resolved-reference-revision (backend)