emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r111149: * lisp/hi-lock.el (hi-lock-u


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111149: * lisp/hi-lock.el (hi-lock-unface-buffer): If there's no matching regexp at
Date: Fri, 07 Dec 2012 11:48:42 -0500
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111149
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Fri 2012-12-07 11:48:42 -0500
message:
  * lisp/hi-lock.el (hi-lock-unface-buffer): If there's no matching regexp at
  point, still provide some default.
  (hi-lock--regexps-at-point): Don't enforce a "hi-lock-" prefix on face
  names, since we don't use it right now.  Actually return the list.
  (hi-lock-file-patterns, hi-lock-interactive-patterns): Use defvar-local.
modified:
  lisp/ChangeLog
  lisp/hi-lock.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-12-07 16:34:01 +0000
+++ b/lisp/ChangeLog    2012-12-07 16:48:42 +0000
@@ -1,3 +1,11 @@
+2012-12-07  Stefan Monnier  <address@hidden>
+
+       * hi-lock.el (hi-lock-unface-buffer): If there's no matching regexp at
+       point, still provide some default.
+       (hi-lock--regexps-at-point): Don't enforce a "hi-lock-" prefix on face
+       names, since we don't use it right now.  Actually return the list.
+       (hi-lock-file-patterns, hi-lock-interactive-patterns): Use defvar-local.
+
 2012-12-07  Chong Yidong  <address@hidden>
 
        * novice.el (disabled-command-function): Remove a spurious help

=== modified file 'lisp/hi-lock.el'
--- a/lisp/hi-lock.el   2012-12-06 16:17:11 +0000
+++ b/lisp/hi-lock.el   2012-12-07 16:48:42 +0000
@@ -205,11 +205,13 @@
   "Face for hi-lock mode."
   :group 'hi-lock-faces)
 
-(defvar hi-lock-file-patterns nil
+(defvar-local hi-lock-file-patterns nil
   "Patterns found in file for hi-lock.  Should not be changed.")
+(put 'hi-lock-file-patterns 'permanent-local t)
 
-(defvar hi-lock-interactive-patterns nil
+(defvar-local hi-lock-interactive-patterns nil
   "Patterns provided to hi-lock by user.  Should not be changed.")
+(put 'hi-lock-interactive-patterns 'permanent-local t)
 
 (define-obsolete-variable-alias 'hi-lock-face-history
                                 'hi-lock-face-defaults "23.1")
@@ -236,11 +238,6 @@
 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-file-patterns)
-(put 'hi-lock-file-patterns 'permanent-local t)
-
 (defvar hi-lock-menu
   (let ((map (make-sparse-keymap "Hi Lock")))
     (define-key-after map [highlight-regexp]
@@ -474,8 +471,8 @@
     (let ((regexp (get-char-property (point) 'hi-lock-overlay-regexp)))
       (when regexp (push regexp regexps)))
     ;; With font-locking on, check if the cursor is on an highlighted text.
-    ;; Checking for hi-lock face is a good heuristic.
-    (and (string-match "\\`hi-lock-" (face-name (face-at-point)))
+    ;; Checking for hi-lock face is a good heuristic.  FIXME: use "hi-lock-".
+    (and (string-match "\\`hi-" (face-name (face-at-point)))
          (let* ((hi-text
                  (buffer-substring-no-properties
                   (previous-single-property-change (point) 'face)
@@ -486,7 +483,8 @@
            (dolist (hi-lock-pattern hi-lock-interactive-patterns)
              (let ((regexp (car hi-lock-pattern)))
                (if (string-match regexp hi-text)
-                   (push regexp regexps))))))))
+                   (push regexp regexps))))))
+    regexps))
 
 (defvar-local hi-lock--last-face nil)
 
@@ -531,7 +529,8 @@
      (unless hi-lock-interactive-patterns
        (error "No highlighting to remove"))
      ;; Infer the regexp to un-highlight based on cursor position.
-     (let* ((defaults (hi-lock--regexps-at-point)))
+     (let* ((defaults (or (hi-lock--regexps-at-point)
+                          (mapcar #'car hi-lock-interactive-patterns))))
        (list
         (completing-read (if (null defaults)
                              "Regexp to unhighlight: "


reply via email to

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