summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--init.el9
-rw-r--r--lisp/documents.el37
2 files changed, 46 insertions, 0 deletions
diff --git a/init.el b/init.el
index 7754f36..5e6f0c2 100644
--- a/init.el
+++ b/init.el
@@ -98,6 +98,15 @@
(use-package bind-key)
(require 'bind-key)
+;; Furthermore, I use `el-patch' at certain points in this configuration, and I
+;; find it most clear when patch specifications are included alongside the
+;; `use-package' declaration, so we will configure it here and enable the
+;; integration.
+
+(use-package el-patch
+ :init
+ (setq el-patch-enable-use-package-integration t))
+
;; But we do want to reset the garbage collector settings eventually. When we
;; do, we'll use the GCMH [1] package to schedule the garbage collector to run
;; during idle time, rather than the haphazard "whenever some threshold is
diff --git a/lisp/documents.el b/lisp/documents.el
index 33f8b29..4687ac3 100644
--- a/lisp/documents.el
+++ b/lisp/documents.el
@@ -262,6 +262,43 @@ Visits LINK, or if LINK names a subdirectory of
(org-agenda-skip-function ,subtree-is-habit)
(org-agenda-overriding-header "Week Ahead:"))))
((org-agenda-compact-blocks t)))))))
+ ;; Patch in an offset for tag alignment. (Without this, they will warp in a
+ ;; way which I do not like.)
+ :config/el-patch
+ (defun org-agenda-align-tags (&optional line)
+ "Align all tags in agenda items to `org-agenda-tags-column'.
+ When optional argument LINE is non-nil, align tags only on the
+ current line."
+ (let ((inhibit-read-only t)
+ (org-agenda-tags-column (if (eq 'auto org-agenda-tags-column)
+ (el-patch-swap (window-max-chars-per-line) (- 2 (window-max-chars-per-line)))
+ org-agenda-tags-column))
+ (end (and line (line-end-position)))
+ l c)
+ (save-excursion
+ (goto-char (if line (line-beginning-position) (point-min)))
+ (while (re-search-forward org-tag-group-re end t)
+ (add-text-properties
+ (match-beginning 1) (match-end 1)
+ (list 'face (delq nil (let ((prop (get-text-property
+ (match-beginning 1) 'face)))
+ (or (listp prop) (setq prop (list prop)))
+ (if (memq 'org-tag prop)
+ prop
+ (cons 'org-tag prop))))))
+ (setq l (string-width (match-string 1))
+ c (if (< org-agenda-tags-column 0)
+ (- (abs org-agenda-tags-column) l)
+ org-agenda-tags-column))
+ (goto-char (match-beginning 1))
+ (delete-region (save-excursion (skip-chars-backward " \t") (point))
+ (point))
+ (insert (org-add-props
+ (make-string (max 1 (- c (current-column))) ?\s)
+ (plist-put (copy-sequence (text-properties-at (point)))
+ 'face nil))))
+ (goto-char (point-min))
+ (org-font-lock-add-tag-faces (point-max)))))))
(use-package org-drill
;; org-drill in upstream Org is unmaintained, and as described in [1], no

© 2015 - 2026 Jakob L. Kreuze