comparison lisp/hi-lock.el @ 35779:1619fb3fdfa4

(hi-lock-mode, hi-lock-line-face-buffer): Doc fix. (hi-lock-find-patterns): Turn on font-lock-mode, if it is not on already.
author Gerd Moellmann <gerd@gnu.org>
date Wed, 31 Jan 2001 15:10:34 +0000
parents 2be11f207ca8
children d2997845573f
comparison
equal deleted inserted replaced
35778:08937734f627 35779:1619fb3fdfa4
1 ;;; hi-lock.el --- Minor mode for interactive automatic highlighting. 1 ;;; hi-lock.el --- Minor mode for interactive automatic highlighting.
2 2
3 ;; Copyright (C) 2000 Free Software Foundation, Inc. 3 ;; Copyright (C) 2000, 2001 Free Software Foundation, Inc.
4 4
5 ;; Author: David M. Koppelman, koppel@ee.lsu.edu 5 ;; Author: David M. Koppelman, koppel@ee.lsu.edu
6 ;; Keywords: faces, minor-mode, matching, display 6 ;; Keywords: faces, minor-mode, matching, display
7 7
8 ;; This file is part of GNU Emacs. 8 ;; This file is part of GNU Emacs.
241 ;;;###autoload 241 ;;;###autoload
242 (defun hi-lock-mode (&optional arg) 242 (defun hi-lock-mode (&optional arg)
243 "Toggle minor mode for interactively adding font-lock highlighting patterns. 243 "Toggle minor mode for interactively adding font-lock highlighting patterns.
244 244
245 If ARG positive turn hi-lock on. Issuing a hi-lock command will also 245 If ARG positive turn hi-lock on. Issuing a hi-lock command will also
246 turn hi-lock on. When hi-lock turned on an \"Automatic Highlighting\" 246 turn hi-lock on. When hi-lock is turned on an \"Automatic Highlighting\"
247 submenu is added to the \"Edit\" menu. The commands in the submenu, 247 submenu is added to the \"Edit\" menu. The commands in the submenu,
248 which can be called interactively, are: 248 which can be called interactively, are:
249 249
250 \\[highlight-regexp] REGEXP FACE 250 \\[highlight-regexp] REGEXP FACE
251 Highlight matches of pattern REGEXP in current buffer with FACE. 251 Highlight matches of pattern REGEXP in current buffer with FACE.
306 "Set face of all lines containing matches of REGEXP to FACE. 306 "Set face of all lines containing matches of REGEXP to FACE.
307 307
308 Interactively, prompt for REGEXP then FACE. Buffer-local history 308 Interactively, prompt for REGEXP then FACE. Buffer-local history
309 list maintained for regexps, global history maintained for faces. 309 list maintained for regexps, global history maintained for faces.
310 \\<minibuffer-local-map>Use \\[next-history-element] and \\[previous-history-element] to retrieve next or previous history item. 310 \\<minibuffer-local-map>Use \\[next-history-element] and \\[previous-history-element] to retrieve next or previous history item.
311 (See info node `Minibuffer History')" 311 \(See info node `Minibuffer History')"
312 (interactive 312 (interactive
313 (list 313 (list
314 (hi-lock-regexp-okay 314 (hi-lock-regexp-okay
315 (read-from-minibuffer "Regexp to highlight line: " 315 (read-from-minibuffer "Regexp to highlight line: "
316 (cons (or (car hi-lock-regexp-history) "") 1 ) 316 (cons (or (car hi-lock-regexp-history) "") 1 )
328 "Set face of all matches of REGEXP to FACE. 328 "Set face of all matches of REGEXP to FACE.
329 329
330 Interactively, prompt for REGEXP then FACE. Buffer-local history 330 Interactively, prompt for REGEXP then FACE. Buffer-local history
331 list maintained for regexps, global history maintained for faces. 331 list maintained for regexps, global history maintained for faces.
332 \\<minibuffer-local-map>Use \\[next-history-element] and \\[previous-history-element] to retrieve next or previous history item. 332 \\<minibuffer-local-map>Use \\[next-history-element] and \\[previous-history-element] to retrieve next or previous history item.
333 (See info node `Minibuffer History')" 333 \(See info node `Minibuffer History')"
334 (interactive 334 (interactive
335 (list 335 (list
336 (hi-lock-regexp-okay 336 (hi-lock-regexp-okay
337 (read-from-minibuffer "Regexp to highlight: " 337 (read-from-minibuffer "Regexp to highlight: "
338 (cons (or (car hi-lock-regexp-history) "") 1 ) 338 (cons (or (car hi-lock-regexp-history) "") 1 )
512 (hi-lock-current-line))) nil)))) 512 (hi-lock-current-line))) nil))))
513 (if patterns 513 (if patterns
514 (setq all-patterns (append patterns all-patterns)))))) 514 (setq all-patterns (append patterns all-patterns))))))
515 (if (and (not hi-lock-mode) all-patterns) 515 (if (and (not hi-lock-mode) all-patterns)
516 (hi-lock-mode 1)) 516 (hi-lock-mode 1))
517 (unless font-lock-mode (font-lock-mode))
517 (if hi-lock-mode (hi-lock-set-file-patterns all-patterns)) 518 (if hi-lock-mode (hi-lock-set-file-patterns all-patterns))
518 (if (interactive-p) 519 (if (interactive-p)
519 (message (format "Hi-lock added %d patterns." (length all-patterns))))))) 520 (message (format "Hi-lock added %d patterns." (length all-patterns)))))))
520 521
521 (defun hi-lock-font-lock-hook () 522 (defun hi-lock-font-lock-hook ()