aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2009-12-02 03:03:48 +0000
committerGlenn Morris2009-12-02 03:03:48 +0000
commit5813f6ef75c0cb6c6575fd97b338ec9b41c33b7c (patch)
treebf41ea0c7e4c8416ee201425d52e6ea4cf0bff81
parentc79fb97624d147cbefb7ebf1d0dd6e5270624faa (diff)
downloademacs-5813f6ef75c0cb6c6575fd97b338ec9b41c33b7c.tar.gz
emacs-5813f6ef75c0cb6c6575fd97b338ec9b41c33b7c.zip
(diary-list-entries): Replace superfluous save-excursion with
save-current-buffer. Widen before searching. (Bug#5093) (diary-list-sexp-entries): Remove superfluous save-excursion.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/calendar/diary-lib.el65
2 files changed, 40 insertions, 32 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 1cd9b4eb121..36bf1cb1476 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12009-12-02 Glenn Morris <rgm@gnu.org>
2
3 * calendar/diary-lib.el (diary-list-entries): Replace superfluous
4 save-excursion with save-current-buffer.
5 Widen before searching. (Bug#5093)
6 (diary-list-sexp-entries): Remove superfluous save-excursion.
7
12009-12-02 Michael Welsh Duggan <mwd@cert.org> 82009-12-02 Michael Welsh Duggan <mwd@cert.org>
2 9
3 * woman.el (woman-make-bufname): Handle man-pages with "." in the 10 * woman.el (woman-make-bufname): Handle man-pages with "." in the
diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el
index 82fbc35b82d..0cb52cfb805 100644
--- a/lisp/calendar/diary-lib.el
+++ b/lisp/calendar/diary-lib.el
@@ -744,7 +744,7 @@ LIST-ONLY is non-nil, in which case it just returns the list."
744 (diary-buffer (find-buffer-visiting diary-file)) 744 (diary-buffer (find-buffer-visiting diary-file))
745 diary-entries-list file-glob-attrs) 745 diary-entries-list file-glob-attrs)
746 (message "Preparing diary...") 746 (message "Preparing diary...")
747 (save-excursion 747 (save-current-buffer
748 (if (not diary-buffer) 748 (if (not diary-buffer)
749 (set-buffer (find-file-noselect diary-file t)) 749 (set-buffer (find-file-noselect diary-file t))
750 (set-buffer diary-buffer) 750 (set-buffer diary-buffer)
@@ -765,37 +765,39 @@ LIST-ONLY is non-nil, in which case it just returns the list."
765 ;; d-s-p is passed to the diary display function. 765 ;; d-s-p is passed to the diary display function.
766 (let ((diary-saved-point (point))) 766 (let ((diary-saved-point (point)))
767 (save-excursion 767 (save-excursion
768 (setq file-glob-attrs (cadr (diary-pull-attrs nil ""))) 768 (save-restriction
769 (with-syntax-table diary-syntax-table 769 (widen) ; bug#5093
770 (setq file-glob-attrs (cadr (diary-pull-attrs nil "")))
771 (with-syntax-table diary-syntax-table
772 (goto-char (point-min))
773 (unless list-only
774 (let ((ol (make-overlay (point-min) (point-max) nil t nil)))
775 (set (make-local-variable 'diary-selective-display) t)
776 (overlay-put ol 'invisible 'diary)
777 (overlay-put ol 'evaporate t)))
778 (dotimes (idummy number)
779 (let ((sexp-found (diary-list-sexp-entries date))
780 (entry-found (diary-list-entries-2
781 date diary-nonmarking-symbol
782 file-glob-attrs list-only)))
783 (if diary-list-include-blanks
784 (or sexp-found entry-found
785 (diary-add-to-list date "" "" "" "")))
786 (setq date
787 (calendar-gregorian-from-absolute
788 (1+ (calendar-absolute-from-gregorian date)))))))
770 (goto-char (point-min)) 789 (goto-char (point-min))
790 (run-hooks 'diary-nongregorian-listing-hook
791 'diary-list-entries-hook)
771 (unless list-only 792 (unless list-only
772 (let ((ol (make-overlay (point-min) (point-max) nil t nil))) 793 (if (and diary-display-function
773 (set (make-local-variable 'diary-selective-display) t) 794 (listp diary-display-function))
774 (overlay-put ol 'invisible 'diary) 795 ;; Backwards compatibility.
775 (overlay-put ol 'evaporate t))) 796 (run-hooks 'diary-display-function)
776 (dotimes (idummy number) 797 (funcall (or diary-display-function
777 (let ((sexp-found (diary-list-sexp-entries date)) 798 'diary-simple-display))))
778 (entry-found (diary-list-entries-2 799 (run-hooks 'diary-hook)
779 date diary-nonmarking-symbol 800 diary-entries-list)))))))
780 file-glob-attrs list-only)))
781 (if diary-list-include-blanks
782 (or sexp-found entry-found
783 (diary-add-to-list date "" "" "" "")))
784 (setq date
785 (calendar-gregorian-from-absolute
786 (1+ (calendar-absolute-from-gregorian date)))))))
787 (goto-char (point-min))
788 (run-hooks 'diary-nongregorian-listing-hook
789 'diary-list-entries-hook)
790 (unless list-only
791 (if (and diary-display-function
792 (listp diary-display-function))
793 ;; Backwards compatibility.
794 (run-hooks 'diary-display-function)
795 (funcall (or diary-display-function
796 'diary-simple-display))))
797 (run-hooks 'diary-hook)
798 diary-entries-list))))))
799 801
800(define-obsolete-function-alias 'list-diary-entries 'diary-list-entries "22.1") 802(define-obsolete-function-alias 'list-diary-entries 'diary-list-entries "22.1")
801 803
@@ -1694,8 +1696,7 @@ best if they are non-marking."
1694 sexp-start sexp entry specifier entry-start line-start 1696 sexp-start sexp entry specifier entry-start line-start
1695 diary-entry temp literal) 1697 diary-entry temp literal)
1696 (goto-char (point-min)) 1698 (goto-char (point-min))
1697 (save-excursion 1699 (setq file-glob-attrs (nth 1 (diary-pull-attrs nil '())))
1698 (setq file-glob-attrs (nth 1 (diary-pull-attrs nil '()))))
1699 (while (re-search-forward s-entry nil t) 1700 (while (re-search-forward s-entry nil t)
1700 (backward-char 1) 1701 (backward-char 1)
1701 (setq sexp-start (point)) 1702 (setq sexp-start (point))