;;; hi-lock.el --- minor mode for interactive automatic highlighting
-;; Copyright (C) 2000, 2001, 2002, 2003, 2004,
-;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+;; 2008, 2009, 2010 Free Software Foundation, Inc.
-;; Author: David M. Koppelman, koppel@ece.lsu.edu
+;; Author: David M. Koppelman <koppel@ece.lsu.edu>
;; Keywords: faces, minor-mode, matching, display
;; This file is part of GNU Emacs.
(define-key-after hi-lock-menu [highlight-lines-matching-regexp]
'(menu-item "Highlight Lines..." highlight-lines-matching-regexp
- :help "Highlight lines containing match of PATTERN (a regexp).."))
+ :help "Highlight lines containing match of PATTERN (a regexp)."))
(define-key-after hi-lock-menu [unhighlight-regexp]
'(menu-item "Remove Highlighting..." unhighlight-regexp
:keymap hi-lock-map
(when (and (equal (buffer-name) "*scratch*")
load-in-progress
- (not (interactive-p))
+ (not (called-interactively-p 'interactive))
(not hi-lock-archaic-interface-message-used))
(setq hi-lock-archaic-interface-message-used t)
(if hi-lock-archaic-interface-deduce
(unless hi-lock-mode (hi-lock-mode 1))
(hi-lock-set-pattern regexp face))
-(declare-function x-popup-menu "xmenu.c" (position menu))
+(declare-function x-popup-menu "menu.c" (position menu))
;;;###autoload
(defalias 'unhighlight-regexp 'hi-lock-unface-buffer)
"Highlight REGEXP with face FACE."
(let ((pattern (list regexp (list 0 (list 'quote face) t))))
(unless (member pattern hi-lock-interactive-patterns)
- (font-lock-add-keywords nil (list pattern) t)
(push pattern hi-lock-interactive-patterns)
(if font-lock-fontified
- (font-lock-fontify-buffer)
+ (progn
+ (font-lock-add-keywords nil (list pattern) t)
+ (font-lock-fontify-buffer))
(let* ((serial (hi-lock-string-serialize regexp))
(range-min (- (point) (/ hi-lock-highlight-range 2)))
(range-max (+ (point) (/ hi-lock-highlight-range 2)))
(y-or-n-p "Add patterns from this buffer to hi-lock? "))
(t nil)))
(hi-lock-set-file-patterns all-patterns)
- (if (interactive-p)
+ (if (called-interactively-p 'interactive)
(message "Hi-lock added %d patterns." (length all-patterns)))))))
(defun hi-lock-font-lock-hook ()
"Add hi-lock patterns to font-lock's."
- (if font-lock-mode
- (progn
- (font-lock-add-keywords nil hi-lock-file-patterns t)
- (font-lock-add-keywords nil hi-lock-interactive-patterns t))
- (hi-lock-mode -1)))
+ (when font-lock-fontified
+ (font-lock-add-keywords nil hi-lock-file-patterns t)
+ (font-lock-add-keywords nil hi-lock-interactive-patterns t)))
(defvar hi-lock-string-serialize-hash
(make-hash-table :test 'equal)