Skip to content

Commit 359cef5

Browse files
committed
Change possible value of diff-hl-update-async to nil, t and thread
Thus having users to do an extra step to opt into using a thread.
1 parent 549049a commit 359cef5

1 file changed

Lines changed: 14 additions & 13 deletions

File tree

diff-hl.el

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -254,21 +254,22 @@ the current version of the file)."
254254
(defcustom diff-hl-update-async nil
255255
"When non-nil, `diff-hl-update' will run asynchronously.
256256
257-
When the value is `no-thread', it will call the diff process
258-
asynchronously. Any other non-nil value will do that and use a background
259-
thread.
257+
When the value is `thread', it will call the diff process in a Lisp thread.
260258
261-
Note that the `no-thread' approach is only compatible with a recent Emacs
262-
31+. Whereas using a thread can help in older Emacs as well, but can lead
263-
to a crash in some configurations.
259+
Any other non-nil value will do call it the diff process asynchronously in
260+
the main thread.
264261
265-
This can help prevent Emacs from freezing, especially by a slow version
266-
control (VC) backend. It's disabled in remote buffers, though, since it
267-
didn't work reliably in such during testing."
262+
Note that the latter mechanism is only compatible with a recent Emacs
263+
31+ (for backends such as Git and Hg). Whereas using a thread can help in
264+
older Emacs as well, but might crash in some configurations.
265+
266+
This feature makes Emacs more responsive with slower version control (VC)
267+
backends and large projects. But it's disabled in remote buffers, since for
268+
now testing shows it doesn't work reliably in such."
268269
:type '(choice
269270
(const :tag "Disabled" nil)
270-
(const :tag "Background thread" t)
271-
(const :tag "Full async" no-thread)))
271+
(const :tag "Simple async" t)
272+
(const :tag "Thread" thread)))
272273

273274
;; Threads are not reliable with remote files, yet.
274275
(defcustom diff-hl-async-inhibit-functions (list #'diff-hl-with-editor-p
@@ -462,7 +463,7 @@ It can be a relative expression as well, such as \"HEAD^\" with Git, or
462463
;; prohibiting the async process call inside.
463464
;; That still makes it partially async.
464465
(diff-hl-update-async (and (not (eq window-system 'ns))
465-
diff-hl-update-async)))
466+
(eq diff-hl-update-async t))))
466467
(cond
467468
((and
468469
(not diff-hl-highlight-reference-function)
@@ -601,7 +602,7 @@ contents as they are (or would be) after applying the changes in NEW."
601602
"Updates the diff-hl overlay."
602603
(setq diff-hl-timer nil)
603604
(if (and (diff-hl--use-async-p)
604-
(not (eq diff-hl-update-async 'no-thread)))
605+
(eq diff-hl-update-async 'thread))
605606
;; TODO: debounce if a thread is already running.
606607
(let ((buf (current-buffer))
607608
(temp-buffer

0 commit comments

Comments
 (0)