47 lines
1.7 KiB
EmacsLisp
47 lines
1.7 KiB
EmacsLisp
;;; org.el -*- lexical-binding: t; -*-
|
|
|
|
;; If you use `org' and don't want your org files in the default location below,
|
|
;; change `org-directory'. It must be set before org loads!
|
|
(setq org-directory "~/Nextcloud/org/")
|
|
|
|
(require 'org)
|
|
|
|
(defun max/org-clock-get-clock-string ()
|
|
"Form a clock string that will be shown in polybar.
|
|
Adapted from `org-clock-get-clock-string'."
|
|
(require 'org-clock)
|
|
(when (org-clocking-p)
|
|
(let* ((currently-clocked-time
|
|
(floor (org-time-convert-to-integer
|
|
(time-since org-clock-start-time))
|
|
60))
|
|
(clocked-time (org-clock-get-clocked-time))
|
|
(current-work-done-str (org-duration-from-minutes currently-clocked-time)))
|
|
(if org-clock-effort
|
|
(let* ((effort-in-minutes (org-duration-to-minutes org-clock-effort))
|
|
(work-done-str (org-duration-from-minutes clocked-time))
|
|
(effort-str (org-duration-from-minutes effort-in-minutes)))
|
|
(format "%s (%s/%s) %s"
|
|
current-work-done-str work-done-str effort-str org-clock-heading))
|
|
(format "%s %s"
|
|
current-work-done-str
|
|
org-clock-heading)))))
|
|
|
|
;; Fix org-babel shell block not inheriting envrc
|
|
;; https://github.com/purcell/envrc/issues/28
|
|
(advice-add 'org-babel-eval :around #'envrc-propagate-environment)
|
|
|
|
(after! org
|
|
;; Store org links to info pages
|
|
(add-to-list 'org-modules 'ol-info))
|
|
|
|
;; C-k is mapped to ~org-element-up~ by defualt
|
|
(map! :after evil-org
|
|
:map evil-org-mode-map
|
|
:i "C-k" #'org-kill-line)
|
|
|
|
(map! :after org
|
|
:map org-mode-map
|
|
:localleader
|
|
"Y" #'ox-clip-image-to-clipboard)
|