From fd4ade40ed3ce135495796401296d318f2475352 Mon Sep 17 00:00:00 2001 From: Martin Kampas Date: Mon, 23 Apr 2018 19:27:18 +0200 Subject: [PATCH 1/6] org-collector.el: Inhibit lisp evaluation of headlines * contrib/lisp/org-collector.el (org-propview-collect): Inhibit lisp evaluation of headlines This fixes org-collector usage for items starting with a hyperlink, which would be incorrectly treated as lisp code. --- contrib/lisp/org-collector.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/lisp/org-collector.el b/contrib/lisp/org-collector.el index 1d2351923..833ecbf51 100644 --- a/contrib/lisp/org-collector.el +++ b/contrib/lisp/org-collector.el @@ -186,7 +186,8 @@ variables and values specified in props" (header-props (mapcar (lambda (props) (mapcar (lambda (pair) - (cons (car pair) (org-babel-read (cdr pair)))) + (let ((inhibit-lisp-eval (string= (car pair) "ITEM"))) + (cons (car pair) (org-babel-read (cdr pair) inhibit-lisp-eval)))) props)) header-props)) ;; collect all property names From 8944b578b86dd3c16e568e905b43e5fa6cfa5e68 Mon Sep 17 00:00:00 2001 From: Allen Li Date: Sat, 30 Dec 2017 03:41:51 -0800 Subject: [PATCH 2/6] Remove agenda-archives even with buffer restriction * lisp/org-agenda.el (org-search-view): Remove agenda-archives even with buffer restriction. --- lisp/org-agenda.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 78f67cccf..ed48c3083 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -4487,9 +4487,9 @@ is active." (setq files (org-agenda-files nil 'ifmode)) ;; Add `org-agenda-text-search-extra-files' unless there is some ;; restriction. - (unless (get 'org-agenda-files 'org-restrict) - (when (eq (car org-agenda-text-search-extra-files) 'agenda-archives) - (pop org-agenda-text-search-extra-files) + (when (eq (car org-agenda-text-search-extra-files) 'agenda-archives) + (pop org-agenda-text-search-extra-files) + (unless (get 'org-agenda-files 'org-restrict) (setq files (org-add-archive-files files)))) ;; Uniquify files. However, let `org-check-agenda-file' handle ;; non-existent ones. From 2742211ec69eebe5de8539b1825cf0049adc0d46 Mon Sep 17 00:00:00 2001 From: Bastien Date: Thu, 26 Apr 2018 18:44:58 +0200 Subject: [PATCH 3/6] org-agenda.el: Fix bug when keyboard-quitting the match prompt * lisp/org-agenda.el (org-tags-view): Don't leave an empty *Org agenda* buffer when keyboard-quitting the match prompt. Thanks to Xu Chunyang for reporting this. --- lisp/org-agenda.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index ed48c3083..a6d1df4f9 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -4751,11 +4751,11 @@ The prefix arg TODO-ONLY limits the search to TODO entries." (format "*Org Agenda(%s:%s)*" (or org-keys (or (and todo-only "M") "m")) match) (format "*Org Agenda(%s)*" (or (and todo-only "M") "m"))))) + (setq matcher (org-make-tags-matcher match)) ;; Prepare agendas (and `org-tag-alist-for-agenda') before ;; expanding tags within `org-make-tags-matcher' (org-agenda-prepare (concat "TAGS " match)) - (setq matcher (org-make-tags-matcher match) - match (car matcher) + (setq match (car matcher) matcher (cdr matcher)) (org-compile-prefix-format 'tags) (org-set-sorting-strategy 'tags) From 407014e0684796862a1b1d707717f4fdbdccc7da Mon Sep 17 00:00:00 2001 From: Matt Lundin Date: Sun, 25 Mar 2018 22:11:09 -0500 Subject: [PATCH 4/6] Fix default directory for git-annex checks * lisp/org-attach.el: (org-attach-annex-get-maybe) Ensure shell command that checks whether a git-annex file exists is called from within the git-annex repository. Otherwise, it will result in an error. --- lisp/org-attach.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/org-attach.el b/lisp/org-attach.el index 9774e3a79..86516e270 100644 --- a/lisp/org-attach.el +++ b/lisp/org-attach.el @@ -319,7 +319,8 @@ the ATTACH_DIR property) their own attachment directory." (defun org-attach-annex-get-maybe (path) "Call git annex get PATH (via shell) if using git annex. Signals an error if the file content is not available and it was not retrieved." - (let ((path-relative (file-relative-name path))) + (let* ((default-directory (expand-file-name org-attach-directory)) + (path-relative (file-relative-name path))) (when (and (org-attach-use-annex) (not (string-equal From b1d084c1ab877a58b342ae4a8b8d844b9b54e625 Mon Sep 17 00:00:00 2001 From: Bastien Date: Thu, 26 Apr 2018 21:52:39 +0200 Subject: [PATCH 5/6] org.el: Fix bug when links contain special characters * lisp/org.el (org-open-link-from-string): Fix bug when links contain special characters. Thanks to Joon Ro for reporting this. --- lisp/org.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index 600693ba3..ebe9aceeb 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -10539,7 +10539,7 @@ Raise an error when there is nothing to follow. " (with-temp-buffer (let ((org-inhibit-startup (not reference-buffer))) (org-mode) - (insert s) + (insert (org-link-escape s)) (goto-char (point-min)) (when reference-buffer (setq org-link-abbrev-alist-local From f21fb8ad3b47409d5f86dbcff7c5d420c8503fbf Mon Sep 17 00:00:00 2001 From: Bastien Date: Thu, 26 Apr 2018 22:59:36 +0200 Subject: [PATCH 6/6] org-agenda.el: Fix bug when getting the warning delay of a deadline * lisp/org-agenda.el (org-agenda-get-deadlines): Fix bug when getting the warning delay of a deadline. Thanks to Alex Branham for reporting this. --- lisp/org-agenda.el | 41 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index a6d1df4f9..fd02089b8 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -5985,29 +5985,24 @@ specification like [h]h:mm." (org-agenda--timestamp-to-absolute s base 'future (current-buffer) pos))))) (diff (- deadline current)) - (suppress-prewarning - (let ((scheduled - (and org-agenda-skip-deadline-prewarning-if-scheduled - (org-entry-get nil "SCHEDULED")))) - (cond - ((not scheduled) nil) - ;; The current item has a scheduled date, so - ;; evaluate its prewarning lead time. - ((integerp org-agenda-skip-deadline-prewarning-if-scheduled) - ;; Use global prewarning-restart lead time. - org-agenda-skip-deadline-prewarning-if-scheduled) - ((eq org-agenda-skip-deadline-prewarning-if-scheduled - 'pre-scheduled) - ;; Set pre-warning to no earlier than SCHEDULED. - (min (- deadline - (org-agenda--timestamp-to-absolute scheduled)) - org-deadline-warning-days)) - ;; Set pre-warning to deadline. - (t 0)))) - (wdays (if suppress-prewarning - (let ((org-deadline-warning-days suppress-prewarning)) - (org-get-wdays s)) - (org-get-wdays s)))) + (wdays + (cond + ;; The current item has a scheduled date, so + ;; evaluate its prewarning lead time. + ((integerp org-agenda-skip-deadline-prewarning-if-scheduled) + ;; Use global prewarning-restart lead time. + org-agenda-skip-deadline-prewarning-if-scheduled) + ((eq org-agenda-skip-deadline-prewarning-if-scheduled + 'pre-scheduled) + ;; Set pre-warning to no earlier than SCHEDULED. + (min (- deadline + (org-agenda--timestamp-to-absolute + (org-entry-get nil "SCHEDULED"))) + org-deadline-warning-days)) + ;; Set pre-warning to 0 + (org-agenda-skip-deadline-prewarning-if-scheduled 0) + ;; Set pre-warning to deadline. + (t (org-get-wdays s))))) (cond ;; Only display deadlines at their base date, at future ;; repeat occurrences or in today agenda.