Add hydra to manipulate timestamps

master
Jacopo De Simoi 4 years ago
parent 9bb35f679e
commit 652dcc5ca3
  1. 32
      global.org

@ -1121,6 +1121,38 @@
(org-agenda-redo-all))
(define-key org-agenda-mode-map (kbd "Z") 'org-revert-all-orgzly-buffers)
#+end_src
*** Hydras for timestamps
#+begin_src emacs-lisp
(defun hydra-timestamp/hl-paren-force-fix ()
;;; This is needed b/c hl-parent caches the point position and
;;; refuses to update if the point did not move
(let ((hl-paren-last-point -1))
(hl-paren-highlight)))
(defun hydra-timestamp/pre ()
(unless (boundp 'hydra-timestamp/hpm)
(highlight-parentheses-mode 1))
(setq hydra-timestamp/hpm t))
(defun hydra-timestamp/post ()
(highlight-parentheses-mode -1)
(makunbound 'hydra-timestamp/hpm))
(global-set-key
(kbd "C-α")
(defhydra hydra-timestamp
(:pre hydra-timestamp/pre :post hydra-timestamp/post)
"paren slurp and barf"
("l" (progn
(org-timestamp-up-day)
(hydra-timestamp/hl-paren-force-fix)) "+1D")
("n" (progn
(org-timestamp-down-day)
(hydra-timestamp/hl-paren-force-fix)) "-1D")
("t" (progn
(org-timestamp-up-day 7)
(hydra-timestamp/hl-paren-force-fix)) "+1W")
("s" (progn
(org-timestamp-down-day 7)
(hydra-timestamp/hl-paren-force-fix)) "-1W")))
#+end_src
*** Capture
Set default keybinding
#+begin_src emacs-lisp

Loading…
Cancel
Save