Use save-current-buffer instead of save-excursion
This commit is contained in:
parent
5fb99b5180
commit
04be6aa653
1 changed files with 1 additions and 2 deletions
|
@ -539,12 +539,11 @@
|
|||
(defun mk/extract-headlines-by-tag (tag)
|
||||
"Extract headlines from current buffer by TAG."
|
||||
(interactive "sEnter tag: ")
|
||||
(save-excursion
|
||||
(save-current-buffer
|
||||
(let ((result-buffer (generate-new-buffer (concat "*Extracted Headlines " tag "*"))))
|
||||
(with-current-buffer result-buffer
|
||||
(org-mode)
|
||||
(insert "* Extracted Headlines by Tag: " tag " *\n\n"))
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward (concat "^\\*+\\s-+\\(.*?\\)\\s-+:\\(" tag "\\):") nil t)
|
||||
(let ((headline (match-string 0)))
|
||||
(with-current-buffer result-buffer
|
||||
|
|
Loading…
Add table
Reference in a new issue