From 433fbdbc630df69df671ea945122ed9cb440f251 Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Sun, 28 Jul 2024 20:49:25 +0200 Subject: [PATCH] org-agenda-write: Remove redundant `set-buffer' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * lisp/org-agenda.el (org-agenda-write): Drop `set-buffer' call at the end. It does nothing since the rest of the code is wrapped in `save-excursion' and the aim of the `set-buffer' is to switch to the agenda buffer we just saved. Ignore AGENDA-BUFNAME argument - it is unused now. Update the docstring, removing the mention of what appears to be the now-ignored argument. (org--batch-store-agenda-views): Update the caller. Passing current agenda buffer name is no longer necessary. We set it before the call anyway. Reported-by: SÅ‚awomir Grochowski Link: https://orgmode.org/list/87ed7dwygq.fsf@gmail.com --- lisp/org-agenda.el | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 85ba43b78..6b586899f 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -3577,8 +3577,7 @@ This ensures the export commands can easily use it." (set-buffer bufname) (while files (cl-progv vars vals - (org-agenda-write (expand-file-name (pop files) dir) - nil t bufname)))) + (org-agenda-write (expand-file-name (pop files) dir) nil t)))) (and (get-buffer bufname) (kill-buffer bufname))))))) @@ -3596,7 +3595,7 @@ This ensures the export commands can easily use it." (defvar org-mobile-creating-agendas) ; defined in org-mobile.el (defvar org-agenda-write-buffer-name "Agenda View") -(defun org-agenda-write (file &optional open nosettings agenda-bufname) +(defun org-agenda-write (file &optional open nosettings _) "Write the current buffer (an agenda view) as a file. Depending on the extension of the file name, plain text (.txt), @@ -3609,9 +3608,7 @@ With prefix argument OPEN, open the new file immediately. If NOSETTINGS is given, do not scope the settings of `org-agenda-exporter-settings' into the export commands. This is used when the settings have already been scoped and we do not -wish to overrule other, higher priority settings. If -AGENDA-BUFFER-NAME is provided, use this as the buffer name for -the agenda to write." +wish to overrule other, higher priority settings." (interactive "FWrite agenda to file: \nP") (if (or (not (file-writable-p file)) (and (file-exists-p file) @@ -3690,12 +3687,7 @@ the agenda to write." (org-icalendar-export-current-agenda (expand-file-name file))) (t (write-region nil nil file) - (message "Plain text written to %s" file))))))) - (set-buffer (or agenda-bufname - ;; FIXME: I'm pretty sure called-interactively-p - ;; doesn't do what we want here! - (and (called-interactively-p 'any) (buffer-name)) - org-agenda-buffer-name))) + (message "Plain text written to %s" file)))))))) (when open (org-open-file file))) (defun org-agenda-remove-marked-text (property &optional value)