org-diary-to-ical-string: Make sure that temporary file/buffer is cleaned
* lisp/org.el (org-diary-to-ical-string): Clean temporary file buffer on error. Reported-by: Alexei Gilev <gerardomoro37@gmail.com> Link: https://orgmode.org/list/CAF4Fj9gUBj4Ap4noTLP3aSG4owXJ2nydxaqwT4cF5x9DcdhQmg@mail.gmail.com
This commit is contained in:
parent
2e883b21a7
commit
351279ffae
|
@ -14567,6 +14567,7 @@ This uses the icalendar.el library."
|
||||||
(tmpfile (make-temp-name
|
(tmpfile (make-temp-name
|
||||||
(expand-file-name "orgics" tmpdir)))
|
(expand-file-name "orgics" tmpdir)))
|
||||||
buf rtn b e)
|
buf rtn b e)
|
||||||
|
(unwind-protect
|
||||||
(with-current-buffer frombuf
|
(with-current-buffer frombuf
|
||||||
(icalendar-export-region (point-min) (point-max) tmpfile)
|
(icalendar-export-region (point-min) (point-max) tmpfile)
|
||||||
(setq buf (find-buffer-visiting tmpfile))
|
(setq buf (find-buffer-visiting tmpfile))
|
||||||
|
@ -14578,8 +14579,8 @@ This uses the icalendar.el library."
|
||||||
(when (re-search-backward "^END:VEVENT" nil t)
|
(when (re-search-backward "^END:VEVENT" nil t)
|
||||||
(setq e (match-end 0)))
|
(setq e (match-end 0)))
|
||||||
(setq rtn (if (and b e) (concat (buffer-substring b e) "\n") "")))
|
(setq rtn (if (and b e) (concat (buffer-substring b e) "\n") "")))
|
||||||
(kill-buffer buf)
|
(when (and buf (buffer-live-p buf)) (kill-buffer buf))
|
||||||
(delete-file tmpfile)
|
(delete-file tmpfile))
|
||||||
rtn))
|
rtn))
|
||||||
|
|
||||||
(defun org-closest-date (start current prefer)
|
(defun org-closest-date (start current prefer)
|
||||||
|
|
Loading…
Reference in New Issue