emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org a1fa521975: org-agenda-format-item: Do not call `or


From: ELPA Syncer
Subject: [elpa] externals/org a1fa521975: org-agenda-format-item: Do not call `org-get-outline-path' in non-Org buffer
Date: Fri, 17 Nov 2023 09:58:24 -0500 (EST)

branch: externals/org
commit a1fa521975991c2eea36059f5b9e530203be0a12
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>

    org-agenda-format-item: Do not call `org-get-outline-path' in non-Org buffer
    
    * lisp/org-agenda.el (org-agenda-format-item): Avoid invoking Org
    parser when we are not actually in Org buffer.  Add commentary
    explaining when it can happen.
    
    Reported-by: Will O'Brien <will.08rien@gmail.com>
    Link: https://orgmode.org/list/m2leawo9zo.fsf@hazy.com
---
 lisp/org-agenda.el | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 57b6173ff0..ac8adda7a5 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -7032,11 +7032,21 @@ Any match of REMOVE-RE will be removed from TXT."
 
        ;; Prepare the variables needed in the eval of the compiled format
        (when org-prefix-has-breadcrumbs
-         (setq breadcrumbs (org-with-point-at (org-get-at-bol 'org-marker)
-                             (let ((s (org-format-outline-path 
(org-get-outline-path)
-                                                               (1- 
(frame-width))
-                                                               nil 
org-agenda-breadcrumbs-separator)))
-                               (if (equal "" s) "" (concat s 
org-agenda-breadcrumbs-separator))))))
+         (setq breadcrumbs
+                ;; When called from Org buffer, remain in position.
+                ;; When called from Agenda buffer, jump to headline position 
first.
+                (org-with-point-at (org-get-at-bol 'org-marker)
+                 (let ((s (if (derived-mode-p 'org-mode)
+                               (org-format-outline-path (org-get-outline-path)
+                                                       (1- (frame-width))
+                                                       nil 
org-agenda-breadcrumbs-separator)
+                             ;; Not in Org buffer.  This can happen,
+                             ;; for example, in
+                             ;; `org-agenda-add-time-grid-maybe' where
+                             ;; time grid does not correspond to a
+                             ;; particular heading.
+                             "")))
+                   (if (equal "" s) "" (concat s 
org-agenda-breadcrumbs-separator))))))
        (setq time (cond (s2 (concat
                              (org-agenda-time-of-day-to-ampm-maybe s1)
                              "-" (org-agenda-time-of-day-to-ampm-maybe s2)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]