changeset 64117:8ad318b132eb

(hi-lock-find-patterns): Protect also against invalid values for the pattern lists which are `read'able but not `append'able (like symbols).
author Juanma Barranquero <lekktu@gmail.com>
date Thu, 07 Jul 2005 01:49:08 +0000
parents a282acf3e001
children 565aeb1f7662
files lisp/hi-lock.el
diffstat 1 files changed, 4 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/hi-lock.el	Wed Jul 06 22:12:32 2005 +0000
+++ b/lisp/hi-lock.el	Thu Jul 07 01:49:08 2005 +0000
@@ -557,14 +557,10 @@
 	  (beginning-of-line)
 	  (while (and (re-search-forward target-regexp (+ (point) 100) t)
 		      (not (looking-at "\\s-*end")))
-	    (let ((patterns
-		   (condition-case nil
-		       (read (current-buffer))
-		     (error  (message
-			      (format "Could not read expression at %d"
-				      (hi-lock-current-line))) nil))))
-	      (if patterns
-		  (setq all-patterns (append patterns all-patterns)))))))
+            (condition-case nil
+                (setq all-patterns (append (read (current-buffer)) all-patterns))
+              (error (message "Invalid pattern list expression at %d"
+                              (hi-lock-current-line)))))))
       (when hi-lock-mode (hi-lock-set-file-patterns all-patterns))
       (if (interactive-p)
         (message (format "Hi-lock added %d patterns." (length all-patterns)))))))