286 |
(if hi-lock-buffer-mode |
(if hi-lock-buffer-mode |
287 |
;; Turned on. |
;; Turned on. |
288 |
(progn |
(progn |
289 |
|
(unless font-lock-mode (font-lock-mode 1)) |
290 |
(define-key-after menu-bar-edit-menu [hi-lock] |
(define-key-after menu-bar-edit-menu [hi-lock] |
291 |
(cons "Regexp Highlighting" hi-lock-menu)) |
(cons "Regexp Highlighting" hi-lock-menu)) |
292 |
(hi-lock-find-patterns) |
(hi-lock-find-patterns) |
293 |
(add-hook 'font-lock-mode-hook 'hi-lock-font-lock-hook t)) |
(add-hook 'font-lock-mode-hook 'hi-lock-font-lock-hook nil t)) |
294 |
;; Turned off. |
;; Turned off. |
295 |
(when hi-lock-interactive-patterns |
(when (or hi-lock-interactive-patterns |
296 |
(font-lock-remove-keywords nil hi-lock-interactive-patterns) |
hi-lock-file-patterns) |
297 |
(setq hi-lock-interactive-patterns nil)) |
(when hi-lock-interactive-patterns |
298 |
(when hi-lock-file-patterns |
(font-lock-remove-keywords nil hi-lock-interactive-patterns) |
299 |
(font-lock-remove-keywords nil hi-lock-file-patterns) |
(setq hi-lock-interactive-patterns nil)) |
300 |
(setq hi-lock-file-patterns nil)) |
(when hi-lock-file-patterns |
301 |
(hi-lock-refontify) |
(font-lock-remove-keywords nil hi-lock-file-patterns) |
302 |
|
(setq hi-lock-file-patterns nil)) |
303 |
|
(if font-lock-mode |
304 |
|
(font-lock-fontify-buffer))) |
305 |
(define-key-after menu-bar-edit-menu [hi-lock] nil) |
(define-key-after menu-bar-edit-menu [hi-lock] nil) |
306 |
(remove-hook 'font-lock-mode-hook 'hi-lock-font-lock-hook t))) |
(remove-hook 'font-lock-mode-hook 'hi-lock-font-lock-hook t))) |
307 |
|
|
430 |
(font-lock-remove-keywords nil (list keyword)) |
(font-lock-remove-keywords nil (list keyword)) |
431 |
(setq hi-lock-interactive-patterns |
(setq hi-lock-interactive-patterns |
432 |
(delq keyword hi-lock-interactive-patterns)) |
(delq keyword hi-lock-interactive-patterns)) |
433 |
(hi-lock-refontify)))) |
(font-lock-fontify-buffer)))) |
434 |
|
|
435 |
;;;###autoload |
;;;###autoload |
436 |
(defun hi-lock-write-interactive-patterns () |
(defun hi-lock-write-interactive-patterns () |
515 |
(font-lock-remove-keywords nil hi-lock-file-patterns) |
(font-lock-remove-keywords nil hi-lock-file-patterns) |
516 |
(setq hi-lock-file-patterns patterns) |
(setq hi-lock-file-patterns patterns) |
517 |
(font-lock-add-keywords nil hi-lock-file-patterns) |
(font-lock-add-keywords nil hi-lock-file-patterns) |
518 |
(hi-lock-refontify))) |
(font-lock-fontify-buffer))) |
|
|
|
|
(defun hi-lock-refontify () |
|
|
"Unfontify then refontify buffer. Used when hi-lock patterns change." |
|
|
(interactive) |
|
|
(if font-lock-mode |
|
|
(font-lock-fontify-buffer))) |
|
519 |
|
|
520 |
(defun hi-lock-find-patterns () |
(defun hi-lock-find-patterns () |
521 |
"Find patterns in current buffer for hi-lock." |
"Find patterns in current buffer for hi-lock." |
542 |
|
|
543 |
(defun hi-lock-font-lock-hook () |
(defun hi-lock-font-lock-hook () |
544 |
"Add hi lock patterns to font-lock's." |
"Add hi lock patterns to font-lock's." |
545 |
(when font-lock-mode |
(if font-lock-mode |
546 |
(font-lock-add-keywords nil hi-lock-file-patterns) |
(progn (font-lock-add-keywords nil hi-lock-file-patterns) |
547 |
(font-lock-add-keywords nil hi-lock-interactive-patterns))) |
(font-lock-add-keywords nil hi-lock-interactive-patterns)) |
548 |
|
(hi-lock-buffer-mode -1))) |
549 |
|
|
550 |
(provide 'hi-lock) |
(provide 'hi-lock) |
551 |
|
|