Giter VIP home page Giter VIP logo

org-mru-clock's Introduction

org-mru-clock

https://melpa.org/packages/org-mru-clock-badge.svg https://stable.melpa.org/packages/org-mru-clock-badge.svg

Do you often clock in to many different little tasks? Are you annoyed that you can’t just clock in to one of your most recent tasks after restarting Emacs?

org-mru-clock.gif

The function org-mru-clock-in from this package will pre-fill your clock history with clocks from your agenda files (and other open org files) so you can clock in to your most recent clocks regardless of whether you just started Emacs or have had it running for decades. Tasks are sorted by recency, and uses completing-read for quick selection. This makes it a nice replacement for org-clock-in-last.

It uses completing-read-function (overridable with org-mru-clock-completing-read) on org-mru-clock-in to make clocking in faster. If you set that to ivy-completing-read, you can hit M-o g to visit to the task heading instead of clocking in (there are also Embark actions if you prefer that – see Usage).

The list is sorted to keep the most recently clocked entry first, although if the entry at point is an org-mode heading (in an org file or the agenda), then that will be pushed to the top of the list (you can turn off this behaviour by setting org-mru-clock-include-entry-at-point to nil).

You can also use org-mru-clock-select-recent-task as a replacement for org-clock-select-task, again with pre-filled history.

You may also capture new tasks on the fly if your search text didn’t match anything – try C-h v org-mru-clock-capture-if-no-match RET.

Installation

MELPA

If you use MELPA, you can just do M-x list-packages, find org-mru-clock in the list and hit i x.

Manual

Just put org-mru-clock.el somewhere in load-path.

Usage

Manual, loading on startup:

To use, require and bind whatever keys you prefer to the interactive functions:

(require 'org-mru-clock)
(global-set-key (kbd "C-c C-x i") #'org-mru-clock-in)
(global-set-key (kbd "C-c C-x C-j") #'org-mru-clock-select-recent-task)

Maybe trade some initial slowness for more tasks cached:

(setq org-mru-clock-how-many 100)

But don’t set it higher than the actual number of tasks; then it’ll always try (and fail) to fill up the history cache!

If you want to use ivy for org-mru-clock-in:

(setq org-mru-clock-completing-read #'ivy-completing-read)

If you use the embark package, you can add actions with:

(add-hook 'minibuffer-setup-hook #'org-mru-clock-embark-minibuffer-hook)

With use-package

If you prefer use-package, the above settings would be:

(use-package org-mru-clock
  :ensure t
  :bind* (("C-c C-x i" . org-mru-clock-in)
          ("C-c C-x C-j" . org-mru-clock-select-recent-task))
  :config
  (setq org-mru-clock-how-many 100
        org-mru-clock-completing-read #'ivy-completing-read)
  (add-hook 'minibuffer-setup-hook #'org-mru-clock-embark-minibuffer-hook))

Other org-mru-clock settings

If you do

(setq org-mru-clock-keep-formatting t)

then entries will be shown in their org-mode faces, instead of whatever face your org-mru-clock-completing-read function uses by default.

If you do

(setq org-mru-clock-include-entry-at-point nil)

then the entry at point will not be prepended to the start of the list.

By default, all open org-mode files are searched for recent clocks, but you can change this to e.g. only the org-agenda-files with

(setq org-mru-clock-files #'org-agenda-files)

or some other function of your own devising.

You can also exclude clocks by setting org-mru-clock-predicate to e.g. org-entry-is-todo-p (which will exclude DONE tasks) or org-mru-clock-exclude-done-and-archived (which will also exclude those tagged with org-archive-tag).

Related settings from org-clock

You may also be interested in these general org-clock settings (documented in the Org-mode manual):

(setq org-clock-persist t)
(org-clock-persistence-insinuate)

org-mru-clock's People

Contributors

bhipple avatar deftsp avatar unhammer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

org-mru-clock's Issues

Bad Bounding indices 0,43

Debugger entered--Lisp error: (error "Bad bounding indices: 0, 43")
signal(error ("Bad bounding indices: 0, 43"))
error("%s" "Bad bounding indices: 0, 43")
cl-subseq((#<marker (moves after insertion) at 73765 in newgtd.org> #<marker (moves after insertion) at 61780 in newgtd.org> #<marker (moves after insertion) at 159358 in newgtd.org> #<marker (moves after insertion) at 160657 in newgtd.org> #<marker (moves after insertion) at 162969 in newgtd.org> #<marker (moves after insertion) at 163731 in newgtd.org> #<marker (moves after insertion) at 162235 in newgtd.org> #<marker (moves after insertion) at 399624 in notes.org> #<marker (moves after insertion) at 165481 in newgtd.org> #<marker (moves after insertion) at 165058 in newgtd.org> #<marker (moves after insertion) at 164459 in newgtd.org> #<marker (moves after insertion) at 57564 in newgtd.org> #<marker (moves after insertion) at 161814 in newgtd.org> #<marker (moves after insertion) at 29221 in idea.org> #<marker (moves after insertion) at 398942 in notes.org> #<marker (moves after insertion) at 108748 in newgtd.org> #<marker (moves after insertion) at 158915 in newgtd.org> #<marker (moves after insertion) at 398482 in notes.org> #<marker (moves after insertion) at 155868 in newgtd.org> #<marker (moves after insertion) at 147108 in newgtd.org>) 0 43)
org-mru-clock-select-workaround-history()
(let* ((org-clock-history (org-mru-clock-select-workaround-history)) (m (org-clock-select-task "Select recent task: "))) (if m (progn (switch-to-buffer (marker-buffer m)) (goto-char (marker-position m)) (org-up-element) (org-show-subtree))))
org-mru-clock-select-recent-task(nil)
funcall-interactively(org-mru-clock-select-recent-task nil)
#(org-mru-clock-select-recent-task nil nil)
apply(# org-mru-clock-select-recent-task (nil nil))
call-interactively@ido-cr+-record-current-command(# org-mru-clock-select-recent-task nil nil)
apply(call-interactively@ido-cr+-record-current-command # (org-mru-clock-select-recent-task nil nil))
call-interactively(org-mru-clock-select-recent-task nil nil)
command-execute(org-mru-clock-select-recent-task)

Allow to capture and clock in simultaneously

Often I want to clock into a task which I'm not sure I've already created, that means I have to first attempt to clock in, and if it's not there then I have to cancel and capture the new task.

It would be great to be able to be able use the non-matching search as input to a pre-set capture template.

the included heading-at-point shows wrong parent heading

When doing org-mru-clock-in with point on a heading, that heading is included at the top of the list. But if the buffer is narrowed to that heading (org-narrow-to-subtree), we see the heading as its own parent, instead of the real parent.

`org-mru-clock-select-recent` doesn't select `d`, `i`, or `c`

Using doom-emacs and creating the mru cache from org-agendas, whenever I trigger org-mru-clock-select-recent and select one of the default, interrupted, or current tasks I am sent to a different item in my org-journal folder (which is referenced at the bottom of my org-agenda-files).

DTRT on "Resume clock (Add frob) (y or n) y"

If Emacs was killed with an open clock, then re-opened and you do org-mru-clock-in, you'll be asked whether to resume the clock or not. If you resumed, there's no point in showing the completion menu.

Filter out DONE and archived items

When I'm clocking in, it's unlikely that I want to clock into a task that's in a completed state. I started looking into refactoring to allow us to install a list of predicate filter functions, but figured I'd open an issue in case you've already looked at implementing something like this.

Insert SCHEDULED items too?

If an item is SCHEDULED for today, but not yet clocked in to, it'd be nice if it were there in the org-mru-clock-in list, as a "suggestion".

  • Should we mark it in some way?
  • How far up the list should it be, if it's never been clocked in to?
  • Should we include things that were scheduled in the past, but not clocked in to? How far back then?
  • Will this make us much slower?

Typo in readme

(require 'org-mru-clocks) on line 46 should probably be (require 'org-mru-clock)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.