emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/hi-lock.el


From: Eli Zaretskii
Subject: [Emacs-diffs] Changes to emacs/lisp/hi-lock.el
Date: Sat, 10 Dec 2005 06:47:28 -0500

Index: emacs/lisp/hi-lock.el
diff -c emacs/lisp/hi-lock.el:1.34 emacs/lisp/hi-lock.el:1.35
*** emacs/lisp/hi-lock.el:1.34  Tue Nov 29 22:28:59 2005
--- emacs/lisp/hi-lock.el       Sat Dec 10 11:47:28 2005
***************
*** 58,64 ****
  ;;    hi-lock mode and adds a "Regexp Highlighting" entry
  ;;    to the edit menu.
  ;;
! ;;    (hi-lock-mode 1)
  ;;
  ;;    You might also want to bind the hi-lock commands to more
  ;;    finger-friendly sequences:
--- 58,64 ----
  ;;    hi-lock mode and adds a "Regexp Highlighting" entry
  ;;    to the edit menu.
  ;;
! ;;    (global-hi-lock-mode 1)
  ;;
  ;;    You might also want to bind the hi-lock commands to more
  ;;    finger-friendly sequences:
***************
*** 188,193 ****
--- 188,204 ----
  (defvar hi-lock-file-patterns-prefix "Hi-lock"
    "Regexp for finding hi-lock patterns at top of file.")
  
+ (defvar hi-lock-archaic-interface-message-used nil
+   "True if user alerted that global-hi-lock-mode is now the global switch.
+ Earlier versions of hi-lock used hi-lock-mode as the global switch,
+ the message is issued if it appears that hi-lock-mode is used assuming
+ that older functionality.  This variable avoids multiple reminders.")
+ 
+ (defvar hi-lock-archaic-interface-deduce nil
+   "If non-nil, sometimes assume that hi-lock-mode means global-hi-lock-mode.
+ Assumption is made if hi-lock-mode used in the *scratch* buffer while
+ a library is being loaded.")
+ 
  (make-variable-buffer-local 'hi-lock-interactive-patterns)
  (put 'hi-lock-interactive-patterns 'permanent-local t)
  (make-variable-buffer-local 'hi-lock-regexp-history)
***************
*** 238,250 ****
  
  
  ;;;###autoload
! (define-minor-mode hi-lock-buffer-mode
    "Toggle minor mode for interactively adding font-lock highlighting patterns.
  
  If ARG positive turn hi-lock on.  Issuing a hi-lock command will also
! turn hi-lock on.  When hi-lock is turned on, a \"Regexp Highlighting\"
! submenu is added to the \"Edit\" menu.  The commands in the submenu,
! which can be called interactively, are:
  
  \\[highlight-regexp] REGEXP FACE
    Highlight matches of pattern REGEXP in current buffer with FACE.
--- 249,263 ----
  
  
  ;;;###autoload
! (define-minor-mode hi-lock-mode
    "Toggle minor mode for interactively adding font-lock highlighting patterns.
  
  If ARG positive turn hi-lock on.  Issuing a hi-lock command will also
! turn hi-lock on; to turn hi-lock on in all buffers use
! global-hi-lock-mode or in your .emacs file (global-hi-lock-mode 1).
! When hi-lock is turned on, a \"Regexp Highlighting\" submenu is added
! to the \"Edit\" menu.  The commands in the submenu, which can be
! called interactively, are:
  
  \\[highlight-regexp] REGEXP FACE
    Highlight matches of pattern REGEXP in current buffer with FACE.
***************
*** 283,289 ****
    :lighter " H"
    :global nil
    :keymap hi-lock-map
!   (if hi-lock-buffer-mode
        ;; Turned on.
        (progn
        (unless font-lock-mode (font-lock-mode 1))
--- 296,319 ----
    :lighter " H"
    :global nil
    :keymap hi-lock-map
!   (when (and (equal (buffer-name) "*scratch*")
!              load-in-progress
!              (not (interactive-p))
!              (not hi-lock-archaic-interface-message-used))
!     (setq hi-lock-archaic-interface-message-used t)
!     (if hi-lock-archaic-interface-deduce
!         (global-hi-lock-mode hi-lock-mode)
!       (warn
!        "Possible archaic use of (hi-lock-mode).
! Use (global-hi-lock-mode 1) in .emacs to enable hi-lock for all buffers,
! use (hi-lock-mode 1) for individual buffers. For compatibility with Emacs
! versions before 22 use the following in your .emacs file:
! 
!         (if (functionp 'global-hi-lock-mode)
!             (global-hi-lock-mode 1)
!           (hi-lock-mode 1))
! ")))
!   (if hi-lock-mode
        ;; Turned on.
        (progn
        (unless font-lock-mode (font-lock-mode 1))
***************
*** 294,300 ****
      ;; Turned off.
      (when (or hi-lock-interactive-patterns
              hi-lock-file-patterns)
!       (when hi-lock-interactive-patterns 
        (font-lock-remove-keywords nil hi-lock-interactive-patterns)
        (setq hi-lock-interactive-patterns nil))
        (when hi-lock-file-patterns
--- 324,330 ----
      ;; Turned off.
      (when (or hi-lock-interactive-patterns
              hi-lock-file-patterns)
!       (when hi-lock-interactive-patterns
        (font-lock-remove-keywords nil hi-lock-interactive-patterns)
        (setq hi-lock-interactive-patterns nil))
        (when hi-lock-file-patterns
***************
*** 306,318 ****
      (remove-hook 'font-lock-mode-hook 'hi-lock-font-lock-hook t)))
  
  ;;;###autoload
! (define-global-minor-mode hi-lock-mode
!   hi-lock-buffer-mode turn-on-hi-lock-if-enabled
    :group 'hi-lock)
!   
  (defun turn-on-hi-lock-if-enabled ()
    (unless (memq major-mode hi-lock-exclude-modes)
!     (hi-lock-buffer-mode 1)))
  
  ;;;###autoload
  (defalias 'highlight-lines-matching-regexp 'hi-lock-line-face-buffer)
--- 336,349 ----
      (remove-hook 'font-lock-mode-hook 'hi-lock-font-lock-hook t)))
  
  ;;;###autoload
! (define-global-minor-mode global-hi-lock-mode
!   hi-lock-mode turn-on-hi-lock-if-enabled
    :group 'hi-lock)
! 
  (defun turn-on-hi-lock-if-enabled ()
+   (setq hi-lock-archaic-interface-message-used t)
    (unless (memq major-mode hi-lock-exclude-modes)
!     (hi-lock-mode 1)))
  
  ;;;###autoload
  (defalias 'highlight-lines-matching-regexp 'hi-lock-line-face-buffer)
***************
*** 332,338 ****
                             nil nil 'hi-lock-regexp-history))
      (hi-lock-read-face-name)))
    (or (facep face) (setq face 'hi-yellow))
!   (unless hi-lock-buffer-mode (hi-lock-buffer-mode 1))
    (hi-lock-set-pattern
     ;; The \\(?:...\\) grouping construct ensures that a leading ^, +, * or ?
     ;; or a trailing $ in REGEXP will be interpreted correctly.
--- 363,369 ----
                             nil nil 'hi-lock-regexp-history))
      (hi-lock-read-face-name)))
    (or (facep face) (setq face 'hi-yellow))
!   (unless hi-lock-mode (hi-lock-mode 1))
    (hi-lock-set-pattern
     ;; The \\(?:...\\) grouping construct ensures that a leading ^, +, * or ?
     ;; or a trailing $ in REGEXP will be interpreted correctly.
***************
*** 357,363 ****
                             nil nil 'hi-lock-regexp-history))
      (hi-lock-read-face-name)))
    (or (facep face) (setq face 'hi-yellow))
!   (unless hi-lock-buffer-mode (hi-lock-buffer-mode 1))
    (hi-lock-set-pattern regexp face))
  
  ;;;###autoload
--- 388,394 ----
                             nil nil 'hi-lock-regexp-history))
      (hi-lock-read-face-name)))
    (or (facep face) (setq face 'hi-yellow))
!   (unless hi-lock-mode (hi-lock-mode 1))
    (hi-lock-set-pattern regexp face))
  
  ;;;###autoload
***************
*** 377,383 ****
                              nil nil 'hi-lock-regexp-history)))
      (hi-lock-read-face-name)))
    (or (facep face) (setq face 'hi-yellow))
!   (unless hi-lock-buffer-mode (hi-lock-buffer-mode 1))
    (hi-lock-set-pattern regexp face))
  
  ;;;###autoload
--- 408,414 ----
                              nil nil 'hi-lock-regexp-history)))
      (hi-lock-read-face-name)))
    (or (facep face) (setq face 'hi-yellow))
!   (unless hi-lock-mode (hi-lock-mode 1))
    (hi-lock-set-pattern regexp face))
  
  ;;;###autoload
***************
*** 535,541 ****
                  (setq all-patterns (append (read (current-buffer)) 
all-patterns))
                (error (message "Invalid pattern list expression at %d"
                                (line-number-at-pos)))))))
!       (when hi-lock-buffer-mode (hi-lock-set-file-patterns all-patterns))
        (if (interactive-p)
          (message "Hi-lock added %d patterns." (length all-patterns))))))
  
--- 566,572 ----
                  (setq all-patterns (append (read (current-buffer)) 
all-patterns))
                (error (message "Invalid pattern list expression at %d"
                                (line-number-at-pos)))))))
!       (when hi-lock-mode (hi-lock-set-file-patterns all-patterns))
        (if (interactive-p)
          (message "Hi-lock added %d patterns." (length all-patterns))))))
  
***************
*** 544,550 ****
    (if font-lock-mode
        (progn (font-lock-add-keywords nil hi-lock-file-patterns)
             (font-lock-add-keywords nil hi-lock-interactive-patterns))
!     (hi-lock-buffer-mode -1)))
  
  (provide 'hi-lock)
  
--- 575,581 ----
    (if font-lock-mode
        (progn (font-lock-add-keywords nil hi-lock-file-patterns)
             (font-lock-add-keywords nil hi-lock-interactive-patterns))
!     (hi-lock-mode -1)))
  
  (provide 'hi-lock)
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]