diff options
| author | Jakob L. Kreuze | 2022-06-28 08:00:35 -0400 |
|---|---|---|
| committer | Jakob L. Kreuze | 2022-07-03 13:52:08 -0400 |
| commit | 95c802ce23548177e46b37ad61c8398458535622 (patch) | |
| tree | 426e98d5cfcc7dd2075ee1e26b4bfeaa2088db48 | |
| parent | 2fe7dd4db788a97e2217f1588d7b98c3211e1395 (diff) | |
Revert "[org] Custom breadcrumbs display"
This reverts commit 2fe7dd4db788a97e2217f1588d7b98c3211e1395.
Sort of works, but not to the extent that I would like.
| -rw-r--r-- | lisp/core.el | 6 | ||||
| -rw-r--r-- | lisp/documents.el | 124 | ||||
| -rw-r--r-- | lisp/programming.el | 4 |
3 files changed, 59 insertions, 75 deletions
diff --git a/lisp/core.el b/lisp/core.el index 1d6465a..972291b 100644 --- a/lisp/core.el +++ b/lisp/core.el @@ -71,7 +71,11 @@ (format "%s\\|%s" vc-ignore-dir-regexp tramp-file-name-regexp)) - (setq tramp-verbose 1)) + (setq tramp-verbose 1) + + ;; Never ask me if I want to save credentials to .authinfo + :init + (setq auth-source-save-behavior nil)) (use-package nsm :straight nil diff --git a/lisp/documents.el b/lisp/documents.el index 3fa83dc..a140961 100644 --- a/lisp/documents.el +++ b/lisp/documents.el @@ -7,6 +7,23 @@ ;;; Spell-checking, and the like. ;;; +;; TODO: This functionality isn't done. + +(defun org-agenda-update-rank () + (interactive) + (save-excursion + (let ((i 0)) + (message (format "%s" i)) + (goto-char 0) + (while (= 0 (forward-line 1)) + (move-beginning-of-line 1) + (let ((orig (get-text-property (point) 'org-marker))) + (when orig + (org-with-point-at orig + (org-entry-put nil "RANK" (number-to-string i)) + (setq i (+ i (expt 10 (- 4 (org-current-level)))))))) + (message (format "%s" (point))))))) + ;; Ensure that my Aspell "personal dictionary" is included when invoking ispell. @@ -281,9 +298,29 @@ Visits LINK, or if LINK names a subdirectory of (org-agenda-overriding-header "Needs Processing:")))) ((org-agenda-compact-blocks t) (org-agenda-overriding-columns-format "%TODO %EFFORT %ITEM %CATEGORY %TAGS")))))) + + ;; Introduce a "rank" for sorting the TODO agenda in a way which is + ;; persistent. Specifically, we introduce `user-defined-up' to the sorting + ;; strategies for `todo'. + (setq org-agenda-sorting-strategy + '((agenda habit-down time-up priority-down category-keep user-defined-down) + (todo category-keep user-defined-up priority-down) + (tags priority-down category-keep) + (search category-keep))) + + (defun org-agenda-sort-by-rank (a b) + (let* ((a-pos (get-text-property 0 'org-marker a)) + (b-pos (get-text-property 0 'org-marker b)) + (rank-a (string-to-number (or (org-entry-get a-pos "RANK") "9999"))) + (rank-b (string-to-number (or (org-entry-get b-pos "RANK") "9999")))) + (cond ((> rank-a rank-b) +1) + ((< rank-a rank-b) -1) + (t nil)))) + (setq org-agenda-cmp-user-defined #'org-agenda-sort-by-rank) + (setq org-agenda-prefix-format '((agenda . " %i %-12:c%?-12t%s %l") - (todo . "%b") + (todo . "%-3e %l") (tags . " %i %-12:c") (search . " %i %-12:c"))) @@ -300,77 +337,6 @@ Visits LINK, or if LINK names a subdirectory of (not (org-entry-get nil "CREATED"))) (org-entry-put nil "CREATED" (format-time-string (cdr org-time-stamp-formats))))) - ;; The following is a hack to have more flexibility in how agenda lines are - ;; displayed. Specifically, the following will configure Org such that each - ;; line in the agenda reads: - ;; - ;; [effort] | [leaf] | [breadcrumbs except leaf] | [tags] - ;; - ;; Where `|' represents some appropriate padding. - :init - (setq org-agenda-breadcrumbs-separator "") - - :config - (defvar org-agenda-line-indent 8) - (defvar org-agenda-line-parent-hint-length 48) - (defvar org-agenda-line-tags-hint-length 20) - (defun org-agenda-line-strip-tags (x) - "Split `x' into a list of (`rest' `tags-string')" - (if (string-match ":.*:" x) - (let ((beg (string-match ":.*:" x)) - (end (match-end 0))) - (list (substring x 0 beg) (substring x beg end))) - nil)) - (defun org-agenda-line-content-region (x) - "Return `(beginning end)' for the content of `x' excluding trailing whitespace" - (list (- (length x) (length (string-trim-left x))) - (length (string-trim-right x)))) - (defun org-agenda-line-format-components (effort components) - "Format the given information into an Agenda line, as described above" - (let* ((left-padding (- (window-width) - org-agenda-line-indent - org-agenda-line-parent-hint-length - org-agenda-line-tags-hint-length)) - (parent-hint (if (= 1 (length components)) - "" - (maybe-elide - (concat "(" - (string-join (cl-subseq components 0 (- 1)) " -> ") - ")") - org-agenda-line-parent-hint-length)))) - (format "%s%s%s%s" - (string-pad effort org-agenda-line-indent) - ;; The following two subexpressions would be one if `string-pad' - ;; took the visual width into account (it doesn't, padding based - ;; on the number of characters in the string rather than the - ;; number of characters displayed.) - (car (last components)) - (string-pad "" (- left-padding (org-string-width (car (last components))))) - parent-hint))) - (defun org-agenda-line-reformat-breadcrumbs (x) - "Entry-point for `org-agenda-line-format-components' that handles whitespace" - (let* ((pos (get-text-property 0 'org-marker x)) - (effort (org-entry-get pos "EFFORT")) - (region (content-region x)) - (region-beg (car region)) - (region-end (cadr region)) - (actual (substring x region-beg region-end)) - ;; n.b. the unusual character originates from above, where we set - ;; `org-agenda-breadcrumbs-separator'. - (components (split-string actual ""))) - (concat - (substring x 0 region-beg) - (format-components effort components) - (substring x region-end (length x))))) - (defun org-agenda-line-format-item (x) - "`filter-return' to re-format Org agenda line items" - (if (not (string-match "Habits:" x)) - (if-let ((pieces (strip-tags x))) - (concat (reformat-breadcrumbs (car pieces)) (cadr pieces)) - (reformat-breadcrumbs x)) - x)) - (advice-add 'org-agenda-format-item :filter-return #'org-agenda-line-format-item) - ;; Patch in an offset for tag alignment. (Without this, they will warp in a ;; way which I do not like.) :config/el-patch @@ -494,6 +460,18 @@ Visits LINK, or if LINK names a subdirectory of ;;; +;;; Diary +;;; + +(use-package calendar + :straight nil + :config + (push '(holiday-fixed 6 4 "Tiananmen Square Day") calendar-holidays) + (push '(holiday-fixed 2 11 "Zack's Birthday") calendar-holidays) + (push '(holiday-fixed 2 19 "Alicia's Birthday") calendar-holidays)) + + +;;; ;;; Ledger ;;; @@ -529,4 +507,4 @@ Visits LINK, or if LINK names a subdirectory of (use-package pdf-tools :demand t :config - (pdf-loader-install)) + (pdf-tools-install)) diff --git a/lisp/programming.el b/lisp/programming.el index 0883199..4cd27f6 100644 --- a/lisp/programming.el +++ b/lisp/programming.el @@ -162,4 +162,6 @@ ;; stuff that was included. So I use `eglot' instead. Thus far, it's been a ;; pleasant experience. -(use-package eglot) +(use-package eglot + :config + (push :hoverProvider eglot-ignored-server-capabilities)) |