From: Ingo Lohmar <ingo.lohmar@posteo.net> To: emacs-orgmode@gnu.org Subject: [PATCH] Re: Bug: org-agenda-buffer-name wrongly persists [9.4.4 (release_9.4.4 @ /usr/local/share/emacs/28.0.50/lisp/org/)] Date: Sat, 19 Jun 2021 15:22:23 +0000 [thread overview] Message-ID: <87pmwhdgls.fsf@kenko.localhost.com> (raw) In-Reply-To: <87r1i8cjik.fsf@kenko.localhost.com> [-- Attachment #1: Type: text/plain, Size: 277 bytes --] Here's a local-tested fix to the bug described previously. The attached patch does not change anything about the overall handling of the agenda buffer names, it only fixes org-follow-timestamp-link to introduce a let-binding similar to what the standard org-dispatcher does. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-org.el-org-follow-timestamp-link-Do-not-set-global-a.patch --] [-- Type: text/x-diff, Size: 2554 bytes --] From 2c0166449de2f4252435ecfea8a2d1287eafc04b Mon Sep 17 00:00:00 2001 From: Ingo Lohmar <ingo.lohmar@posteo.net> Date: Sat, 19 Jun 2021 17:04:56 +0200 Subject: [PATCH] org.el (org-follow-timestamp-link): Do not set global agenda name The tmp value for the agenda buffer name is used in `org-agenda-list' to set `org-agenda-buffer-name'. Wrap the call in a let-binding for this symbol (like the agenda dispatcher does), since otherwise it inadvertently sets the global value. --- lisp/org.el | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 1bd9e02eb..4fd8b6fa6 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -9165,24 +9165,26 @@ or to another Org file, automatically push the old position onto the ring." (defvar org-agenda-start-on-weekday) (defun org-follow-timestamp-link () "Open an agenda view for the time-stamp date/range at point." - (cond - ((org-at-date-range-p t) - (let ((org-agenda-start-on-weekday) - (t1 (match-string 1)) - (t2 (match-string 2)) tt1 tt2) - (setq tt1 (time-to-days (org-time-string-to-time t1)) - tt2 (time-to-days (org-time-string-to-time t2))) + ;; Avoid changing the global value. + (let ((org-agenda-buffer-name org-agenda-buffer-name)) + (cond + ((org-at-date-range-p t) + (let ((org-agenda-start-on-weekday) + (t1 (match-string 1)) + (t2 (match-string 2)) tt1 tt2) + (setq tt1 (time-to-days (org-time-string-to-time t1)) + tt2 (time-to-days (org-time-string-to-time t2))) + (let ((org-agenda-buffer-tmp-name + (format "*Org Agenda(a:%s)" + (concat (substring t1 0 10) "--" (substring t2 0 10))))) + (org-agenda-list nil tt1 (1+ (- tt2 tt1)))))) + ((org-at-timestamp-p 'lax) (let ((org-agenda-buffer-tmp-name - (format "*Org Agenda(a:%s)" - (concat (substring t1 0 10) "--" (substring t2 0 10))))) - (org-agenda-list nil tt1 (1+ (- tt2 tt1)))))) - ((org-at-timestamp-p 'lax) - (let ((org-agenda-buffer-tmp-name - (format "*Org Agenda(a:%s)" (substring (match-string 1) 0 10)))) - (org-agenda-list nil (time-to-days (org-time-string-to-time - (substring (match-string 1) 0 10))) - 1))) - (t (error "This should not happen")))) + (format "*Org Agenda(a:%s)" (substring (match-string 1) 0 10)))) + (org-agenda-list nil (time-to-days (org-time-string-to-time + (substring (match-string 1) 0 10))) + 1))) + (t (error "This should not happen"))))) ;;; Following file links -- 2.30.2
prev parent reply other threads:[~2021-06-19 15:23 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-05-15 11:40 Ingo Lohmar 2021-06-19 15:22 ` Ingo Lohmar [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style List information: https://www.orgmode.org/ * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=87pmwhdgls.fsf@kenko.localhost.com \ --to=ingo.lohmar@posteo.net \ --cc=emacs-orgmode@gnu.org \ --subject='[PATCH] Re: Bug: org-agenda-buffer-name wrongly persists [9.4.4 (release_9.4.4 @ /usr/local/share/emacs/28.0.50/lisp/org/)]' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Code repositories for project(s) associated with this inbox: https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).