Code Monkey home page Code Monkey logo

org-mru-clock's Introduction

org-mru-clock

https://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.

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)

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))
  :init
  (setq org-mru-clock-how-many 100
        org-mru-clock-completing-read #'ivy-completing-read))

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

unhammer avatar bhipple avatar

Watchers

James Cloos avatar

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.