diff options
| author | Stefan Monnier | 2020-03-28 10:16:58 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2020-03-28 10:16:58 -0400 |
| commit | dceba13ce57ed0cb726e89566197f77359a38d91 (patch) | |
| tree | e6a49fc4b4ad78aed7c81808550abc1fea27eac8 | |
| parent | a7e3516571e72e58bb4b5d19eca5feca41135f57 (diff) | |
| download | emacs-dceba13ce57ed0cb726e89566197f77359a38d91.tar.gz emacs-dceba13ce57ed0cb726e89566197f77359a38d91.zip | |
* lisp/jit-lock.el (jit-lock-mode): Pass `local` to add-hook
The old code used local=nil knowing that add-hook would affect the
local part only anyway. Remove this hideous assumption.
Remove redundant `:group` args while we're at it.
| -rw-r--r-- | lisp/jit-lock.el | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/lisp/jit-lock.el b/lisp/jit-lock.el index d73cd74da0b..9cdb108be03 100644 --- a/lisp/jit-lock.el +++ b/lisp/jit-lock.el | |||
| @@ -48,8 +48,7 @@ Preserves the `buffer-modified-p' state of the current buffer." | |||
| 48 | "Jit-lock fontifies chunks of at most this many characters at a time. | 48 | "Jit-lock fontifies chunks of at most this many characters at a time. |
| 49 | 49 | ||
| 50 | This variable controls both display-time and stealth fontification." | 50 | This variable controls both display-time and stealth fontification." |
| 51 | :type 'integer | 51 | :type 'integer) |
| 52 | :group 'jit-lock) | ||
| 53 | 52 | ||
| 54 | 53 | ||
| 55 | (defcustom jit-lock-stealth-time nil | 54 | (defcustom jit-lock-stealth-time nil |
| @@ -59,8 +58,7 @@ If nil, stealth fontification is never performed. | |||
| 59 | 58 | ||
| 60 | The value of this variable is used when JIT Lock mode is turned on." | 59 | The value of this variable is used when JIT Lock mode is turned on." |
| 61 | :type '(choice (const :tag "never" nil) | 60 | :type '(choice (const :tag "never" nil) |
| 62 | (number :tag "seconds" :value 16)) | 61 | (number :tag "seconds" :value 16))) |
| 63 | :group 'jit-lock) | ||
| 64 | 62 | ||
| 65 | 63 | ||
| 66 | (defcustom jit-lock-stealth-nice 0.5 | 64 | (defcustom jit-lock-stealth-nice 0.5 |
| @@ -72,8 +70,7 @@ To reduce machine load during stealth fontification, at the cost of stealth | |||
| 72 | taking longer to fontify, you could increase the value of this variable. | 70 | taking longer to fontify, you could increase the value of this variable. |
| 73 | See also `jit-lock-stealth-load'." | 71 | See also `jit-lock-stealth-load'." |
| 74 | :type '(choice (const :tag "never" nil) | 72 | :type '(choice (const :tag "never" nil) |
| 75 | (number :tag "seconds")) | 73 | (number :tag "seconds"))) |
| 76 | :group 'jit-lock) | ||
| 77 | 74 | ||
| 78 | 75 | ||
| 79 | (defcustom jit-lock-stealth-load | 76 | (defcustom jit-lock-stealth-load |
| @@ -89,14 +86,12 @@ See also `jit-lock-stealth-nice'." | |||
| 89 | :type (if (condition-case nil (load-average) (error)) | 86 | :type (if (condition-case nil (load-average) (error)) |
| 90 | '(choice (const :tag "never" nil) | 87 | '(choice (const :tag "never" nil) |
| 91 | (integer :tag "load")) | 88 | (integer :tag "load")) |
| 92 | '(const :format "%t: unsupported\n" nil)) | 89 | '(const :format "%t: unsupported\n" nil))) |
| 93 | :group 'jit-lock) | ||
| 94 | 90 | ||
| 95 | 91 | ||
| 96 | (defcustom jit-lock-stealth-verbose nil | 92 | (defcustom jit-lock-stealth-verbose nil |
| 97 | "If non-nil, means stealth fontification should show status messages." | 93 | "If non-nil, means stealth fontification should show status messages." |
| 98 | :type 'boolean | 94 | :type 'boolean) |
| 99 | :group 'jit-lock) | ||
| 100 | 95 | ||
| 101 | 96 | ||
| 102 | (defvaralias 'jit-lock-defer-contextually 'jit-lock-contextually) | 97 | (defvaralias 'jit-lock-defer-contextually 'jit-lock-contextually) |
| @@ -115,13 +110,11 @@ buffer mode's syntax table, i.e., only if `font-lock-keywords-only' is nil. | |||
| 115 | The value of this variable is used when JIT Lock mode is turned on." | 110 | The value of this variable is used when JIT Lock mode is turned on." |
| 116 | :type '(choice (const :tag "never" nil) | 111 | :type '(choice (const :tag "never" nil) |
| 117 | (const :tag "always" t) | 112 | (const :tag "always" t) |
| 118 | (other :tag "syntax-driven" syntax-driven)) | 113 | (other :tag "syntax-driven" syntax-driven))) |
| 119 | :group 'jit-lock) | ||
| 120 | 114 | ||
| 121 | (defcustom jit-lock-context-time 0.5 | 115 | (defcustom jit-lock-context-time 0.5 |
| 122 | "Idle time after which text is contextually refontified, if applicable." | 116 | "Idle time after which text is contextually refontified, if applicable." |
| 123 | :type '(number :tag "seconds") | 117 | :type '(number :tag "seconds")) |
| 124 | :group 'jit-lock) | ||
| 125 | 118 | ||
| 126 | (defcustom jit-lock-antiblink-grace 2 | 119 | (defcustom jit-lock-antiblink-grace 2 |
| 127 | "Delay after which to refontify unterminated strings and comments. | 120 | "Delay after which to refontify unterminated strings and comments. |
| @@ -134,14 +127,12 @@ and comments, the delay helps avoid unpleasant \"blinking\", between | |||
| 134 | string/comment and non-string/non-comment fontification." | 127 | string/comment and non-string/non-comment fontification." |
| 135 | :type '(choice (const :tag "never" nil) | 128 | :type '(choice (const :tag "never" nil) |
| 136 | (number :tag "seconds")) | 129 | (number :tag "seconds")) |
| 137 | :group 'jit-lock | ||
| 138 | :version "27.1") | 130 | :version "27.1") |
| 139 | 131 | ||
| 140 | (defcustom jit-lock-defer-time nil ;; 0.25 | 132 | (defcustom jit-lock-defer-time nil ;; 0.25 |
| 141 | "Idle time after which deferred fontification should take place. | 133 | "Idle time after which deferred fontification should take place. |
| 142 | If nil, fontification is not deferred. | 134 | If nil, fontification is not deferred. |
| 143 | If 0, then fontification is only deferred while there is input pending." | 135 | If 0, then fontification is only deferred while there is input pending." |
| 144 | :group 'jit-lock | ||
| 145 | :type '(choice (const :tag "never" nil) | 136 | :type '(choice (const :tag "never" nil) |
| 146 | (number :tag "seconds"))) | 137 | (number :tag "seconds"))) |
| 147 | 138 | ||
| @@ -262,7 +253,7 @@ If you need to debug code run from jit-lock, see `jit-lock-debug-mode'." | |||
| 262 | 253 | ||
| 263 | ;; Setup our hooks. | 254 | ;; Setup our hooks. |
| 264 | (add-hook 'after-change-functions 'jit-lock-after-change nil t) | 255 | (add-hook 'after-change-functions 'jit-lock-after-change nil t) |
| 265 | (add-hook 'fontification-functions 'jit-lock-function)) | 256 | (add-hook 'fontification-functions 'jit-lock-function nil t)) |
| 266 | 257 | ||
| 267 | ;; Turn Just-in-time Lock mode off. | 258 | ;; Turn Just-in-time Lock mode off. |
| 268 | (t | 259 | (t |
| @@ -294,7 +285,7 @@ If you need to debug code run from jit-lock, see `jit-lock-debug-mode'." | |||
| 294 | When this minor mode is enabled, jit-lock runs as little code as possible | 285 | When this minor mode is enabled, jit-lock runs as little code as possible |
| 295 | during redisplay and moves the rest to a timer, where things | 286 | during redisplay and moves the rest to a timer, where things |
| 296 | like `debug-on-error' and Edebug can be used." | 287 | like `debug-on-error' and Edebug can be used." |
| 297 | :global t :group 'jit-lock | 288 | :global t |
| 298 | (when jit-lock-defer-timer | 289 | (when jit-lock-defer-timer |
| 299 | (cancel-timer jit-lock-defer-timer) | 290 | (cancel-timer jit-lock-defer-timer) |
| 300 | (setq jit-lock-defer-timer nil)) | 291 | (setq jit-lock-defer-timer nil)) |
| @@ -438,8 +429,8 @@ Defaults to the whole buffer. END can be out of bounds." | |||
| 438 | (quit (put-text-property start next 'fontified nil) | 429 | (quit (put-text-property start next 'fontified nil) |
| 439 | (signal (car err) (cdr err)))))) | 430 | (signal (car err) (cdr err)))))) |
| 440 | 431 | ||
| 441 | ;; In case we fontified more than requested, take advantage of the | 432 | ;; In case we fontified more than requested, take |
| 442 | ;; good news. | 433 | ;; advantage of the good news. |
| 443 | (when (or (< tight-beg start) (> tight-end next)) | 434 | (when (or (< tight-beg start) (> tight-end next)) |
| 444 | (put-text-property tight-beg tight-end 'fontified t)) | 435 | (put-text-property tight-beg tight-end 'fontified t)) |
| 445 | 436 | ||