1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-21 12:03:55 -08:00

(hi-lock-find-patterns): Save restriction.

This commit is contained in:
Stefan Monnier 2002-02-01 19:31:17 +00:00
parent b678e3717c
commit 738c068f1d
2 changed files with 20 additions and 15 deletions

View file

@ -1,3 +1,7 @@
2002-02-01 Stefan Monnier <monnier@cs.yale.edu>
* hi-lock.el (hi-lock-find-patterns): Save restriction.
2002-01-29 Pavel Jan,Bm(Bk <Pavel@Janik.cz>
* tmm.el (tmm-get-keymap): Honour :visible in `menu-item'.

View file

@ -537,21 +537,22 @@ Optional argument END is maximum excursion."
(let ((all-patterns nil)
(target-regexp (concat "\\<" hi-lock-file-patterns-prefix ":")))
(save-excursion
(widen)
(goto-char (point-min))
(re-search-forward target-regexp
(+ (point) hi-lock-file-patterns-range) t)
(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))))))
(save-restriction
(widen)
(goto-char (point-min))
(re-search-forward target-regexp
(+ (point) hi-lock-file-patterns-range) t)
(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)))))))
(when hi-lock-mode (hi-lock-set-file-patterns all-patterns))
(if (interactive-p)
(message (format "Hi-lock added %d patterns." (length all-patterns)))))))