From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id MKlJI9wLzmA8FwEAgWs5BA (envelope-from ) for ; Sat, 19 Jun 2021 17:23:08 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 8EAFH9wLzmDbFQAAB5/wlQ (envelope-from ) for ; Sat, 19 Jun 2021 15:23:08 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B93DE2225E for ; Sat, 19 Jun 2021 17:23:07 +0200 (CEST) Received: from localhost ([::1]:46630 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lucoM-0000B9-Fl for larch@yhetil.org; Sat, 19 Jun 2021 11:23:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34366) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lucnr-0000Ai-N3 for emacs-orgmode@gnu.org; Sat, 19 Jun 2021 11:22:35 -0400 Received: from mout01.posteo.de ([185.67.36.65]:42793) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lucnl-0004Tk-59 for emacs-orgmode@gnu.org; Sat, 19 Jun 2021 11:22:35 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 97F5C240026 for ; Sat, 19 Jun 2021 17:22:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1624116144; bh=pZxe/ufZOkPeJDyxFJv+bBohyAkXzgKtO1AmkUmt8TI=; h=From:To:Subject:Date:From; b=mZ0eVo9du0aYsU7GN4h7e3RjZB+F8Pugf/o/gl399ygU5QH0mLj7QP9H46KRO5XIQ i+hN9jP7LgWInB73ZvIvqeLw1C/LyDxIDhpr2xSTtJr4gtIM5N1t3TBDFbBx5/8ZSw mnjKizc7umiWl7si9Q8+F0dqsJR3M/IV7a05g1hcHmhV0xCBKJRBhRjiVFNtQMAo8/ 6+ak9mg8DjUj7D0mBObW83RRPtwTn7u7OSUWHWx4BM+1baNTjDSdEZaYWromYzkM+n dnRNCxZINs5Y/08NXMAriFDMFDYuzF+QM752MuWq+EsMgEVXSeeSUeDj2KSpUQTq82 N3qzZYURPxZow== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4G6ffm0P6tz6tmT for ; Sat, 19 Jun 2021 17:22:23 +0200 (CEST) From: Ingo Lohmar 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/)] In-Reply-To: <87r1i8cjik.fsf@kenko.localhost.com> References: <87r1i8cjik.fsf@kenko.localhost.com> Date: Sat, 19 Jun 2021 15:22:23 +0000 Message-ID: <87pmwhdgls.fsf@kenko.localhost.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=185.67.36.65; envelope-from=ingo.lohmar@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1624116188; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=Ck1CRgy7rPn2C/V0dgVwOr5qldz2UyrxQdr4ffBBNeU=; b=tztwsbK1KXZZXri8TkfCo/VXDU7CrlgaXjlDeLQOwaxSbJqg6qsxux4gSFYRgHjNfoScN7 3dpnDwcxj69D6aAk/B+hP8P34llD75tpwEX4W/Evn4sHHP8KWJ1VBaK9wdMNWBC85H3mmW 3bIRUk7vJiJnGo4QTHt9m2r5pyv/5lDsbGhWjNZMwXrSdjZLIYxrMxlQk2NDTdinEjK1Yf HQ0340pObfY9TUioUCW/ia5JyIJDzeFHlxziN2a+ecoM4QmTlRX7wbqcUa86UwDhTwVHs4 Z0Q36uEmuL27rkZzlSI+0Q1fTZBWfAnz8IOB4VsfOxGqSLdxPG5GorsN3suIsw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1624116188; a=rsa-sha256; cv=none; b=MQa0yXFkpn9w3a5tXdUpXoFqh4XOiXrYtRrH8Mc25qCWWBLCiyBzCOp/xL4MWC1tVOVvNJ VsVyQ3lFWtJF+SzyVksJXsgo60KTQphnbwTT/o+X9kQfNGVTeMrCRMHilu8+1usrLhBqzz zMe01YuRFwONgObWlDhMMy8eM30IiAU2uJoItQdcxA7HtXsCj3savt3tqNF0gZPGNB+nij DRcKFTIYgkZV0EnM4TZaG0OLxg/JFNFehLepCe3P7/dCxWz87JLSq1g6Io9y7a4lpTIc9t wtUkpnyK8YnyniHS+ZKuVTIUam9gzA2iQDO/LzTbneAg+rmR9knzs6pMyhqYGA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=mZ0eVo9d; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -3.12 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=mZ0eVo9d; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: B93DE2225E X-Spam-Score: -3.12 X-Migadu-Scanner: scn1.migadu.com X-TUID: L9eQx9y6NfNe --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-org.el-org-follow-timestamp-link-Do-not-set-global-a.patch >From 2c0166449de2f4252435ecfea8a2d1287eafc04b Mon Sep 17 00:00:00 2001 From: Ingo Lohmar 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 --=-=-=--