* Escaping org mode date properties @ 2022-01-01 12:24 Eduardo Suarez 2022-01-01 15:10 ` Ihor Radchenko 0 siblings, 1 reply; 8+ messages in thread From: Eduardo Suarez @ 2022-01-01 12:24 UTC (permalink / raw) To: emacs-orgmode The next code snippet makes the entry to appear in the agenda: * sample date code #+begin_src org SCHEDULED: <2015-02-16 Mon .+2d> #+end_src I have also tried without success: - using begin_example, - preceding with comma, - special edit, - starting the line with colon. Any hint? On the other hand, I wonder whether it is possible to make a subtree to be ignored by the agenda views. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Escaping org mode date properties 2022-01-01 12:24 Escaping org mode date properties Eduardo Suarez @ 2022-01-01 15:10 ` Ihor Radchenko 2022-01-01 20:01 ` Eduardo Suarez-Santana 0 siblings, 1 reply; 8+ messages in thread From: Ihor Radchenko @ 2022-01-01 15:10 UTC (permalink / raw) To: Eduardo Suarez; +Cc: emacs-orgmode Eduardo Suarez <esuarez@itccanarias.org> writes: > The next code snippet makes the entry to appear in the agenda: > > * sample date code > #+begin_src org > SCHEDULED: <2015-02-16 Mon .+2d> > #+end_src I am unable to reproduce. What are your Org and Emacs versions? > Any hint? Update org? > On the other hand, I wonder whether it is possible to make a subtree to be > ignored by the agenda views. Depending what you want, you may use org-agenda-todo-list-sublevels or add agenda filter excluding specific tags that you can then use to mark undesired subtrees. Best, Ihor ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Escaping org mode date properties 2022-01-01 15:10 ` Ihor Radchenko @ 2022-01-01 20:01 ` Eduardo Suarez-Santana 2022-01-02 2:51 ` [PATCH] " Ihor Radchenko 0 siblings, 1 reply; 8+ messages in thread From: Eduardo Suarez-Santana @ 2022-01-01 20:01 UTC (permalink / raw) To: Ihor Radchenko; +Cc: emacs-orgmode On Sat, Jan 01, 2022 at 11:10:30PM +0800, Ihor Radchenko wrote: > Eduardo Suarez <esuarez@itccanarias.org> writes: > > > The next code snippet makes the entry to appear in the agenda: > > > > * sample date code > > #+begin_src org > > SCHEDULED: <2015-02-16 Mon .+2d> > > #+end_src > > I am unable to reproduce. What are your Org and Emacs versions? I'm using Spacemacs (develop branch). - Emacs 27.2 - Org 9.5.1 I get a weird behaviour about it. These events appear when I start emacs. If I edit somehow these entries they disappear from the agenda view (until I start emacs again). > > On the other hand, I wonder whether it is possible to make a subtree to be > > ignored by the agenda views. > > Depending what you want, you may use org-agenda-todo-list-sublevels or > add agenda filter excluding specific tags that you can then use to mark > undesired subtrees. Could be a workaround. Thanks a lot. Anyway it looks like a bug to me. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] Re: Escaping org mode date properties 2022-01-01 20:01 ` Eduardo Suarez-Santana @ 2022-01-02 2:51 ` Ihor Radchenko 2022-01-02 21:04 ` Eduardo Suarez-Santana 0 siblings, 1 reply; 8+ messages in thread From: Ihor Radchenko @ 2022-01-02 2:51 UTC (permalink / raw) To: Eduardo Suarez-Santana; +Cc: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 1379 bytes --] Eduardo Suarez-Santana <esuarez@itccanarias.org> writes: >> I am unable to reproduce. What are your Org and Emacs versions? > > I'm using Spacemacs (develop branch). > > - Emacs 27.2 > - Org 9.5.1 > > I get a weird behaviour about it. These events appear when I start emacs. If I > edit somehow these entries they disappear from the agenda view (until I start > emacs again). Confirmed Thanks for the hint! I was able to reproduce entries disappearing from agenda view. The culprit is org-in-src-block-p. It relies on fontification to determine if we are inside a code block. However, when you strip a code block with SCHEDULED inside from begin/end lines, the fontification properties do not get removed. The attached patch should fix the issue. However, I need several people to test it first - the patch will make things slower without cache. >> Depending what you want, you may use org-agenda-todo-list-sublevels or >> add agenda filter excluding specific tags that you can then use to mark >> undesired subtrees. > > Could be a workaround. Thanks a lot. > > Anyway it looks like a bug to me. For future. You will make things much easier if you provide a clear sequence of steps to reproduce the problem. Your original report is not reproducible if I just copy-paste your code into a new org file. I had to guess what you did in order to see the problem. Best, Ihor [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-org-in-src-block-p-Do-not-rely-on-fontification.patch --] [-- Type: text/x-diff, Size: 2088 bytes --] From 0f046ebe94bbe84ac2f167feda527022bfac4e6e Mon Sep 17 00:00:00 2001 Message-Id: <0f046ebe94bbe84ac2f167feda527022bfac4e6e.1641091542.git.yantar92@gmail.com> From: Ihor Radchenko <yantar92@gmail.com> Date: Sun, 2 Jan 2022 10:30:03 +0800 Subject: [PATCH] org-in-src-block-p: Do not rely on fontification * lisp/org.el (org-in-src-block-p): New optional argument ELEMENT. The code now relies on org-element API to check if we are inside src-block. Fixes https://list.orgmode.org/20220101200103.GB29829@itccanarias.org/T/#t --- lisp/org.el | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 8c09a057c..7ea8d65f3 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -18731,17 +18731,19 @@ (defun org-uuidgen-p (s) "Is S an ID created by UUIDGEN?" (string-match "\\`[0-9a-f]\\{8\\}-[0-9a-f]\\{4\\}-[0-9a-f]\\{4\\}-[0-9a-f]\\{4\\}-[0-9a-f]\\{12\\}\\'" (downcase s))) -(defun org-in-src-block-p (&optional inside) +(defun org-in-src-block-p (&optional inside element) "Whether point is in a code source block. When INSIDE is non-nil, don't consider we are within a source -block when point is at #+BEGIN_SRC or #+END_SRC." - (let ((case-fold-search t)) - (or (and (eq (get-char-property (point) 'src-block) t)) - (and (not inside) - (save-match-data - (save-excursion - (beginning-of-line) - (looking-at ".*#\\+\\(begin\\|end\\)_src"))))))) +block when point is at #+BEGIN_SRC or #+END_SRC. +When ELEMENT is provided, it is considered to be element at point." + (save-match-data (setq element (or element (org-element-at-point)))) + (when (eq 'src-block (org-element-type element)) + (or (not inside) + (not (or (= (line-beginning-position) + (org-element-property :post-affiliated element)) + (= (1+ (line-end-position)) + (- (org-element-property :end element) + (org-element-property :post-blank element)))))))) (defun org-context () "Return a list of contexts of the current cursor position. -- 2.34.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] Re: Escaping org mode date properties 2022-01-02 2:51 ` [PATCH] " Ihor Radchenko @ 2022-01-02 21:04 ` Eduardo Suarez-Santana 2022-01-03 3:39 ` Ihor Radchenko 0 siblings, 1 reply; 8+ messages in thread From: Eduardo Suarez-Santana @ 2022-01-02 21:04 UTC (permalink / raw) To: Ihor Radchenko; +Cc: emacs-orgmode On Sun, Jan 02, 2022 at 10:51:54AM +0800, Ihor Radchenko wrote: > Eduardo Suarez-Santana <esuarez@itccanarias.org> writes: > > >> I am unable to reproduce. What are your Org and Emacs versions? > > > > I'm using Spacemacs (develop branch). > > > > - Emacs 27.2 > > - Org 9.5.1 > > > > I get a weird behaviour about it. These events appear when I start emacs. If I > > edit somehow these entries they disappear from the agenda view (until I start > > emacs again). > > Confirmed > > Thanks for the hint! I was able to reproduce entries disappearing from > agenda view. > > The culprit is org-in-src-block-p. It relies on fontification to > determine if we are inside a code block. However, when you strip a code > block with SCHEDULED inside from begin/end lines, the fontification > properties do not get removed. > > The attached patch should fix the issue. However, I need several people > to test it first - the patch will make things slower without cache. > The patch works for me. However, how about next cases? * an example block #+begin_example SCHEDULED: <2015-02-16 Mon .+2d> #+end_example * an example with colon : SCHEDULED: <2015-02-16 Mon .+2d> I think they behave the same way as 'begin_src'. > >> Depending what you want, you may use org-agenda-todo-list-sublevels or > >> add agenda filter excluding specific tags that you can then use to mark > >> undesired subtrees. > > > > Could be a workaround. Thanks a lot. > > > > Anyway it looks like a bug to me. > > For future. You will make things much easier if you provide a clear > sequence of steps to reproduce the problem. Your original report is not > reproducible if I just copy-paste your code into a new org file. I had > to guess what you did in order to see the problem. Sorry about that. I got weird results and was not sure about the expected behaviour. I had already asked in IRC with no answer. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Re: Escaping org mode date properties 2022-01-02 21:04 ` Eduardo Suarez-Santana @ 2022-01-03 3:39 ` Ihor Radchenko 2022-01-03 10:39 ` Eduardo Suarez-Santana 0 siblings, 1 reply; 8+ messages in thread From: Ihor Radchenko @ 2022-01-03 3:39 UTC (permalink / raw) To: Eduardo Suarez-Santana; +Cc: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 1524 bytes --] Eduardo Suarez-Santana <esuarez@itccanarias.org> writes: > However, how about next cases? > > * an example block > #+begin_example > SCHEDULED: <2015-02-16 Mon .+2d> > #+end_example I am unable to reproduce this using Org 9.5.2 Can you provide concrete steps starting from bare Emacs how to reproduce the inconsistency you are seeing? > * an example with colon > : SCHEDULED: <2015-02-16 Mon .+2d> > I think they behave the same way as 'begin_src'. If you mean that adding example/fixed-width environment does not make disappear, I am unable to reproduce. However, the second case is wrongly recognised as a heading with timestamp. Can you try the attached patch? (on top of previous) >> For future. You will make things much easier if you provide a clear >> sequence of steps to reproduce the problem. Your original report is not >> reproducible if I just copy-paste your code into a new org file. I had >> to guess what you did in order to see the problem. > > Sorry about that. I got weird results and was not sure about the expected > behaviour. I had already asked in IRC with no answer. "Weird" usually means that you expect some behaviour, but get surprised. However, for a person far away using different environment and settings (me), it is hard to guess about what went wrong without knowing details of what you did, what you expected, and what went wrong. See https://orgmode.org/worg/org-contribute.html and https://www.chiark.greenend.org.uk/~sgtatham/bugs.html for detailed instructions. Best, Ihor [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-org-agenda-get-timestamps-Ignore-non-timestamps-matc.patch --] [-- Type: text/x-diff, Size: 1586 bytes --] From 0d91c1bd81cb6fe19666761e50fb1368add385a8 Mon Sep 17 00:00:00 2001 Message-Id: <0d91c1bd81cb6fe19666761e50fb1368add385a8.1641180460.git.yantar92@gmail.com> From: Ihor Radchenko <yantar92@gmail.com> Date: Mon, 3 Jan 2022 11:26:18 +0800 Subject: [PATCH] org-agenda-get-timestamps: Ignore non-timestamps matching re * lisp/org-agenda.el (org-agenda-get-timestamps): Explicitly confirm that object at point is a timestamp. Fixes https://list.orgmode.org/20220102210433.GC29829@itccanarias.org/T/#m39b80d45d7d6cfc6b713284365c283579ac94cb1 --- lisp/org-agenda.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index fed36ac9b..94aea1b0a 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -86,6 +86,8 @@ (declare-function org-add-archive-files "org-archive" (files)) (declare-function org-capture "org-capture" (&optional goto keys)) (declare-function org-clock-modify-effort-estimate "org-clock" (&optional value)) +(declare-function org-element-type "org-element" (&optional element)) + (defvar calendar-mode-map) (defvar org-clock-current-task) (defvar org-current-tag-alist) @@ -5729,7 +5731,8 @@ (defun org-agenda-get-timestamps (&optional deadlines) (org-at-planning-p) (org-before-first-heading-p) (and org-agenda-include-inactive-timestamps - (org-at-clock-log-p))) + (org-at-clock-log-p)) + (not (eq 'timestamp (org-element-type (org-element-context))))) (throw :skip nil)) (org-agenda-skip)) (let* ((pos (match-beginning 0)) -- 2.34.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] Re: Escaping org mode date properties 2022-01-03 3:39 ` Ihor Radchenko @ 2022-01-03 10:39 ` Eduardo Suarez-Santana 2022-01-12 13:14 ` Ihor Radchenko 0 siblings, 1 reply; 8+ messages in thread From: Eduardo Suarez-Santana @ 2022-01-03 10:39 UTC (permalink / raw) To: Ihor Radchenko; +Cc: emacs-orgmode On Mon, Jan 03, 2022 at 11:39:19AM +0800, Ihor Radchenko wrote: > Eduardo Suarez-Santana <esuarez@itccanarias.org> writes: > > > However, how about next cases? > > > > * an example block > > #+begin_example > > SCHEDULED: <2015-02-16 Mon .+2d> > > #+end_example > > I am unable to reproduce this using Org 9.5.2 > Can you provide concrete steps starting from bare Emacs how to reproduce > the inconsistency you are seeing? > > > * an example with colon > > : SCHEDULED: <2015-02-16 Mon .+2d> > > I think they behave the same way as 'begin_src'. > > If you mean that adding example/fixed-width environment does not make > disappear, I am unable to reproduce. > > However, the second case is wrongly recognised as a heading with timestamp. > > Can you try the attached patch? (on top of previous) > I hope this helps: 1. I removed my '~/.emacs.d' directory. 2. I started emacs. 3. I installed org-9.5.2 via 'list-packages' and the user interface. 4. I closed emacs. 5. I moved '~/.emacs' to '~/.emacs.d/init.el'. 6. I edited ~/.emacs.d/init.el' with the following contents. BEGIN Contents of '~/.emacs.d/init.el' (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(package-selected-packages '(org))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. ) (setq org-agenda-files '("~/sample.org")) END Contents of '~/.emacs.d/init.el' 7. I created '~/sample.org' with the following contents. BEGIN Contents of '~/sample.org' * TODO begin_src scheduled entry #+begin_src org SCHEDULED: <2022-01-03 Mon> #+end_src * TODO colon scheduled entry : SCHEDULED: <2022-01-03 Mon> * TODO begin_example scheduled entry #+begin_example SCHEDULED: <2022-01-03 Mon> #+end_example END Contents of '~/sample.org' 8. I started emacs. 9. I run 'M-x org-agenda' and then 'a' (agenda week view), and got next result in the agenda buffer: BEGIN Contents of '*Org Agenda*' Week-agenda (W01): Monday 3 January 2022 W01 sample: TODO begin_src scheduled entry sample: TODO colon scheduled entry sample: TODO begin_example scheduled entry Tuesday 4 January 2022 Wednesday 5 January 2022 Thursday 6 January 2022 Friday 7 January 2022 Saturday 8 January 2022 Sunday 9 January 2022 END Contents of '*Org Agenda*' 10. I closed emacs, applied *first patch* in this thread to '~/.emacs.d/elpa/org-9.5.2/org.el'. 11. I removed '~/.emacs.d/elpa/org-9.5.2/org.elc'. 12. I started emacs and run 'M-x org-agenda' and then 'a' (agenda week view), and got next result: BEGIN Contents of '*Org Agenda*' Week-agenda (W01): Monday 3 January 2022 W01 sample: TODO colon scheduled entry sample: TODO begin_example scheduled entry Tuesday 4 January 2022 Wednesday 5 January 2022 Thursday 6 January 2022 Friday 7 January 2022 Saturday 8 January 2022 Sunday 9 January 2022 END Contents of '*Org Agenda*' 13. I closed emacs, applied *second patch* in this thread to '~/.emacs.d/elpa/org-9.5.2/org-agenda.el'. 14. I removed '~/.emacs.d/elpa/org-9.5.2/org-agenda.elc'. 15. I started emacs and run 'M-x org-agenda' and then 'a' (agenda week view), and got next result: BEGIN Contents of '*Org Agenda*' Week-agenda (W01): Monday 3 January 2022 W01 Tuesday 4 January 2022 Wednesday 5 January 2022 Thursday 6 January 2022 Friday 7 January 2022 Saturday 8 January 2022 Sunday 9 January 2022 END Contents of '*Org Agenda*' Emacs : GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30) of 2021-10-20 Package: Org mode version 9.5.2 (9.5.2-gfbff08 @ /home/eduardo/.emacs.d/elpa/org-9.5.2/) current state: ============== (setq org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer) org-link-shell-confirm-function 'yes-or-no-p org-babel-after-execute-hook '(org-display-inline-images) org-metadown-hook '(org-babel-pop-to-session-maybe) org-agenda-files '("~/sample.org") org-mode-hook '(#[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-show-all append local] 5] #[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-babel-show-result-all append local] 5] org-babel-result-hide-spec org-babel-hide-all-hashes) org-archive-hook '(org-attach-archive-delete-maybe) org-confirm-elisp-link-function 'yes-or-no-p org-agenda-before-write-hook '(org-agenda-add-entry-text) org-metaup-hook '(org-babel-load-in-session-maybe) org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 "\n\n(fn ENTRY)"] org-babel-pre-tangle-hook '(save-buffer) org-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) org-babel-load-languages '((ditaa . t)) org-agenda-loop-over-headlines-in-active-region nil org-occur-hook '(org-first-headline-recenter) org-ditaa-jar-path "/usr/share/ditaa/ditaa.jar" org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers org-cycle-show-empty-lines org-optimize-window-after-visibility-change) org-speed-command-hook '(org-speed-command-activate org-babel-speed-command-activate) org-export-before-parsing-hook '(org-attach-expand-links) org-confirm-shell-link-function 'yes-or-no-p org-link-parameters '(("attachment" :follow org-attach-follow :complete org-attach-complete-link) ("id" :follow org-id-open) ("eww" :follow org-eww-open :store org-eww-store-link) ("rmail" :follow org-rmail-open :store org-rmail-store-link) ("mhe" :follow org-mhe-open :store org-mhe-store-link) ("irc" :follow org-irc-visit :store org-irc-store-link :export org-irc-export) ("info" :follow org-info-open :export org-info-export :store org-info-store-link) ("gnus" :follow org-gnus-open :store org-gnus-store-link) ("docview" :follow org-docview-open :export org-docview-export :store org-docview-store-link) ("bibtex" :follow org-bibtex-open :store org-bibtex-store-link) ("bbdb" :follow org-bbdb-open :export org-bbdb-export :complete org-bbdb-complete-link :store org-bbdb-store-link) ("w3m" :store org-w3m-store-link) ("doi" :follow org-link-doi-open :export org-link-doi-export) ("file+sys") ("file+emacs") ("shell" :follow org-link--open-shell) ("news" :follow #[514 "\301\300\302Q\x02\"\207" ["news" browse-url ":"] 6 "\n\n(fn URL ARG)"]) ("mailto" :follow #[514 "\301\300\302Q\x02\"\207" ["mailto" browse-url ":"] 6 "\n\n(fn URL ARG)"]) ("https" :follow #[514 "\301\300\302Q\x02\"\207" ["https" browse-url ":"] 6 "\n\n(fn URL ARG)"]) ("http" :follow #[514 "\301\300\302Q\x02\"\207" ["http" browse-url ":"] 6 "\n\n(fn URL ARG)"]) ("ftp" :follow #[514 "\301\300\302Q\x02\"\207" ["ftp" browse-url ":"] 6 "\n\n(fn URL ARG)"]) ("help" :follow org-link--open-help :store org-link--store-help) ("file" :complete org-link-complete-file) ("elisp" :follow org-link--open-elisp)) org-link-elisp-confirm-function 'yes-or-no-p org-ditaa-eps-jar-path "/home/eduardo/.emacs.d/elpa/contrib/scripts/DitaaEps.jar" ) ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Re: Escaping org mode date properties 2022-01-03 10:39 ` Eduardo Suarez-Santana @ 2022-01-12 13:14 ` Ihor Radchenko 0 siblings, 0 replies; 8+ messages in thread From: Ihor Radchenko @ 2022-01-12 13:14 UTC (permalink / raw) To: Eduardo Suarez-Santana; +Cc: emacs-orgmode Eduardo Suarez-Santana <esuarez@itccanarias.org> writes: > I hope this helps: > ... > * TODO begin_src scheduled entry > #+begin_src org > SCHEDULED: <2022-01-03 Mon> > #+end_src Thanks! It does help. I created a test case based on your steps. I pushed the two patches and the test to bugfix. Your issue should be fixed now. Best, Ihor ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-01-12 14:14 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-01-01 12:24 Escaping org mode date properties Eduardo Suarez 2022-01-01 15:10 ` Ihor Radchenko 2022-01-01 20:01 ` Eduardo Suarez-Santana 2022-01-02 2:51 ` [PATCH] " Ihor Radchenko 2022-01-02 21:04 ` Eduardo Suarez-Santana 2022-01-03 3:39 ` Ihor Radchenko 2022-01-03 10:39 ` Eduardo Suarez-Santana 2022-01-12 13:14 ` Ihor Radchenko
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.