From 738c068f1dedfd4ca43acda75498c8e9a9af005f Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 1 Feb 2002 19:31:17 +0000 Subject: [PATCH] (hi-lock-find-patterns): Save restriction. --- lisp/ChangeLog | 4 ++++ lisp/hi-lock.el | 31 ++++++++++++++++--------------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 944b4dc096d..e318a0e5394 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2002-02-01 Stefan Monnier + + * hi-lock.el (hi-lock-find-patterns): Save restriction. + 2002-01-29 Pavel Jan,Bm(Bk * tmm.el (tmm-get-keymap): Honour :visible in `menu-item'. diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el index 6c7fb5d0c58..8d40852cf68 100644 --- a/lisp/hi-lock.el +++ b/lisp/hi-lock.el @@ -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))))))) -- 2.39.5