[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/diff-hl c58098c 15/25: Added option to not automaticall
From: |
Dmitry Gutov |
Subject: |
[elpa] externals/diff-hl c58098c 15/25: Added option to not automatically enable diff-hl in certain major-modes |
Date: |
Sun, 20 Dec 2020 05:07:02 -0500 (EST) |
branch: externals/diff-hl
commit c58098c70a3dd52d766f08bf811308bfb0f19ac7
Author: Sebastian Wålinder <s.walinder@gmail.com>
Commit: Sebastian Wålinder <s.walinder@gmail.com>
Added option to not automatically enable diff-hl in certain major-modes
---
diff-hl.el | 34 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/diff-hl.el b/diff-hl.el
index 94b9f73..57c09ed 100644
--- a/diff-hl.el
+++ b/diff-hl.el
@@ -141,6 +141,28 @@ the end position as its only argument."
(const :tag "Highlight the first column"
diff-hl-revert-highlight-first-column)))
+(defcustom diff-hl-global-modes '(not image-mode)
+ "Modes for which `diff-hl-mode' is automagically turned on.
+This is taken directly from `font-lock-global-modes'.
+If nil, no modes have diff-hl mode automatically turned on.
+If t, all modes have diff-hl enabled.
+If a list, it should be a list of `major-mode' symbol names for which diff-hl
+mode should be automatically turned on. The sense of the list is negated if it
+begins with `not'. For example:
+ (not c-mode c++-mode)
+means that `diff-hl-mode' is turned on for all modes except for C and C++ mode.
+The default value disables `diff-hl' in `image-mode' buffers. Without this
images
+loads slower because `diff-hl' has to look through the image data for
+possible changes. And because images are displayed on a single line in Emacs
+there is little reason to want this behavior."
+ :type '(choice (const :tag "none" nil)
+ (const :tag "all" t)
+ (set :menu-tag "mode specific" :tag "modes"
+ :value (not)
+ (const :tag "Except" not)
+ (repeat :inline t (symbol :tag "mode"))))
+ :group 'diff-hl)
+
(defvar diff-hl-reference-revision nil
"Revision to diff against. nil means the most recent one.")
@@ -654,8 +676,18 @@ The value of this variable is a mode line template as in
(diff-hl-dir-mode 1))))
;;;###autoload
+(defun diff-hl--global-turn-on ()
+ "Run `turn-on-diff-hl-mode' in applicable major modes."
+ (when (cond ((eq diff-hl-global-modes t)
+ t)
+ ((eq (car-safe diff-hl-global-modes) 'not)
+ (not (memq major-mode (cdr diff-hl-global-modes))))
+ (t (memq major-mode diff-hl-global-modes)))
+ (turn-on-diff-hl-mode)))
+
+;;;###autoload
(define-globalized-minor-mode global-diff-hl-mode diff-hl-mode
- turn-on-diff-hl-mode :after-hook (diff-hl-global-mode-change))
+ diff-hl--global-turn-on :after-hook (diff-hl-global-mode-change))
(defun diff-hl-global-mode-change ()
(unless global-diff-hl-mode
- [elpa] externals/diff-hl 2cf8b48 07/25: Avoid the "args out of range error", (continued)
- [elpa] externals/diff-hl 2cf8b48 07/25: Avoid the "args out of range error", Dmitry Gutov, 2020/12/20
- [elpa] externals/diff-hl bc02c99 08/25: Add variable to ask for confirmation when reverting a hunk, Dmitry Gutov, 2020/12/20
- [elpa] externals/diff-hl ba6cf44 12/25: Add tests., Dmitry Gutov, 2020/12/20
- [elpa] externals/diff-hl 7fce94f 09/25: Merge pull request #137 from erickgnavar/feature/ask-for-confirmation-on-revert-hunk, Dmitry Gutov, 2020/12/20
- [elpa] externals/diff-hl ab2f4f0 13/25: Merge pull request #140 from mookid/fix-indirect-buffers, Dmitry Gutov, 2020/12/20
- [elpa] externals/diff-hl 2281a89 17/25: Update docstring and untabify, Dmitry Gutov, 2020/12/20
- [elpa] externals/diff-hl a625033 10/25: Update Magit bridge to use the recommended approach, Dmitry Gutov, 2020/12/20
- [elpa] externals/diff-hl f3b2d15 11/25: diff-hl-diff-goto-hunk, diff-hl-revert-hunk: handle indirect buffers., Dmitry Gutov, 2020/12/20
- [elpa] externals/diff-hl 176f931 14/25: Support buffers in 'conflict' state as well, Dmitry Gutov, 2020/12/20
- [elpa] externals/diff-hl 165a30f 16/25: Merge pull request #143 from walseb/master, Dmitry Gutov, 2020/12/20
- [elpa] externals/diff-hl c58098c 15/25: Added option to not automatically enable diff-hl in certain major-modes,
Dmitry Gutov <=
- [elpa] externals/diff-hl d1b9a2b 18/25: Add global-diff-hl-amend-mode to diff-hl custom group, Dmitry Gutov, 2020/12/20
- [elpa] externals/diff-hl c31af59 20/25: Don't hook into after-revert-hook, Dmitry Gutov, 2020/12/20
- [elpa] externals/diff-hl 8ed1120 22/25: Revert "Don't hook into after-revert-hook", Dmitry Gutov, 2020/12/20
- [elpa] externals/diff-hl f6244ab 19/25: Merge pull request #150 from tarsiiformes/custom-group, Dmitry Gutov, 2020/12/20
- [elpa] externals/diff-hl 09ffe8d 21/25: Introduce diff-hl-update-once, to avoid diffing twice in normal-mode, Dmitry Gutov, 2020/12/20
- [elpa] externals/diff-hl 328e23e 23/25: Introduce diff-hl-after-revert, Dmitry Gutov, 2020/12/20
- [elpa] externals/diff-hl b8b4f43 24/25: Bump the version, Dmitry Gutov, 2020/12/20
- [elpa] externals/diff-hl a0028d9 25/25: Merge branch 'externals/diff-hl' of git+ssh://git.sv.gnu.org/srv/git/emacs/elpa, Dmitry Gutov, 2020/12/20