Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Easy org-clock-in and org-clock-out

NotificationsYou must be signed in to change notification settings

takaxp/org-onit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

https://github.com/takaxp/org-onit/workflows/Main%20workflow/badge.svg

Introduction

This package provides automatedorg-clock-in andorg-clock-out by addingDoing tag to a heading of an org mode buffer. While theDoing tag appears in an org buffer, Emacs Org mode maintains the task clocking.

You can say “I’m on it!”.

https://github.com/takaxp/contents/blob/master/org-onit/org-onit-toggle-doing.png

Install

Please putorg-onit.el into yourload-path.

If you usepackage.el or other package manager, no necessary to add(require 'org-onit) to yourinit.el and just call toggle commandsorg-onit-toggle-doing ororg-onit-toggle-auto in an org buffer.

Additional package

It is recommended to installorg-bookmark-heading because a normal jump by built-inbookmark.el is not sufficiently accurate for org buffers.org-bookmark-heading provides more precise jumping capability by adding ID property to each org mode heading.org-onit.el will useorg-bookmark-heading if available but not mandatory.

Recommend settings

Highly recommended

(with-eval-after-load"org-clock"  (setq org-clock-out-remove-zero-time-clockst))

Recommended keybindings

(with-eval-after-load"org"  (global-set-key (kbd"C-<f11>")'org-clock-goto)  (define-key org-mode-map (kbd"<f11>")'org-onit-toggle-doing)  (define-key org-mode-map (kbd"M-<f11>")'org-onit-toggle-auto)  (define-key org-mode-map (kbd"S-<f11>")'org-onit-goto-anchor))

Optional settings

You can freely arrangeorg-clock-frame-title-format. If you installorg-clock-toay.el in your system, then you can show a working time only for today.

(with-eval-after-load"org"  (add-to-list'org-tag-faces '("Doing":foreground"#FF0000"))  (add-hook'org-cycle-hook#'org-onit-clock-in-when-unfold))(with-eval-after-load"org-clock"  (setq org-clock-clocked-in-display'frame-title);; or 'both  (setq org-clock-frame-title-format        '((:eval (format"%s|%s|%s"                         (if org-onit--auto-clocking"Auto""")                         (org-onit-get-sign)                         org-mode-line-string)))))

How to use

Manual approach

If you apply the above recommended keybindings, then just type<f11> in an org buffer. A tag of a heading having the cursor will be changed toDoing and automatically start toorg-clock-in. You can go any buffers and do anything but you can go back to theDoing tagged heading by just typingC-<f11>. Typing<f11> again, thenorg-clock-out is executed andDoing tag will disappear. When you typeS-<f11>, you can go back to the original position you are jumped from.

clock-in and clock-out triggers

clock-in triggers

org-clock-in will be called when:

  • callingorg-onit-toggle-doing if the task is notDONE
  • callingorg-onit-toggle-doing at any headings if:wakeup oforg-onit-basic-options isdoing orboth
  • unfolding a heading if:unfold oforg-onit-basic-options is non-nil

clock-out triggers

org-clock-out will be called when:

  • callingorg-onit-toggle-doing
  • making the taskDONE or removing todo state

Automated approach

UseM-x org-onit-toggle-auto. Togglingorg-clock-in andorg-clock-out will be done automatically no need to toggleDoing tag by yourself.

clock-in and clock-out triggers

clock-in triggers

org-clock-in will be called when:

  • visiting a heading if the task is notDONE
  • visiting a heading if:nostate oforg-onit-basic-options isauto orboth and the task is notDONE
  • making the task notDONE

clock-out triggers

org-clock-out will be called when:

  • switching to other headings if the task has a todo state (e.g.TODO)
  • switching to other headings if:nostate oforg-onit-basic-options= isauto orboth and the task is notDONE
  • making the taskDONE
  • callingorg-onit-toggle-doing

Options

  • org-onit-wakeup-done (deprecated, useorg-onit-basic-options)
    • Allow switching toorg-clock-in byorg-onit-toggle-doing when the heading is DONE.
    • Default: nil
  • org-onit-include-no-state-heading (deprecated, useorg-onit-basic-options)
    • Allow switching toorg-clock-in in any headings except headings in TODO whenorg-onit-toggle-auto is used
    • Default: nil
  • org-onit-basic-options
    • This variable is buffer-local. Please usesetq-default orcustom-set-variables in your init.el.
    • :wakeup allows switching toorg-clock-in when the heading is DONE.
    • :nostate allows switching toorg-clock-in in any headings except headings in TODO
    • :unfold allows switching toorg-clock-in when unfolding a heading
    • Default: (:wakeup nil:nostate nil:unfold nil)
      • :wakeup and:nostate can takedoing,auto,both, andnil
        • Ifdoing is specified, the option will be used inorg-onit-toggle-doing
        • Ifauto is specified, the option will be used inorg-onit-toggle-auto
        • Ifboth is specified, the option will be used inorg-onit-toggle-doing andorg-onit-toggle-auto
      • :unfold can taket ornil
        • But:wakeup and:nostate are given priority over:unfold
  • org-onit-encure-clock-out-when-exit
    • Callorg-clock-out when killing Emacs iforg-clock-persis is nothistory ornil
    • Default: t
  • org-onit-keep-no-state
    • If non-nil, allow clocking in but keep the heading TODO state none
    • If nil and:nostate oforg-onit-basic-options is specified as non-nil, then the subtree will be changed to TODO heading state and clock-in
    • Default: t

Helpers

  • org-onit-update-options
    org-onit-basic-options;; (:wakeup nil :nostate nil :unfold nil)(org-onit-update-options '(:nostate doing:unfoldt));; update the local variableorg-onit-basic-options;; (:wakeup nil :nostate doing :unfold t)

Hooks

  • org-onit-switch-task-hook
  • org-onit-start-autoclock-hook
  • org-onit-stop-autoclock-hook
  • org-onit-after-jump-hook
    (defunmy-onit-reveal ()  (org-reveal)  (org-cycle-hide-drawers'all)  (org-show-entry)  (show-children)  (org-show-siblings))(add-hook'org-onit-after-jump-hook#'my-onit-reveal)

Contribution

Require tools for testing

  • cask
    • install via brew
      brew install cask
    • manual install
      cd~/hub clone cask/caskexport PATH="$HOME/.cask/bin:$PATH"

Running test

Below operation flow is recommended.

make# Install git-hooks in local .gitgit branch [feature-branch]# Create branch named [feature-branch]git checkout [feature-branch]# Checkout branch named [feature-branch]# <edit loop>emacs org-onit.el# Edit something you wantmaketest# Test org-onitgit commit -am"brabra"# Commit (auto-run test before commit)# </edit loop>hub fork# Create fork at GitHubgit push [user] [feature-branch]# Push feature-branch to your forkhub pull-request# Create pull-request

ChangeLog

  • 1.0.7 (2019-09-30)
    • [new]org-onit-update-options is added to updateorg-onit-basic-options
    • [deprecated]org-onit-toggle-options will beorg-onit-basic-options
  • 1.0.6 (2019-09-29)
    • [improved] Makeorg-onit-toggle-options buffer local
  • 1.0.5 (2019-09-26)
    • [new]org-onit-clock-in-when-unfold is now public function
  • 1.0.4 (2019-09-25)
    • [new]org-onit-keep-no-state is added
  • 1.0.3 (2019-09-24)
    • [improved]org-onit-use-unfold-as-doing is integrated toorg-onit-toggle-options
    • [deprecated]org-onit-use-unfold-as-doing
  • 1.0.2 (2019-09-12)
    • [new]org-onit-toggle-options is introduced
    • [improved]org-clock-in-switch-to-state is reflected toorg-onit-todo-state
    • [deprecated]org-onit-wakeup-done
    • [deprecated]org-onit-include-no-state-heading
  • 1.0.1 (2019-09-01)
    • [improved] Rename “todo status” to “todo state”
    • [breaking change] rename toorg-onit-include-no-state-heading
    • [new] support to clock-out when removing todo state
  • 1.0.0 (2019-09-01)
    • initial release

About

Easy org-clock-in and org-clock-out

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp