diff options
| author | Juri Linkov | 2008-06-30 19:36:38 +0000 |
|---|---|---|
| committer | Juri Linkov | 2008-06-30 19:36:38 +0000 |
| commit | ef705f25740224b52e27ceb66841b48cba23ad9b (patch) | |
| tree | 18bed3dea650107151f34b61fc8def8f77c86334 | |
| parent | 2aef0850e72139f56c925971ef539dceec6646be (diff) | |
| download | emacs-ef705f25740224b52e27ceb66841b48cba23ad9b.tar.gz emacs-ef705f25740224b52e27ceb66841b48cba23ad9b.zip | |
(hi-lock-regexp-history): Make it an obsolete alias
to `regexp-history'.
(hi-lock-face-history): Rename to `hi-lock-face-defaults' and
make it an obsolete alias to it.
(hi-lock-face-defaults): New variable renamed from
`hi-lock-face-history'.
(hi-lock-line-face-buffer, hi-lock-face-buffer)
(hi-lock-face-phrase-buffer): Use `read-regexp' instead of
`read-from-minibuffer'. Doc fix.
(hi-lock-read-face-name): Replace `hi-lock-face-history' with
`hi-lock-face-defaults'. Remove `mapcar (lambda (f) (cons f f))'.
Set `hist' arg of `completing-read' to `face-name-history'.
Put a list of default faces to `default' arg instead of `hist' arg.
| -rw-r--r-- | lisp/hi-lock.el | 53 |
1 files changed, 25 insertions, 28 deletions
diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el index 7226433c80c..ca74d6f0a8d 100644 --- a/lisp/hi-lock.el +++ b/lisp/hi-lock.el | |||
| @@ -206,15 +206,20 @@ patterns." | |||
| 206 | (defvar hi-lock-interactive-patterns nil | 206 | (defvar hi-lock-interactive-patterns nil |
| 207 | "Patterns provided to hi-lock by user. Should not be changed.") | 207 | "Patterns provided to hi-lock by user. Should not be changed.") |
| 208 | 208 | ||
| 209 | (defvar hi-lock-face-history | 209 | (defvar hi-lock-face-defaults |
| 210 | (list "hi-yellow" "hi-pink" "hi-green" "hi-blue" "hi-black-b" | 210 | '("hi-yellow" "hi-pink" "hi-green" "hi-blue" "hi-black-b" |
| 211 | "hi-blue-b" "hi-red-b" "hi-green-b" "hi-black-hb") | 211 | "hi-blue-b" "hi-red-b" "hi-green-b" "hi-black-hb") |
| 212 | "History list of faces for hi-lock interactive functions.") | 212 | "Default faces for hi-lock interactive functions.") |
| 213 | 213 | ||
| 214 | ;(dolist (f hi-lock-face-history) (unless (facep f) (error "%s not a face" f))) | 214 | ;(dolist (f hi-lock-face-defaults) (unless (facep f) (error "%s not a face" f))) |
| 215 | 215 | ||
| 216 | (defvar hi-lock-regexp-history nil | 216 | (define-obsolete-variable-alias 'hi-lock-face-history |
| 217 | "History of regexps used for interactive fontification.") | 217 | 'hi-lock-face-defaults |
| 218 | "23.1") | ||
| 219 | |||
| 220 | (define-obsolete-variable-alias 'hi-lock-regexp-history | ||
| 221 | 'regexp-history | ||
| 222 | "23.1") | ||
| 218 | 223 | ||
| 219 | (defvar hi-lock-file-patterns-prefix "Hi-lock" | 224 | (defvar hi-lock-file-patterns-prefix "Hi-lock" |
| 220 | "Search target for finding hi-lock patterns at top of file.") | 225 | "Search target for finding hi-lock patterns at top of file.") |
| @@ -232,8 +237,6 @@ a library is being loaded.") | |||
| 232 | 237 | ||
| 233 | (make-variable-buffer-local 'hi-lock-interactive-patterns) | 238 | (make-variable-buffer-local 'hi-lock-interactive-patterns) |
| 234 | (put 'hi-lock-interactive-patterns 'permanent-local t) | 239 | (put 'hi-lock-interactive-patterns 'permanent-local t) |
| 235 | (make-variable-buffer-local 'hi-lock-regexp-history) | ||
| 236 | (put 'hi-lock-regexp-history 'permanent-local t) | ||
| 237 | (make-variable-buffer-local 'hi-lock-file-patterns) | 240 | (make-variable-buffer-local 'hi-lock-file-patterns) |
| 238 | (put 'hi-lock-file-patterns 'permanent-local t) | 241 | (put 'hi-lock-file-patterns 'permanent-local t) |
| 239 | 242 | ||
| @@ -390,14 +393,12 @@ versions before 22 use the following in your .emacs file: | |||
| 390 | 393 | ||
| 391 | Interactively, prompt for REGEXP then FACE. Buffer-local history | 394 | Interactively, prompt for REGEXP then FACE. Buffer-local history |
| 392 | list maintained for regexps, global history maintained for faces. | 395 | list maintained for regexps, global history maintained for faces. |
| 393 | \\<minibuffer-local-map>Use \\[next-history-element] and \\[previous-history-element] to retrieve next or previous history item. | 396 | \\<minibuffer-local-map>Use \\[previous-history-element] to retrieve previous history items, |
| 397 | and \\[next-history-element] to retrieve default values. | ||
| 394 | \(See info node `Minibuffer History'.)" | 398 | \(See info node `Minibuffer History'.)" |
| 395 | (interactive | 399 | (interactive |
| 396 | (list | 400 | (list |
| 397 | (hi-lock-regexp-okay | 401 | (hi-lock-regexp-okay (read-regexp "Regexp to highlight line")) |
| 398 | (read-from-minibuffer "Regexp to highlight line: " | ||
| 399 | (cons (or (car hi-lock-regexp-history) "") 1 ) | ||
| 400 | nil nil 'hi-lock-regexp-history)) | ||
| 401 | (hi-lock-read-face-name))) | 402 | (hi-lock-read-face-name))) |
| 402 | (or (facep face) (setq face 'hi-yellow)) | 403 | (or (facep face) (setq face 'hi-yellow)) |
| 403 | (unless hi-lock-mode (hi-lock-mode 1)) | 404 | (unless hi-lock-mode (hi-lock-mode 1)) |
| @@ -415,14 +416,12 @@ list maintained for regexps, global history maintained for faces. | |||
| 415 | 416 | ||
| 416 | Interactively, prompt for REGEXP then FACE. Buffer-local history | 417 | Interactively, prompt for REGEXP then FACE. Buffer-local history |
| 417 | list maintained for regexps, global history maintained for faces. | 418 | list maintained for regexps, global history maintained for faces. |
| 418 | \\<minibuffer-local-map>Use \\[next-history-element] and \\[previous-history-element] to retrieve next or previous history item. | 419 | \\<minibuffer-local-map>Use \\[previous-history-element] to retrieve previous history items, |
| 420 | and \\[next-history-element] to retrieve default values. | ||
| 419 | \(See info node `Minibuffer History'.)" | 421 | \(See info node `Minibuffer History'.)" |
| 420 | (interactive | 422 | (interactive |
| 421 | (list | 423 | (list |
| 422 | (hi-lock-regexp-okay | 424 | (hi-lock-regexp-okay (read-regexp "Regexp to highlight")) |
| 423 | (read-from-minibuffer "Regexp to highlight: " | ||
| 424 | (cons (or (car hi-lock-regexp-history) "") 1 ) | ||
| 425 | nil nil 'hi-lock-regexp-history)) | ||
| 426 | (hi-lock-read-face-name))) | 425 | (hi-lock-read-face-name))) |
| 427 | (or (facep face) (setq face 'hi-yellow)) | 426 | (or (facep face) (setq face 'hi-yellow)) |
| 428 | (unless hi-lock-mode (hi-lock-mode 1)) | 427 | (unless hi-lock-mode (hi-lock-mode 1)) |
| @@ -440,9 +439,7 @@ lower-case letters made case insensitive." | |||
| 440 | (list | 439 | (list |
| 441 | (hi-lock-regexp-okay | 440 | (hi-lock-regexp-okay |
| 442 | (hi-lock-process-phrase | 441 | (hi-lock-process-phrase |
| 443 | (read-from-minibuffer "Phrase to highlight: " | 442 | (read-regexp "Phrase to highlight"))) |
| 444 | (cons (or (car hi-lock-regexp-history) "") 1 ) | ||
| 445 | nil nil 'hi-lock-regexp-history))) | ||
| 446 | (hi-lock-read-face-name))) | 443 | (hi-lock-read-face-name))) |
| 447 | (or (facep face) (setq face 'hi-yellow)) | 444 | (or (facep face) (setq face 'hi-yellow)) |
| 448 | (unless hi-lock-mode (hi-lock-mode 1)) | 445 | (unless hi-lock-mode (hi-lock-mode 1)) |
| @@ -552,16 +549,16 @@ not suitable." | |||
| 552 | (intern (completing-read | 549 | (intern (completing-read |
| 553 | "Highlight using face: " | 550 | "Highlight using face: " |
| 554 | obarray 'facep t | 551 | obarray 'facep t |
| 555 | (cons (car hi-lock-face-history) | 552 | (cons (car hi-lock-face-defaults) |
| 556 | (let ((prefix | 553 | (let ((prefix |
| 557 | (try-completion | 554 | (try-completion |
| 558 | (substring (car hi-lock-face-history) 0 1) | 555 | (substring (car hi-lock-face-defaults) 0 1) |
| 559 | (mapcar (lambda (f) (cons f f)) | 556 | hi-lock-face-defaults))) |
| 560 | hi-lock-face-history)))) | ||
| 561 | (if (and (stringp prefix) | 557 | (if (and (stringp prefix) |
| 562 | (not (equal prefix (car hi-lock-face-history)))) | 558 | (not (equal prefix (car hi-lock-face-defaults)))) |
| 563 | (length prefix) 0))) | 559 | (length prefix) 0))) |
| 564 | '(hi-lock-face-history . 0)))) | 560 | 'face-name-history |
| 561 | (cdr hi-lock-face-defaults)))) | ||
| 565 | 562 | ||
| 566 | (defun hi-lock-set-pattern (regexp face) | 563 | (defun hi-lock-set-pattern (regexp face) |
| 567 | "Highlight REGEXP with face FACE." | 564 | "Highlight REGEXP with face FACE." |