aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2005-12-23 16:45:05 +0000
committerJuri Linkov2005-12-23 16:45:05 +0000
commit907560871c3579c3055fec3d07b2c0443fa52768 (patch)
tree54b734e7180affdd07ed0fe01145d10bea0f50f8
parent6149bbfbf8d9f3ef2f616a6a2835624cc7dd98e3 (diff)
downloademacs-907560871c3579c3055fec3d07b2c0443fa52768.tar.gz
emacs-907560871c3579c3055fec3d07b2c0443fa52768.zip
(hi-lock-archaic-interface-message-used)
(hi-lock-archaic-interface-deduce, hi-lock-mode): Doc fix. (hi-lock-mode): Display "Hi" in the mode line only when hi-lock-interactive-patterns or hi-lock-file-patterns is non-nil. (hi-lock-write-interactive-patterns): Use hi-lock-file-patterns-prefix instead of hard-coded "Hi-lock". (hi-lock-set-pattern, hi-lock-set-file-patterns) (hi-lock-font-lock-hook): Set 3rd arg `how' of font-lock-add-keywords to t.
-rw-r--r--lisp/hi-lock.el36
1 files changed, 20 insertions, 16 deletions
diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el
index 03f4a265bab..956ae3a6798 100644
--- a/lisp/hi-lock.el
+++ b/lisp/hi-lock.el
@@ -199,14 +199,14 @@ calls."
199 "Regexp for finding hi-lock patterns at top of file.") 199 "Regexp for finding hi-lock patterns at top of file.")
200 200
201(defvar hi-lock-archaic-interface-message-used nil 201(defvar hi-lock-archaic-interface-message-used nil
202 "True if user alerted that global-hi-lock-mode is now the global switch. 202 "True if user alerted that `global-hi-lock-mode' is now the global switch.
203Earlier versions of hi-lock used hi-lock-mode as the global switch, 203Earlier versions of hi-lock used `hi-lock-mode' as the global switch,
204the message is issued if it appears that hi-lock-mode is used assuming 204the message is issued if it appears that `hi-lock-mode' is used assuming
205that older functionality. This variable avoids multiple reminders.") 205that older functionality. This variable avoids multiple reminders.")
206 206
207(defvar hi-lock-archaic-interface-deduce nil 207(defvar hi-lock-archaic-interface-deduce nil
208 "If non-nil, sometimes assume that hi-lock-mode means global-hi-lock-mode. 208 "If non-nil, sometimes assume that `hi-lock-mode' means `global-hi-lock-mode'.
209Assumption is made if hi-lock-mode used in the *scratch* buffer while 209Assumption is made if `hi-lock-mode' used in the *scratch* buffer while
210a library is being loaded.") 210a library is being loaded.")
211 211
212(make-variable-buffer-local 'hi-lock-interactive-patterns) 212(make-variable-buffer-local 'hi-lock-interactive-patterns)
@@ -257,14 +257,13 @@ a library is being loaded.")
257 257
258;; Visible Functions 258;; Visible Functions
259 259
260
261;;;###autoload 260;;;###autoload
262(define-minor-mode hi-lock-mode 261(define-minor-mode hi-lock-mode
263 "Toggle minor mode for interactively adding font-lock highlighting patterns. 262 "Toggle minor mode for interactively adding font-lock highlighting patterns.
264 263
265If ARG positive turn hi-lock on. Issuing a hi-lock command will also 264If ARG positive, turn hi-lock on. Issuing a hi-lock command will also
266turn hi-lock on; to turn hi-lock on in all buffers use 265turn hi-lock on. To turn hi-lock on in all buffers use
267global-hi-lock-mode or in your .emacs file (global-hi-lock-mode 1). 266`global-hi-lock-mode' or in your .emacs file (global-hi-lock-mode 1).
268When hi-lock is turned on, a \"Regexp Highlighting\" submenu is added 267When hi-lock is turned on, a \"Regexp Highlighting\" submenu is added
269to the \"Edit\" menu. The commands in the submenu, which can be 268to the \"Edit\" menu. The commands in the submenu, which can be
270called interactively, are: 269called interactively, are:
@@ -303,7 +302,9 @@ will be read until
303 Hi-lock: end 302 Hi-lock: end
304is found. A mode is excluded if it's in the list `hi-lock-exclude-modes'." 303is found. A mode is excluded if it's in the list `hi-lock-exclude-modes'."
305 :group 'hi-lock 304 :group 'hi-lock
306 :lighter " H" 305 :lighter (:eval (if (or hi-lock-interactive-patterns
306 hi-lock-file-patterns)
307 " Hi" ""))
307 :global nil 308 :global nil
308 :keymap hi-lock-map 309 :keymap hi-lock-map
309 (when (and (equal (buffer-name) "*scratch*") 310 (when (and (equal (buffer-name) "*scratch*")
@@ -316,7 +317,7 @@ is found. A mode is excluded if it's in the list `hi-lock-exclude-modes'."
316 (warn 317 (warn
317 "Possible archaic use of (hi-lock-mode). 318 "Possible archaic use of (hi-lock-mode).
318Use (global-hi-lock-mode 1) in .emacs to enable hi-lock for all buffers, 319Use (global-hi-lock-mode 1) in .emacs to enable hi-lock for all buffers,
319use (hi-lock-mode 1) for individual buffers. For compatibility with Emacs 320use (hi-lock-mode 1) for individual buffers. For compatibility with Emacs
320versions before 22 use the following in your .emacs file: 321versions before 22 use the following in your .emacs file:
321 322
322 (if (functionp 'global-hi-lock-mode) 323 (if (functionp 'global-hi-lock-mode)
@@ -488,7 +489,9 @@ be found in variable `hi-lock-interactive-patterns'."
488 (let ((beg (point))) 489 (let ((beg (point)))
489 (mapcar 490 (mapcar
490 (lambda (pattern) 491 (lambda (pattern)
491 (insert (format "Hi-lock: (%s)\n" (prin1-to-string pattern)))) 492 (insert (format "%s: (%s)\n"
493 hi-lock-file-patterns-prefix
494 (prin1-to-string pattern))))
492 hi-lock-interactive-patterns) 495 hi-lock-interactive-patterns)
493 (comment-region beg (point))) 496 (comment-region beg (point)))
494 (when (> (point) hi-lock-file-patterns-range) 497 (when (> (point) hi-lock-file-patterns-range)
@@ -538,7 +541,7 @@ not suitable."
538 "Highlight REGEXP with face FACE." 541 "Highlight REGEXP with face FACE."
539 (let ((pattern (list regexp (list 0 (list 'quote face) t)))) 542 (let ((pattern (list regexp (list 0 (list 'quote face) t))))
540 (unless (member pattern hi-lock-interactive-patterns) 543 (unless (member pattern hi-lock-interactive-patterns)
541 (font-lock-add-keywords nil (list pattern)) 544 (font-lock-add-keywords nil (list pattern) t)
542 (push pattern hi-lock-interactive-patterns) 545 (push pattern hi-lock-interactive-patterns)
543 (if font-lock-fontified 546 (if font-lock-fontified
544 (font-lock-fontify-buffer) 547 (font-lock-fontify-buffer)
@@ -565,7 +568,7 @@ not suitable."
565 (when (or hi-lock-file-patterns patterns) 568 (when (or hi-lock-file-patterns patterns)
566 (font-lock-remove-keywords nil hi-lock-file-patterns) 569 (font-lock-remove-keywords nil hi-lock-file-patterns)
567 (setq hi-lock-file-patterns patterns) 570 (setq hi-lock-file-patterns patterns)
568 (font-lock-add-keywords nil hi-lock-file-patterns) 571 (font-lock-add-keywords nil hi-lock-file-patterns t)
569 (font-lock-fontify-buffer))) 572 (font-lock-fontify-buffer)))
570 573
571(defun hi-lock-find-patterns () 574(defun hi-lock-find-patterns ()
@@ -594,8 +597,9 @@ not suitable."
594(defun hi-lock-font-lock-hook () 597(defun hi-lock-font-lock-hook ()
595 "Add hi lock patterns to font-lock's." 598 "Add hi lock patterns to font-lock's."
596 (if font-lock-mode 599 (if font-lock-mode
597 (progn (font-lock-add-keywords nil hi-lock-file-patterns) 600 (progn
598 (font-lock-add-keywords nil hi-lock-interactive-patterns)) 601 (font-lock-add-keywords nil hi-lock-file-patterns t)
602 (font-lock-add-keywords nil hi-lock-interactive-patterns t))
599 (hi-lock-mode -1))) 603 (hi-lock-mode -1)))
600 604
601(defvar hi-lock-string-serialize-hash 605(defvar hi-lock-string-serialize-hash