aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2005-12-10 11:48:21 +0000
committerEli Zaretskii2005-12-10 11:48:21 +0000
commit71060bddb07521b5a7ee929d1b158de78b16d856 (patch)
treef6ad73924a25869a0151d12055c7970db0583fb5
parent6d93e4aa38aa1993c8be0e24cf374d40583455bd (diff)
downloademacs-71060bddb07521b5a7ee929d1b158de78b16d856.tar.gz
emacs-71060bddb07521b5a7ee929d1b158de78b16d856.zip
(hi-lock-mode) Renamed from hi-lock-buffer-mode; react if global-hi-lock-mode
seems intended. (global-hi-lock-mode) Renamed from hi-lock-mode. (hi-lock-archaic-interface-message-used, hi-lock-archaic-interface-deduce): New variables. (turn-on-hi-lock-if-enabled, hi-lock-line-face-buffer) (hi-lock-face-buffer, hi-lock-face-phrase-buffer) (hi-lock-find-patterns, hi-lock-font-lock-hook): Replace hi-lock-buffer-mode with hi-lock-mode.
-rw-r--r--lisp/ChangeLog12
-rw-r--r--lisp/hi-lock.el63
2 files changed, 59 insertions, 16 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 21f3422a63d..0da509f20e9 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,15 @@
12005-12-10 David Koppelman <koppel@ece.lsu.edu>
2
3 * hi-lock.el: (hi-lock-mode) Renamed from hi-lock-buffer-mode;
4 react if global-hi-lock-mode seems intended.
5 (global-hi-lock-mode) Renamed from hi-lock-mode.
6 (hi-lock-archaic-interface-message-used)
7 (hi-lock-archaic-interface-deduce): New variables.
8 (turn-on-hi-lock-if-enabled, hi-lock-line-face-buffer)
9 (hi-lock-face-buffer, hi-lock-face-phrase-buffer)
10 (hi-lock-find-patterns, hi-lock-font-lock-hook): Replace
11 hi-lock-buffer-mode with hi-lock-mode.
12
12005-12-10 Kevin Rodgers <ihs_4664@ihs.com> 132005-12-10 Kevin Rodgers <ihs_4664@ihs.com>
2 14
3 * emacs-lisp/lisp.el (lisp-complete-symbol): Regenerate the 15 * emacs-lisp/lisp.el (lisp-complete-symbol): Regenerate the
diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el
index 4c61be5529e..c3e2d814767 100644
--- a/lisp/hi-lock.el
+++ b/lisp/hi-lock.el
@@ -58,7 +58,7 @@
58;; hi-lock mode and adds a "Regexp Highlighting" entry 58;; hi-lock mode and adds a "Regexp Highlighting" entry
59;; to the edit menu. 59;; to the edit menu.
60;; 60;;
61;; (hi-lock-mode 1) 61;; (global-hi-lock-mode 1)
62;; 62;;
63;; You might also want to bind the hi-lock commands to more 63;; You might also want to bind the hi-lock commands to more
64;; finger-friendly sequences: 64;; finger-friendly sequences:
@@ -188,6 +188,17 @@ calls."
188(defvar hi-lock-file-patterns-prefix "Hi-lock" 188(defvar hi-lock-file-patterns-prefix "Hi-lock"
189 "Regexp for finding hi-lock patterns at top of file.") 189 "Regexp for finding hi-lock patterns at top of file.")
190 190
191(defvar hi-lock-archaic-interface-message-used nil
192 "True if user alerted that global-hi-lock-mode is now the global switch.
193Earlier versions of hi-lock used hi-lock-mode as the global switch,
194the message is issued if it appears that hi-lock-mode is used assuming
195that older functionality. This variable avoids multiple reminders.")
196
197(defvar hi-lock-archaic-interface-deduce nil
198 "If non-nil, sometimes assume that hi-lock-mode means global-hi-lock-mode.
199Assumption is made if hi-lock-mode used in the *scratch* buffer while
200a library is being loaded.")
201
191(make-variable-buffer-local 'hi-lock-interactive-patterns) 202(make-variable-buffer-local 'hi-lock-interactive-patterns)
192(put 'hi-lock-interactive-patterns 'permanent-local t) 203(put 'hi-lock-interactive-patterns 'permanent-local t)
193(make-variable-buffer-local 'hi-lock-regexp-history) 204(make-variable-buffer-local 'hi-lock-regexp-history)
@@ -238,13 +249,15 @@ calls."
238 249
239 250
240;;;###autoload 251;;;###autoload
241(define-minor-mode hi-lock-buffer-mode 252(define-minor-mode hi-lock-mode
242 "Toggle minor mode for interactively adding font-lock highlighting patterns. 253 "Toggle minor mode for interactively adding font-lock highlighting patterns.
243 254
244If ARG positive turn hi-lock on. Issuing a hi-lock command will also 255If ARG positive turn hi-lock on. Issuing a hi-lock command will also
245turn hi-lock on. When hi-lock is turned on, a \"Regexp Highlighting\" 256turn hi-lock on; to turn hi-lock on in all buffers use
246submenu is added to the \"Edit\" menu. The commands in the submenu, 257global-hi-lock-mode or in your .emacs file (global-hi-lock-mode 1).
247which can be called interactively, are: 258When hi-lock is turned on, a \"Regexp Highlighting\" submenu is added
259to the \"Edit\" menu. The commands in the submenu, which can be
260called interactively, are:
248 261
249\\[highlight-regexp] REGEXP FACE 262\\[highlight-regexp] REGEXP FACE
250 Highlight matches of pattern REGEXP in current buffer with FACE. 263 Highlight matches of pattern REGEXP in current buffer with FACE.
@@ -283,7 +296,24 @@ is found. A mode is excluded if it's in the list `hi-lock-exclude-modes'."
283 :lighter " H" 296 :lighter " H"
284 :global nil 297 :global nil
285 :keymap hi-lock-map 298 :keymap hi-lock-map
286 (if hi-lock-buffer-mode 299 (when (and (equal (buffer-name) "*scratch*")
300 load-in-progress
301 (not (interactive-p))
302 (not hi-lock-archaic-interface-message-used))
303 (setq hi-lock-archaic-interface-message-used t)
304 (if hi-lock-archaic-interface-deduce
305 (global-hi-lock-mode hi-lock-mode)
306 (warn
307 "Possible archaic use of (hi-lock-mode).
308Use (global-hi-lock-mode 1) in .emacs to enable hi-lock for all buffers,
309use (hi-lock-mode 1) for individual buffers. For compatibility with Emacs
310versions before 22 use the following in your .emacs file:
311
312 (if (functionp 'global-hi-lock-mode)
313 (global-hi-lock-mode 1)
314 (hi-lock-mode 1))
315")))
316 (if hi-lock-mode
287 ;; Turned on. 317 ;; Turned on.
288 (progn 318 (progn
289 (unless font-lock-mode (font-lock-mode 1)) 319 (unless font-lock-mode (font-lock-mode 1))
@@ -294,7 +324,7 @@ is found. A mode is excluded if it's in the list `hi-lock-exclude-modes'."
294 ;; Turned off. 324 ;; Turned off.
295 (when (or hi-lock-interactive-patterns 325 (when (or hi-lock-interactive-patterns
296 hi-lock-file-patterns) 326 hi-lock-file-patterns)
297 (when hi-lock-interactive-patterns 327 (when hi-lock-interactive-patterns
298 (font-lock-remove-keywords nil hi-lock-interactive-patterns) 328 (font-lock-remove-keywords nil hi-lock-interactive-patterns)
299 (setq hi-lock-interactive-patterns nil)) 329 (setq hi-lock-interactive-patterns nil))
300 (when hi-lock-file-patterns 330 (when hi-lock-file-patterns
@@ -306,13 +336,14 @@ is found. A mode is excluded if it's in the list `hi-lock-exclude-modes'."
306 (remove-hook 'font-lock-mode-hook 'hi-lock-font-lock-hook t))) 336 (remove-hook 'font-lock-mode-hook 'hi-lock-font-lock-hook t)))
307 337
308;;;###autoload 338;;;###autoload
309(define-global-minor-mode hi-lock-mode 339(define-global-minor-mode global-hi-lock-mode
310 hi-lock-buffer-mode turn-on-hi-lock-if-enabled 340 hi-lock-mode turn-on-hi-lock-if-enabled
311 :group 'hi-lock) 341 :group 'hi-lock)
312 342
313(defun turn-on-hi-lock-if-enabled () 343(defun turn-on-hi-lock-if-enabled ()
344 (setq hi-lock-archaic-interface-message-used t)
314 (unless (memq major-mode hi-lock-exclude-modes) 345 (unless (memq major-mode hi-lock-exclude-modes)
315 (hi-lock-buffer-mode 1))) 346 (hi-lock-mode 1)))
316 347
317;;;###autoload 348;;;###autoload
318(defalias 'highlight-lines-matching-regexp 'hi-lock-line-face-buffer) 349(defalias 'highlight-lines-matching-regexp 'hi-lock-line-face-buffer)
@@ -332,7 +363,7 @@ list maintained for regexps, global history maintained for faces.
332 nil nil 'hi-lock-regexp-history)) 363 nil nil 'hi-lock-regexp-history))
333 (hi-lock-read-face-name))) 364 (hi-lock-read-face-name)))
334 (or (facep face) (setq face 'hi-yellow)) 365 (or (facep face) (setq face 'hi-yellow))
335 (unless hi-lock-buffer-mode (hi-lock-buffer-mode 1)) 366 (unless hi-lock-mode (hi-lock-mode 1))
336 (hi-lock-set-pattern 367 (hi-lock-set-pattern
337 ;; The \\(?:...\\) grouping construct ensures that a leading ^, +, * or ? 368 ;; The \\(?:...\\) grouping construct ensures that a leading ^, +, * or ?
338 ;; or a trailing $ in REGEXP will be interpreted correctly. 369 ;; or a trailing $ in REGEXP will be interpreted correctly.
@@ -357,7 +388,7 @@ list maintained for regexps, global history maintained for faces.
357 nil nil 'hi-lock-regexp-history)) 388 nil nil 'hi-lock-regexp-history))
358 (hi-lock-read-face-name))) 389 (hi-lock-read-face-name)))
359 (or (facep face) (setq face 'hi-yellow)) 390 (or (facep face) (setq face 'hi-yellow))
360 (unless hi-lock-buffer-mode (hi-lock-buffer-mode 1)) 391 (unless hi-lock-mode (hi-lock-mode 1))
361 (hi-lock-set-pattern regexp face)) 392 (hi-lock-set-pattern regexp face))
362 393
363;;;###autoload 394;;;###autoload
@@ -377,7 +408,7 @@ lower-case letters made case insensitive."
377 nil nil 'hi-lock-regexp-history))) 408 nil nil 'hi-lock-regexp-history)))
378 (hi-lock-read-face-name))) 409 (hi-lock-read-face-name)))
379 (or (facep face) (setq face 'hi-yellow)) 410 (or (facep face) (setq face 'hi-yellow))
380 (unless hi-lock-buffer-mode (hi-lock-buffer-mode 1)) 411 (unless hi-lock-mode (hi-lock-mode 1))
381 (hi-lock-set-pattern regexp face)) 412 (hi-lock-set-pattern regexp face))
382 413
383;;;###autoload 414;;;###autoload
@@ -535,7 +566,7 @@ not suitable."
535 (setq all-patterns (append (read (current-buffer)) all-patterns)) 566 (setq all-patterns (append (read (current-buffer)) all-patterns))
536 (error (message "Invalid pattern list expression at %d" 567 (error (message "Invalid pattern list expression at %d"
537 (line-number-at-pos))))))) 568 (line-number-at-pos)))))))
538 (when hi-lock-buffer-mode (hi-lock-set-file-patterns all-patterns)) 569 (when hi-lock-mode (hi-lock-set-file-patterns all-patterns))
539 (if (interactive-p) 570 (if (interactive-p)
540 (message "Hi-lock added %d patterns." (length all-patterns)))))) 571 (message "Hi-lock added %d patterns." (length all-patterns))))))
541 572
@@ -544,7 +575,7 @@ not suitable."
544 (if font-lock-mode 575 (if font-lock-mode
545 (progn (font-lock-add-keywords nil hi-lock-file-patterns) 576 (progn (font-lock-add-keywords nil hi-lock-file-patterns)
546 (font-lock-add-keywords nil hi-lock-interactive-patterns)) 577 (font-lock-add-keywords nil hi-lock-interactive-patterns))
547 (hi-lock-buffer-mode -1))) 578 (hi-lock-mode -1)))
548 579
549(provide 'hi-lock) 580(provide 'hi-lock)
550 581