dfeich / org-clock-convenience Goto Github PK
View Code? Open in Web Editor NEWConvenience functions to work with emacs org mode clocking
Convenience functions to work with emacs org mode clocking
First of all, thank you very much for org-clock-convenience! I am also tracking every minute of my work and have been looking for this for a long time.
Here's a partial suggestion for improvement: When I'm on a log line in an agenda view I'd like RET not to jump to the headline of the respective task, but to the precise clock entry.
As the latter does not yet work well with folding (it doesn't make the headline visible when it's been folded away – this might be reported as a separate issue here), I restricted this behaviour to work on the actual timestamps only.
Please find my code at https://github.com/clange/emacs/blob/master/.emacs.d/init/org-clock.el#L63 (the function) and https://github.com/clange/emacs/blob/master/.emacs.d/init/org-clock.el#L86 (the keybinding).
This is a feature request.
It often happens that one forgot to clock a certain time range, because e.g. one
was not sitting in front of the computer. At the end of the day I usually go
over the clocked times (e.g. with the agenda clockcheck mode). I would like to
be able and move the cursor to a clocked task and then insert a clocked task
that fills the time of the previous task and the task under the cursor.
If the task under the cursor is the first task of that day, it should insert
a minimum clock interval (e.g. 5 min) before the current line. Task selection
can be implemented through helm, etc.
As all other commands, it should not force me to leave the agenda mode.
Hi
First of all, thanks for your work!
This package requires org-mode 8 installed, which makes this version to be installed from melpa. It shouldn't happen. For example, I use org-mode from git and it install the melpa package anyway.
Thanks
This is a continuation of #9 (comment)
First of all, thanks for building this package---it really is such a convenience for org-clock.
I've noticed that sometimes, the package doesn't work on particular lines in my agenda---the culprit turns out to be that the line format is different from what org-clock-convenience-clocked-agenda-re
expects.
Digging deeper, I realized it's because i've set the following variable:
(setq org-agenda-prefix-format '((agenda . " %i %-12:c%?-12t%-6e% s")
(todo . " %i %-12:c %-6e")
(tags . " %i %-12:c")
(search . " %i %-12:c")))
(the agenda
item is the one that really matters here).
It'd be nice if there was some way to make org-clock-convenience-clocked-agenda-re
more robust to custom settings of org-agenda-prefix-format
, or at least document that only particular values of org-agenda-prefix-format
work well.
For the meanwhile, though, I'm happy to just remove / override this configuration line. I use org-agenda-custom-commands
, so I can override org-agenda-prefix-format
on a section-by-section basis (note the first block doesn't display the effort, while the third does).
(setq org-agenda-custom-commands
'(("c" "Day planner with To-Dos"
((agenda ""
((org-agenda-span 'day)
(org-deadline-warning-days 365)
(org-agenda-prefix-format " %i %-12:c%?-12t% s")
))
(alltodo ""
((org-agenda-overriding-header "To Refile")
(org-agenda-files '("~/git/gtd/inbox.org"))))
(alltodo ""
((org-agenda-overriding-header "Next actions")
(org-agenda-skip-function #'org-agenda-skip-all-siblings-but-first)
(org-agenda-prefix-format "%-32:(org-agenda-format-parent 30) %?-12t%-6e")
))
nil))
))
Hi,
I'm running into an issue after installing org-clock-convenience. When I try to use the fill-gap functions, the function does not work, producing an error message in the mini buffer:
Symbol’s value as variable is void: org-ts-regexp-inactive
The clock entries change in the agenda view, but the actual buffer is not update. Any idea what might be happening? Thanks in advance!
Hello,
I'm using Spacemacs, I have configured your snippet :
(defun dfeich/org-agenda-mode-fn ()
(define-key org-agenda-mode-map
(kbd "<S-up>") #'org-clock-convenience-timestamp-up)
(define-key org-agenda-mode-map
(kbd "<S-down>") #'org-clock-convenience-timestamp-down)
(define-key org-agenda-mode-map
(kbd "ö") #'org-clock-convenience-fill-gap)
(define-key org-agenda-mode-map
(kbd "é") #'org-clock-convenience-fill-gap-both))
(add-hook 'org-agenda-mode-hook #'dfeich/org-agenda-mode-fn)
When I try to shift clock, I have this error :
Wrong type argument: commandp, org-clock-convenience-timestamp-up
Best regards.
I can edit the clocked time log line (e.g. org-clock-convenience-timestamp-down
) for only the 1st line in the agenda view. It works for both hours and minutes but when I go to any other line, I get this error message in the minibuffer Error: not on a clocked time log line
.
org-clock-convenience version: 20160830.1856
cl-lib version: 1.0
Org mode version: 9.1.13
Emacs version: 26.1
Thanks for nifty functions. Here some ways I started using them. Feel free to include somewhere in the documentation for other to use.
use-package makes installation and configuration easy:
(use-package org-clock-convenience
:ensure t
:defer t
:bind (:map org-agenda-mode-map
("<S-up>" . org-clock-convenience-timestamp-up)
("<S-down>" . org-clock-convenience-timestamp-down)
("'" . org-clock-convenience-fill-gap)))
An entry for org-capture-templates that prompts for a tag, adds timestamp and category that is displayed in org agenda, and starts the clock:
("w" "work" entry (file+datetree "~/Dropbox/org/work.org")
"* %? %^g\n :PROPERTIES:\n :CREATED: %U\n :CATEGORY: work\n :END:\n%i"
:clock-in t :clock-keep t)
A function to delete the entry at point would be convenient.
(I asked at https://emacs.stackexchange.com/questions/81311/are-there-any-org-agenda-commands-to-delete-log-entries but I guess the answer is no, there is no built-in function; maybe it belongs in a package such as this.)
I used to be able to adjust the clock times in agenda mode, until about a month ago.
Do you have some tips for troubleshooting why it would no longer think that is a time range field? I included a screen shot of the agenda view and where point is when I issue the timestamp up command.
If I turn on debug on entry into the function I get:
Debugger entered--returning value: nil
#f(compiled-function () #<bytecode 0x1feb28dc2fc9>)()
I'm not sure what that "322" value being detected is or really what other terms I can search for to find the change in emacs, org, etc that caused this to stop working for me.
For now my workaround is to hit enter on the agenda item and then adjust the time in the org file, but I miss out on the fill gap function.
use-package
does not work for me, but alternative method works. Any idea why it does not work? Here is my config, I try to bind keys and override regex.
(use-package org-clock-convenience
:ensure t
:bind (:map org-agenda-mode-map
("<S-up>" . org-clock-convenience-timestamp-up)
("<S-down>" . org-clock-convenience-timestamp-down))
:init
(setq org-clock-convenience-clocked-agenda-re "^ +Clocked:[[:space:]]+\\(([0-9]+:[0-5][0-9])\\|(-)\\)[[:space:]]*|[[:space:]]*\\(\\([ \t012][0-9]\\):\\([0-5][0-9]\\)\\)\\(?:-\\(\\([ 012][0-9]\\):\\([0-5][0-9]\\)\\)\\|.*\\)?[[:space:]]?|[[:space:]]*\\([^ ]+\\)[[:space:]]*|"
org-clock-convenience-clocked-agenda-fields '(duration d1-time d1-hours d1-minutes d2-time d2-hours d2-minutes filename)
)
)
I got the updated org-clock-convenience package from melpa.org today and when I try to use the functions in Org Agenda to fix a clocked item, I get:
org-clock-convenience-open-if-in-drawer: Symbol’s function definition is void: org-clock-convenience-org-hide-drawer-toggle
(Edit - Just to be clear, it has been working fine and I use it almost daily.)
I see the code that is intended to run, but I'm not sure why it does not in my case.
Here is how I load the package:
(use-package org-clock-convenience
:ensure t
:after (org)
:bind (:map org-agenda-mode-map
("<S-up>" . org-clock-convenience-timestamp-up)
("<S-down>" . org-clock-convenience-timestamp-down)
("C-M-S-s-g" . org-clock-convenience-fill-gap)
("é" . org-clock-convenience-fill-gap-both)
))
I believe that my system is using Org from the Emacs master tree as shown in the version strings below:
Org mode version 9.5.3 (release_9.5.3-3-gd54104 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)
GNU Emacs 29.0.50 (build 1, x86_64-apple-darwin21.4.0, NS appkit-2113.40 Version 12.3.1 (Build 21E258)) of 2022-05-01
compiled from master be3267eb346745d73cfb627c6e962e261a51d6d2
Here is where you check for Org version older than 9.4. When I evaluate that test I get nil, since 9.5.3 is newer, as expected.
(eval-when-compile
(if (< emacs-major-version 25)
(defmacro org-clock-convenience-save-mark-and-excursion (&rest body)
`(save-excursion ,@body))
(defalias 'org-clock-convenience-save-mark-and-excursion
'save-mark-and-excursion))
(if (version< org-version "9.4")
(defmacro org-clock-convenience-org-hide-drawer-toggle (&optional
force no-error
element)
`(org-flag-drawer nil))
(defalias 'org-clock-convenience-org-hide-drawer-toggle
'org-hide-drawer-toggle)))
If I evaluate the else part of the if, then this defines the symbol and the issue is resolved for that session.
(defalias 'org-clock-convenience-org-hide-drawer-toggle
'org-hide-drawer-toggle)
If I look at help for one of the functions, I see that I have it native comp:
org-clock-convenience-fill-gap is an interactive native compiled Lisp
function in ‘org-clock-convenience.el’.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.