Bug: org-agenda-sort-notime-is-late is not correctly handled by timestamp comparison [9.4.6 (9.4.6-12-gdcc3a8-elpaplus @ /Users/charlestam/.emacs.d/elpa/org-plus-contrib-20210830/)]
org-agenda-sorting-strategy claims that scheduled-up (-down) causes items to be sorted in ascending (descending) order by scheduled timestamp. org-agenda-sort-notime-is-late claims that if it is non-nil, the absence of a timestamp is treated as being maximal. Instead, when using the scheduled-up (-down) sorting strategy, with non-nil org-agenda-sort-notime-is-late, the absence of a timestamp is treated as being minimal. Note that the documentation is not strictly wrong; the correct behavior is exhibited for time-of-day comparisons, just not timestamp comparisons. Steps to Reproduce: (setq org-agenda-sorting-strategy '((agenda scheduled-up) (todo scheduled-up) (tags scheduled-up) (search scheduled-up)) org-agenda-sort-notime-is-late t) Place the following text in an org agenda file: * Reproduce ordering bug ** TODO Early item SCHEDULED: <1990-01-01 Mon> ** TODO Late item SCHEDULED: <2020-01-01 Wed> ** TODO Unscheduled item (Replace TODO with any non-DONE todo state if you need to.) Place the point on the "Reproduce" item and `M-x org-agenda < < t` (that is, list all TODO items restricted to the "Reproduce" subtree). Expected: TODO Early item TODO Late item TODO Unscheduled item Actual: TODO Unscheduled item TODO Early item TODO Late item Suggested fix: Find `defsubst org-cmp-ts` in org-agenda.el. The definition of `def` in the `let*` should be something like (if org-agenda-sort-notime-is-late -1) (In the state dump below, `org-agenda-sort-notime-is-late` is not mentioned but has its default value of t.) Thanks, Charles Emacs : GNU Emacs 27.2 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60 Version 10.14.6 (Build 18G95)) of 2021-03-27 Package: Org mode version 9.4.6 (9.4.6-12-gdcc3a8-elpaplus @ /Users/charlestam/.emacs.d/elpa/org-plus-contrib-20210830/) current state: == (setq org-roam-db-location "/Users/charlestam/mise/roam/org-roam.db" org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer) org-after-todo-state-change-hook '(org-checklist) org-capture-prepare-finalize-hook '(org-roam-capture--install-finalize-h) org-link-shell-confirm-function 'yes-or-no-p org-expiry-wait "+30d" org-metadown-hook '(org-babel-pop-to-session-maybe) org-clock-out-hook '(org-clock-remove-empty-clock-drawer) org-roam-db-node-include-function #[0 "\300\207" [t] 1] org-refile-targets '((nil :maxlevel . 2) (org-agenda-files :maxlevel . 1)) org-html-format-inlinetask-function 'org-html-format-inlinetask-default-function org-pretty-entities t org-special-ctrl-a/e t org-agenda-files '("~/mise/TODO") org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default org-reveal-start-hook '(org-decrypt-entry) org-modules '(org-expiry org-habit ol-w3m ol-bbdb ol-bibtex ol-docview ol-gnus ol-info ol-irc ol-mhe ol-rmail ol-eww) org-startup-folded 'showall org-archive-location "%s_archive::datetree/" org-mode-hook '((lambda nil (font-lock-add-keywords nil '(("{{{.+}}}" 0 'org-macro-face))) (set-fill-column 92)) #[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 #[0 "\301\211 \207" [imenu-create-index-function org-imenu-get-tree] 2] turn-on-font-lock auto-fill-mode org-eldoc-load) org-tags-match-list-sublevels nil 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-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"] org-expiry-handler-function 'org-toggle-archive-tag org-agenda-deadline-faces '((1.0 . org-warning) (0.8 . org-imminent-deadline) (0.5 . org-upcoming-deadline) (0.0 . org-upcoming-distant-deadline)) org-babel-pre-tangle-hook '(save-buffer) org-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) org-hide-leading-stars t org-babel-load-languages '((python . t)) org-log-done 'time org-roam-capture-preface-hook '(org-roam-dailies--override-capture-time-h) org-hide-emphasis-markers t org-export-backends '(ascii html latex md) org-roam-completion-everywhere t org-roam-capture-templates '(("d" "default" plain "%?" :target (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+filetags: \n") :unnarrowed t) ("t"
Re: Bug: Off-by-one when archiving to top level date [9.3.6 (9.3.6-17-g389288-elpa @ /home/charlestam/.emacs.d/elpa/org-20200224/)]
Wow it's been a while. Sorry I dropped this! To reproduce the bug, open the following content in `emacs -q` and run org-archive-subtree on the TEST ITEM: #+COMMENT: Local Variables: #+COMMENT: mode: org #+COMMENT: org-archive-location: "::datetree/" #+COMMENT: org-odd-levels-only: t #+COMMENT: End: * TEST ITEM You can check that the indentation of the TEST ITEM is more correct if you set org-odd-levels-only to nil. More weirdness also happens if you set org-archive-location to "::datetree/* Archive Header" (while org-odd-levels-only is t). Charles On Wed, Sep 9, 2020 at 5:44 AM Bastien wrote: > Hi Charles, > > sorry for the late feedback. > > Charles Tam writes: > > > I am archiving subtrees of my main Orgmode document to a top-level > > datetree in a secondary file. When I do so, I expect something like > > the following: > > > > * 2020 > > *** 2020-02 February (org-odd-levels-only t) > > * 2020-02-27 Thursday > > *** Archived Item > > > > But instead I get > > > > * 2020 > > *** 2020-02 February > > * 2020-02-27 Thursday > > * Archived Item > > > > The archived item ends up as a sibling of the targeted date, instead > > of a child. This seems incorrect. > > What command or keybinding do you use when archiving? > > Can you provide a minimal step-by-step recipe to reproduce this bug > with emacs -q ? > > Thanks, > > -- > Bastien >
Bug: Off-by-one when archiving to top level date [9.3.6 (9.3.6-17-g389288-elpa @ /home/charlestam/.emacs.d/elpa/org-20200224/)]
I am archiving subtrees of my main Orgmode document to a top-level datetree in a secondary file. When I do so, I expect something like the following: * 2020 *** 2020-02 February (org-odd-levels-only t) * 2020-02-27 Thursday *** Archived Item But instead I get * 2020 *** 2020-02 February * 2020-02-27 Thursday * Archived Item The archived item ends up as a sibling of the targeted date, instead of a child. This seems incorrect. Thanks, Charles Emacs : GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.2), modified by Debian Package: Org mode version 9.3.6 (9.3.6-17-g389288-elpa @ /home/charlestam/.emacs.d/elpa/org-20200224/) current state: == (setq org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer) org-after-todo-state-change-hook '(org-clock-out-if-current) org-link-shell-confirm-function 'yes-or-no-p org-metadown-hook '(org-babel-pop-to-session-maybe) org-clock-out-hook '(org-clock-remove-empty-clock-drawer) org-html-format-inlinetask-function 'org-html-format-inlinetask-default-function org-special-ctrl-a/e t org-agenda-files '("~/mise/TODO") org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default org-reveal-start-hook '(org-decrypt-entry) org-modules '(org-w3m org-bbdb org-bibtex org-docview org-gnus org-info org-irc org-mhe org-rmail org-eww) org-link-doi-server-url "http://dx.doi.org/; org-archive-location "%s_archive::datetree/" org-mode-hook '((closure (org--rds reftex-docstruct-symbol org-with-time org-defdecode org-def org-read-date-inactive org-ans2 org-ans1 org-columns-current-fmt-compiled org-end-time-was-given org-time-was-given org-blocked-by-checkboxes org-state org-agenda-headline-snapshot-before-repeat org-capture-last-stored-marker org-struct-menu org-last-state org-id-track-globally texmathp-why remember-data-file iswitchb-temp-buflist calc-embedded-open-mode calc-embedded-open-formula calc-embedded-close-formula align-mode-rules-list org-export-registered-backends org-indent-indentation-per-level org-inlinetask-min-level t) nil (add-hook (quote change-major-mode-hook) (quote org-show-all) (quote append) (quote local)) ) (closure (*this* org-babel-confirm-evaluate-answer-no t) nil (add-hook (quote change-major-mode-hook) (quote org-babel-show-result-all) (quote append) (quote local)) ) (closure (t) nil (setq imenu-create-index-function (quote org-imenu-get-tree))) (lambda nil (auto-fill-mode t) (local-set-key (kbd "M-[") (quote org-metaleft)) (local-set-key (kbd "M-]") (quote org-metaright)) (local-set-key (kbd "M-{") (quote org-shiftmetaleft)) (local-set-key (kbd "M-}") (quote org-shiftmetaright)) (local-set-key (kbd "") (quote org-shifttab)) (local-unset-key (kbd "C-c C-j")) (local-unset-key (kbd "C-,"))) turn-on-font-lock (lambda nil (font-lock-add-keywords nil (quote (("{{{.+}}}" 0 (quote org-macro-face)) #[0 "\301\211 \207" [imenu-create-index-function org-imenu-get-tree] 2] #[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-latex-format-drawer-function '(closure (t) (_ contents) contents) org-babel-pre-tangle-hook '(save-buffer) org-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) org-hide-leading-stars t org-babel-load-languages '((python . t)) org-clock-clocktable-default-properties '(:maxlevel 2 :scope file) org-log-done 'time org-hide-emphasis-markers t org-export-backends '(ascii html latex md) org-ascii-format-drawer-function '(closure (t) (_name contents _width) contents) org-use-fast-todo-selection t org-occur-hook '(org-first-headline-recenter) org-agenda-start-with-log-mode t org-odd-levels-only t org-structure-template-alist '(("n" "#+NAME: ?") ("p" "#+BEGIN_SRC python?\n#+END_SRC") ("a" . "export ascii") ("c" . "center") ("C" . "comment")