Bug: Entries with 0 minutes logged triggers clocking overlap [9.5 (nil @ /home/eddie/.emacs.d/.local/straight/build-26.3/org-mode/)]
Hi, Not uncommonly I will clock into a task that takes very little time, so that 0 minutes is logged against it, before logging in to the next task. When I run agenda mode with show-clocking errors, it will mark these two tasks as a clocking overlap, when in fact this was not the case. Currently to resolve this, every week I have to cull all clocking entries that are for 0 minutes. I feel better behaviour would be, in this situation to not trigger the clocking overlap. Thanks very much for reviewing this, and for org mode in general. This is a life changing software for me. Regards, - Eddie Drury Emacs : GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.14) of 2020-03-26, modified by Debian Package: Org mode version 9.5 (nil @ /home/eddie/.emacs.d/.local/straight/build-26.3/org-mode/) current state: == (setq org-duration-format 'h:mm org-footnote-auto-label 'plain org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer doom-modeline-set-org-src-modeline) org-fontify-whole-heading-line t org-link-shell-confirm-function 'yes-or-no-p org-mode-local-vars-hook '(eldoc-mode) org-babel-after-execute-hook '(org-redisplay-inline-images) org-insert-heading-respect-content t org-after-refile-insert-hook '(save-buffer) org-metadown-hook '(org-babel-pop-to-session-maybe) org-clock-out-hook '(org-clock-remove-empty-clock-drawer) org-refile-targets '((nil :maxlevel . 3) (org-agenda-files :maxlevel . 4)) org-html-format-inlinetask-function 'org-html-format-inlinetask-default-function org-enforce-todo-dependencies t org-time-stamp-rounding-minutes '(0 1) org-odt-format-headline-function 'org-odt-format-headline-default-function org-special-ctrl-a/e t org-imenu-depth 8 org-agenda-files '("~/orgnotes/transfer/transfer.org" "~/orgnotes/ casenotes.org") org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default org-reveal-start-hook '(org-decrypt-entry) org-export-with-section-numbers nil org-modules '(ol-bibtex) org-startup-folded t org-blocker-hook '(org-block-todo-from-children-or-siblings-or-parent) org-mode-hook '(er/add-org-mode-expansions my/org-mode-hook org-clock-load +lookup--init-org-mode-handlers-h (closure (t) (&rest _) (add-hook (quote before-save-hook) (quote org-encrypt-entries) nil t)) #[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] doom-disable-show-paren-mode-h doom-disable-show-trailing-whitespace-h +org-enable-auto-reformat-tables-h +org-enable-auto-update-cookies-h +org-make-last-point-visible-h evil-org-mode toc-org-enable embrace-org-mode-hook org-eldoc-load +literate-enable-recompile-h) org-clock-persist 'history org-export-with-smart-quotes t org-odt-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"] org-outline-path-complete-in-steps nil org-archive-hook '(org-attach-archive-delete-maybe) org-agenda-finalize-hook '(+org-exclude-agenda-buffers-from-workspace-h +org-defer-mode-in-agenda-buffers-h) org-startup-indented t org-reverse-note-order t 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-agenda-deadline-faces '((1.001 . error) (1.0 . org-warning) (0.5 . org-upcoming-deadline) (0.0 . org-upcoming-distant-deadline)) org-crypt-key nil org-babel-pre-tangle-hook '(save-buffer) org-tab-first-hook '(+org-yas-expand-maybe-h +org-indent-maybe-h org-babel-hide-result-toggle-maybe org-babel-header-arg-expand +org-cycle-only-current-subtree-h +org-clear-babel-results-h) org-hide-leading-stars t org-export-initial-scope 'subtree org-load-hook '(+org-init-org-directory-h +org-init-appearance-h +org-init-agenda-h +org-init-attachments-h +org-init-babel-h +org-init-babel-lazy-loader-h +org-init-capture-defaults-h +org-init-capture-frame-h +org-init-custom-links-h +org-init-export-h +org-init-habit-h +org-init-hacks-h +org-init-keybinds-h +org-init-popup-rules-h +org-init-protocol-h +org-init-protocol-lazy-loader-h
Re: Bug: Entries with 0 minutes logged triggers clocking overlap [9.5 (nil @ /home/eddie/.emacs.d/.local/straight/build-26.3/org-mode/)]
Hi, Eddie, I am not against fixing clocking overlap, however I personally deal with this by not clocking zero time at all. Are you aware about the existence of `org-clock-out-remove-zero-time-clocks'? Setting this variable to non-nil will remove clock lines when the resulting time is zero. Kind regards, Mikhail Skorzhinskii
Re: Using lexical-binding
Should I send a rebased patch for inclusion or do you want to give more time for people to try it out? Stefan
[PATCH] optimize org-refile-get-targets
On 05/03/2021 04:03, Samuel Wales wrote: interesting. that would be great to speed it up. [i just meant that the file list used to be correct.] I am a bit disappointed. I have managed to get x2 performance boost. At first, the result was x2 better but I realized that I did not added heading cleanup for the new strategy. It adds several regexp to the inner loop and severely hits performance. I do not like the idea to manually inline (with minor variations) existing functions and regexps, but the function is still slow. For a while, improvement is significant, so I am attaching the patch that should make jumps using org-goto or org-refile faster. I hope, I have not broken anything. commit 45cfa5b15e9009fee4f6a688caa210ff543b1ac1 Author: Max Nikulin Date: Sat Mar 6 22:14:39 2021 +0700 testing/lisp/test-org.el: More tests for `org-refile-get-targets' testing/lisp/test-org.el (test-org/refile-get-targets): Add a few more cases for the `org-refile-get-targets' function. - Fraction of completed subtasks is removed from heading. - `:level' filter ignores headings having over levels. - Outline path works with `:tag' filter. The aim is to increase coverage for experiments with optimizing of the function. diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el index 2d727ba7a..da313b45b 100644 --- a/testing/lisp/test-org.el +++ b/testing/lisp/test-org.el @@ -6369,6 +6369,27 @@ Paragraph" (let ((org-refile-use-outline-path t) (org-refile-targets `((nil :maxlevel . 1 (mapcar #'car (org-refile-get-targets)) + ;; When providing targets as paths, clean fraction cookie. + (should + (equal '("H1") + (org-test-with-temp-text "* H1 [1/1]" + (let ((org-refile-use-outline-path t) + (org-refile-targets '((nil :maxlevel . 1 + (mapcar #'car (org-refile-get-targets)) + ;; When providing targets as paths, intermediate paths are cached correctly. + (should + (equal '("H1/H2") + (org-test-with-temp-text "* Skip 1\n* H1\n*** Skip 2\n** H2\n*** Skip 3" + (let ((org-refile-use-outline-path t) + (org-refile-targets '((nil :level . 2 + (mapcar #'car (org-refile-get-targets)) + ;; When providing targets as paths, they are obtained correctly. + (should + (equal '("H1/H2" "H3") + (org-test-with-temp-text "* Skip 1\n* H1\n** Skip 2\n** H2 :take:\n* H3 :take:" + (let ((org-refile-use-outline-path t) + (org-refile-targets '((nil :tag . "take" + (mapcar #'car (org-refile-get-targets)) ;; When `org-refile-use-outline-path' is `file', include file name ;; without directory in targets. (should commit 58b477e999f3bb5b48c39fe0a4e5ad0d37e2bb9d Author: Max Nikulin Date: Sat Mar 6 22:44:27 2021 +0700 lisp/org-refile.el: Speed up `org-refile-get-targets' lisp/org-refile.el (org-refile-get-targets): Optimize performance by eliminating backward lookup of already seen headers. If configuration allows it, incrementally update current outline path. For dense target trees (`:maxlevel' and `:level') it allows to avoid "one step forward, two steps back" strategy that requires multiple backward searches for deeply nested headings. diff --git a/lisp/org-refile.el b/lisp/org-refile.el index 4e9f26eff..8e760f1c3 100644 --- a/lisp/org-refile.el +++ b/lisp/org-refile.el @@ -267,7 +267,8 @@ converted to a headline before refiling." (let ((case-fold-search nil) ;; otherwise org confuses "TODO" as a kw and "Todo" as a word (entries (or org-refile-targets '((nil . (:level . 1) - targets tgs files desc descre) + targets tgs files desc descre + outline-path cache-outline-path target-outline-level) (message "Getting targets...") (with-current-buffer (or default-buffer (current-buffer)) (dolist (entry entries) @@ -281,6 +282,11 @@ converted to a headline before refiling." ((and (symbolp files) (boundp files)) (setq files (symbol-value files (when (stringp files) (setq files (list files))) + (setq cache-outline-path (and org-refile-use-outline-path + (memq (car desc) '(:level :maxlevel + (setq target-outline-level + (if (and cache-outline-path (eq (car desc) :level)) + (if org-odd-levels-only (1- (* 2 (cdr desc))) (cdr desc (cond ((eq (car desc) :tag) (setq descre (concat "^\\*+[ \t]+.*?:" (regexp-quote (cdr desc)) ":"))) @@ -288,13 +294,13 @@ converted to a headline before refiling." (setq descre (concat "^\\*+[ \t]+" (regexp-quote (cdr desc)) "[ \t]"))) ((eq (car desc) :regexp) (setq descre (cdr desc))) - ((eq (car desc) :level) + ((and (not target-outline-level) (eq (car desc) :level)) (setq descre (concat "^\\*\\{" (number-to-string (if org-odd-levels-only (1- (* 2 (cdr desc))) (cdr desc))) "\\}[ \t]"))) - ((eq (car desc) :maxlevel) + ((memq (car desc) '(:level :maxlevel)) (setq descre (concat "^\\*\\{1
Re: Using lexical-binding
Stefan Monnier writes: > Should I send a rebased patch for inclusion Yes, please. > or do you want to give more time for people to try it out? My guess is that we won't hear much more without bringing the changes into master, and I'm in favor of doing so given that Marco and I have both used it for a good amount of time without finding issues. (Thanks, Marco, for trying it out.) Thank you.
Org as a book publisher
Hi, I would like to share here two samples of one of the most intense uses that I give Org Mode: for typesetting, layout and editorial design. In other words, I use Org (and Org-Publish) where publishers today use DTP proprietary software like InDesign or QuarkXpress (a type of software, on the other hand, that was never intended to compose books but rather magazines, posters, brochures and so on). The samples are from a book on classical philology, recently published here in Spain, and from a fairly extensive dictionary, still work in progress: https://imgur.com/gallery/yxAVkrY Naturally, what acts in the background here is TeX and LaTeX (specifically Lua(La)TeX), so what I really do is use Org and Org-Publish as a sort of high-level interface for LaTeX. But I don't mean to avoid LaTeX: in fact, I've been working with LaTeX for a long time. I like LaTeX and behind these jobs there is a lot of LaTeX code. But Org gives me a much more light and productive workflow, allowing me to work at two levels. The main advantages that I see for this workflow with Org/Org-Publish are: 1. Lightness: LaTeX is too verbose. 2. Control of the composition process at various points. One of the qualities of LuaTeX is the possibility to control TeX primitives through scripts in Lua, and to act at various points in the pre- or post-process. But I have realized that with the happy fusion of Elisp and Org we can be much more precise and "surgical" ;-). Here, Org/LaTeX is much more powerful than LuaLaTeX. 3. Org's synaptic and org-anizational ability to control and manage the entire process of the creation of a book, from when the originals are received until everything is prepared to send to the printer. 4. An unique origin. The book can be produced on paper from a single source, but you can also export, from that source consistently, to other formats (HTML or Epub). Best regards, Juan Manuel
Re: Using lexical-binding
>> Should I send a rebased patch for inclusion > Yes, please. Here it is, Stefan >From ba61c9660fc09321f9dfe5f746705f5d1202c474 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 23 Feb 2021 15:47:29 -0500 Subject: [PATCH] * lisp/org-agenda.el: Use lexical-binding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Removed the global (defvar date) and (defvar entry) so as not to conflict with function arguments of that name. Instead I added such `defvar`s in the body of each of the functions where it seemed needed. - I added some FIXMEs for some issues I found along the way. - Added an `org-dlet` macro, just like I had done for `calendar-dlet`, but I also use `defvar` "manually" at some places, when splitting an existing `let` into a mix of `let`s and `dlet`s seemed too much trouble. - Removed uses of `org-let and `org-let2` not only because I consider them offensive to my sense of aesthetics but also because they're basically incompatible with lexical scoping. I replaced them with uses of `cl-progv` which are a bit more verbose. Maybe we should define some `org-progv` macro on top of `cl-progv` to make the code less verbose, but I didn't do that because I like the fact that the current code makes uses of `eval` a bit more obvious (since these behave differently with lexical scoping than with lexical binding, it seemed worthwhile). - Removed the use of `eval` in `org-store-agenda-views` which was only placed there in order to use a macro before it's defined (it would have been simpler/cleaner to just move that functions *after* the macro, but with the new code the problem doesn't occur any more anyway). - Replaced a few `(lambda...) with actual closures. Detailed changes follow: (date, entry): Don't declare as being globally dynbound. (org-agenda-format-date-aligned): Remove unused var `weekyear`. (org-agenda-mode): `run-mode-hooks` is always available nowadays. (org-agenda-undo): Remove unused var `last-undo-buffer`. (org-agenda): Rename arg to `keys` and then dyn-bind it as `org-keys`. Remove unused vars `buf` and `key`. (org-agenda): Use `pcase` and `cl-progv` instead of `org-let`. (org-let, org-let2): Mark as obsolete. (org-agenda-run-series): Use `cl-progv` instead of `org-let` and `org-let2`. (org-agenda-run-series): New function. (org--batch-agenda): New function extracted from `org-batch-agenda`. (org-batch-agenda): Use it. (org--batch-agenda-csv): New function extracted from `org-batch-agenda-csv`. (org-batch-agenda-csv): Use it. (org--batch-store-agenda-views): New function, extracted from `org-batch-store-agenda-views`. (org-store-agenda-views, org-batch-store-agenda-views): Use it. (org--batch-store-agenda-views): Use `cl-progv` instead of `org-eval-in-environment`. (org-agenda-write): Use `cl-progv` instead of `org-let`. Use `with-current-buffer`. (org-agenda-filter-any): Use `cl-some` instead of `eval`. (org-agenda-list): Remove unused var `e`. (org-search-view): η-reduce. (crm-separator): Declare var. (org-agenda-skip-if): Remove unused var `beg`. (org-agenda-list-stuck-projects): Use a closure rather than `(lambda..). (diary-modify-entry-list-string-function, diary-file-name-prefix) (diary-display-function): Declare vars. (org-diary): Declare `date` and `entry` as dynbound. (org-agenda-get-day-entries): Use `org-dlet`. (org-agenda-get-timestamps, org-agenda-get-progress) (org-agenda-get-deadlines, org-agenda-get-scheduled, org-agenda-get-blocks): Declare `date` as dynbound. (org-agenda-get-sexps, org-class): Declare `date` and `entry` as dynbound. (org-agenda-format-item): Declare the vars mentioned in `org-compile-prefix-format` as dyn-bound. Also binding `extra`, suggested by Kyle Meyer . (org-compile-prefix-format): Remove unused var `e`. Use `member` rather than or+equal. (org-set-sorting-strategy): Minor simplification. (org-entries-lessp): Use `org-dlet`. (org-agenda-redo): Declare var `org-agenda-tag-filter-while-redo`. (org-agenda-redo): Use `cl-progv` rather than `org-let`. (org-agenda-filter): Remove unused var `rpl-fn`. Use `org-pushnew-to-end` to replace `add-to-list` on lexical var. (org-agenda-filter-by-tag): Remove unused var `n`. (org-agenda-filter-apply): Use `org-dlet`. (org-agenda-compute-starting-span): Remove unused var `dg`. (org-agenda-forward-block): Remove unused var `pos`. (org-archive-from-agenda): Declare var. (org-agenda-refile): Remove unused var `pos`. (org-agenda-headline-snapshot-before-repeat): Declare var. (org-agenda-todo): Remove redundant use of `bound-and-true-p`. (org-agenda-add-note): Remove unused var `hdmarker` and unused `arg`. (org-agenda-change-all-lines): Remove unused var `pl`. (org-agenda-priority): Remove unused var `marker`. (org-agenda-set-effort): Remove unused var `newhead`. (org-agenda-schedule): Remove unused var `type`. (org-agenda-clock-cancel): Remove unused `arg`. (org-agenda-execute-calendar-command): Use `org-dlet`. (org-agenda-bulk-acti
Org agenda to Android calendar without Google Calendar in the middle
I had been using mobileorg to transfer agenda items to my phone calendar, but mobileorg seems to be unmaintained.I live in China, which presents challenges accessing Google online apps.The org manual page about syncing my agenda to my phone seems to rely pretty heavily on an online Google Calendar as an intermediary (including org-caldav, if I'm understanding the readme correctly.) This means the "normal" way to sync org with Android may simply not work for me.Ideally, I'd prefer to use a local web server that I control. How would I do that? (Or, is it impossible? Which might be the case if the Android calendar will sync only to Google and nowhere else.)Thanks.hjh