commit
db7a37d888
3 changed files with 30 additions and 0 deletions
|
@ -124,6 +124,7 @@
|
||||||
+babel ; running code in org
|
+babel ; running code in org
|
||||||
+capture ; org-capture in and outside of Emacs
|
+capture ; org-capture in and outside of Emacs
|
||||||
+export ; Exporting org to whatever you want
|
+export ; Exporting org to whatever you want
|
||||||
|
+habit ; Keep track of your habits
|
||||||
+present ; Emacs for presentations
|
+present ; Emacs for presentations
|
||||||
+protocol) ; Support for org-protocol:// links
|
+protocol) ; Support for org-protocol:// links
|
||||||
;;perl ; write code no one else can comprehend
|
;;perl ; write code no one else can comprehend
|
||||||
|
|
28
modules/lang/org/+habit.el
Normal file
28
modules/lang/org/+habit.el
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
;;; lang/org/+habit.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(defvar +org-habit-graph-padding 2
|
||||||
|
"The padding added to the end of the consistency graph")
|
||||||
|
|
||||||
|
(defvar +org-habit-min-width 30
|
||||||
|
"Hides the consistency graph if the `org-habit-graph-column' is less than this value")
|
||||||
|
|
||||||
|
(defvar +org-habit-graph-window-ratio 0.3
|
||||||
|
"The ratio of the consistency graphs relative to the window width")
|
||||||
|
|
||||||
|
(defun +org-habit|resize-graph()
|
||||||
|
"Right align and resize the consistency graphs based on `+org-habit-graph-window-ratio'"
|
||||||
|
(require 'org-habit)
|
||||||
|
(let* ((total-days (float (+ org-habit-preceding-days org-habit-following-days)))
|
||||||
|
(preceding-days-ratio (/ org-habit-preceding-days total-days))
|
||||||
|
(graph-width (floor (* (window-width) +org-habit-graph-window-ratio)))
|
||||||
|
(preceding-days (floor (* graph-width preceding-days-ratio)))
|
||||||
|
(following-days (- graph-width preceding-days))
|
||||||
|
(graph-column (- (window-width) (+ preceding-days following-days)))
|
||||||
|
(graph-column-adjusted (if (> graph-column +org-habit-min-width)
|
||||||
|
(- graph-column +org-habit-graph-padding)
|
||||||
|
nil)))
|
||||||
|
(setq-local org-habit-preceding-days preceding-days)
|
||||||
|
(setq-local org-habit-following-days following-days)
|
||||||
|
(setq-local org-habit-graph-column graph-column-adjusted)))
|
||||||
|
|
||||||
|
(add-hook 'org-agenda-mode-hook #'+org-habit|resize-graph)
|
|
@ -514,5 +514,6 @@ conditions where a window's buffer hasn't changed at the time this hook is run."
|
||||||
(if (featurep! +babel) (load! "+babel"))
|
(if (featurep! +babel) (load! "+babel"))
|
||||||
(if (featurep! +capture) (load! "+capture"))
|
(if (featurep! +capture) (load! "+capture"))
|
||||||
(if (featurep! +export) (load! "+export"))
|
(if (featurep! +export) (load! "+export"))
|
||||||
|
(if (featurep! +habit) (load! "+habit"))
|
||||||
(if (featurep! +present) (load! "+present"))
|
(if (featurep! +present) (load! "+present"))
|
||||||
(if (featurep! +protocol) (load! "+protocol")))
|
(if (featurep! +protocol) (load! "+protocol")))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue