From e04264320cad945527db4ea3ec92f45ac6d0a734 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Thu, 16 Oct 2014 00:18:29 -0400 Subject: Use org-with-wide-buffer macro --- bog.el | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/bog.el b/bog.el index 0a72f46..587921f 100644 --- a/bog.el +++ b/bog.el @@ -253,13 +253,11 @@ year, and the first meaningful word in the title)." (defun bog-citekey-from-tree () "Retrieve citekey from first parent heading associated with citekey." - (save-excursion - (save-restriction - (widen) - (let (maybe-citekey) - (while (and (not (setq maybe-citekey (bog-citekey-from-heading))) - (org-up-heading-safe))) - maybe-citekey)))) + (org-with-wide-buffer + (let (maybe-citekey) + (while (and (not (setq maybe-citekey (bog-citekey-from-heading))) + (org-up-heading-safe))) + maybe-citekey))) (defun bog-citekey-from-heading () "Retrieve citekey from current heading title." @@ -303,12 +301,10 @@ year, and the first meaningful word in the title)." (buffer (find-file-noselect file)) refs) (with-current-buffer buffer - (save-excursion - (save-restriction - (widen) - (goto-char (point-min)) - (while (re-search-forward bog-citekey-format nil t) - (add-to-list 'refs (match-string-no-properties 0)))))) + (org-with-wide-buffer + (goto-char (point-min)) + (while (re-search-forward bog-citekey-format nil t) + (add-to-list 'refs (match-string-no-properties 0))))) (unless was-open (kill-buffer buffer)) refs)) -- cgit v1.2.3