Emacsist RSS --- If never, make it ever: C-h C-h

Org-mode Hydras incoming!

5715

这里 查看更多 Emacs 相关推荐文章最新 Emacs 圈的动态. 欢迎关注微信公众账号: Emacsist

A hydra for org-mode time/clock/capture

This is a categorized version of the hydra that @WorldsEndless contributed today to the wiki.

(defhydra hydra-global-org (:color blue
                            :hint nil)
  "
Timer^^        ^Clock^         ^Capture^
--------------------------------------------------
s_t_art        _w_ clock in    _c_apture
 _s_top        _o_ clock out   _l_ast capture
_r_eset        _j_ clock goto
_p_rint
"
  ("t" org-timer-start)
  ("s" org-timer-stop)
  ;; Need to be at timer
  ("r" org-timer-set-timer)
  ;; Print timer value to buffer
  ("p" org-timer)
  ("w" (org-clock-in '(4)))
  ("o" org-clock-out)
  ;; Visit the clocked task from any buffer
  ("j" org-clock-goto)
  ("c" org-capture)
  ("l" org-capture-goto-last-stored))

I've bound it like this:

(global-set-key [f11] 'hydra-global-org/body)

Previously, I had f11 bound to org-clock-goto, thanks to the Org Mode - Organize Your Life In Plain Text! post. I kind of recommend that post, as it has a tonne of useful stuff. At the same time, it resulted in me copying too much stuff that I didn't understand into my config, ultimately discouraging me from usingorg-mode. YMMV.

Screenshot:

hydra-org-global.png

A hydra for refile/archive

Inspired by the previous one, I wanted to write a hydra of my own. As it happened, I was just about to clean up my git notes. So I wanted a nice refile hydra to speed up the process.

Here's the hydra's code, which is now part of worf. Worf is a package for quickly navigating around an org-mode buffer, you can get it from MELPA.

(defhydra hydra-refile (:hint nil
                        :color teal)
  "
Refile:^^   _k_eep: %`org-refile-keep
----------------------------------
_l_ast      _a_rchive
_o_ther
_t_his

"
  ("t" worf-refile-this)
  ("o" worf-refile-other)
  ("l" worf-refile-last)
  ("k" (setq org-refile-keep (not org-refile-keep))
       :exit nil)
  ("a" (org-archive-subtree))
  ("q" nil "quit"))

Some explanations:

  • worf-refile-this will give you a choice of this file's headings for refiling.
  • worf-refile-other will give you a choice of your org-refile-targets except the current file.
  • worf-refile-last will refile to the last refile location without prompting.
  • k will toggle org-refile-keep, which decides if refiling moves or copies the text.

And here's how it looks like:

hydra-refile.png

Outro

Thanks for the contribution, enjoy the new stuff. Also, if you ever want to dig around someone's git notes, you can read mine, courtesy of org-mode export.

原文出处: Oleh
原文地址: http://oremacs.com/2015/04/14/hydra-org-mode/
原文时间: 2015-04-16 04:37
本文地址: http://emacsist.com/10121
整理时间: 2015-04-16 13:43

本文由 Hick 整理,转载请保留以上信息;
COPYLEFTThe articles on this site come from Internet, thanks to all the original authors.
      If anything about COPYRIGHT, or LEFT, please contact Emacsist at gmail dot com .