commit 10c4fd34439edb6e270f8456b77c3d947fcdafeb
parent 141692f5e77e1fbb037e9631cf18ca8bcba7d942
Author: Alex Balgavy <alex@balgavy.eu>
Date: Wed, 19 Jul 2023 22:04:12 +0200
emacs: misc config
Diffstat:
1 file changed, 25 insertions(+), 24 deletions(-)
diff --git a/emacs/config.org b/emacs/config.org
@@ -1460,6 +1460,26 @@ Gives ideas for phrases to use in academic writing.
#+end_src
* Mode/language specific packages
** Org
+*** Custom functions
+**** Get number of headlines in a file
+#+begin_src emacs-lisp
+ (defun za/org-count-headlines-in-file (level filename)
+ "Count number of level LEVEL headlines in FILENAME. If LEVEL is 0, count all."
+ (let ((headline-str (cond ((zerop level) "^\*+")
+ (t (format "^%s " (apply 'concat (make-list level "\\*")))))))
+ (save-mark-and-excursion
+ (with-temp-buffer
+ (insert-file-contents filename)
+ (count-matches headline-str (point-min) (point-max))))))
+#+end_src
+
+**** Yank URL
+#+begin_src emacs-lisp
+ (defun org-yank-link-url ()
+ (interactive)
+ (kill-new (org-element-property :raw-link (org-element-context)))
+ (message "Link copied to clipboard"))
+#+end_src
*** Installation
Install Org and require additional components that I use.
@@ -1966,13 +1986,14 @@ The first two strings are what shows up in the agenda dispatcher (the key to pre
((agenda "" ((org-agenda-overriding-header "Day:")
(org-agenda-span 'day)
(org-habit-show-habits nil)))
+ (todo "STARTED" ((org-agenda-overriding-header "In progress:")))
+ (todo "WAITING" ((org-agenda-overriding-header "Waiting:")))
(agenda "" ((org-agenda-overriding-header "Habits:")
(org-agenda-span 'day)
(org-agenda-use-time-grid nil)
(org-agenda-skip-function 'za/skip-unless-habit)
(org-habit-show-habits t) (org-habit-show-habits-only-for-today nil)
- (org-habit-show-all-today t)))
- (todo "WAITING" ((org-agenda-overriding-header "Waiting:")))))
+ (org-habit-show-all-today t)))))
("k" "Kanban view"
((todo "DONE" ((org-agenda-overriding-header "Done:") (org-agenda-sorting-strategy '(deadline-up priority-down alpha-up))))
@@ -2229,26 +2250,6 @@ And to be able to bulk-set priorities in agenda:
#+begin_src emacs-lisp
(add-to-list 'org-global-properties '("Difficulty_ALL" . "low medium high"))
#+end_src
-*** Custom functions
-**** Get number of headlines in a file
-#+begin_src emacs-lisp
- (defun za/org-count-headlines-in-file (level filename)
- "Count number of level LEVEL headlines in FILENAME. If LEVEL is 0, count all."
- (let ((headline-str (cond ((zerop level) "^\*+")
- (t (format "^%s " (apply 'concat (make-list level "\\*")))))))
- (save-mark-and-excursion
- (with-temp-buffer
- (insert-file-contents filename)
- (count-matches headline-str (point-min) (point-max))))))
-#+end_src
-
-**** Yank URL
-#+begin_src emacs-lisp
- (defun org-yank-link-url ()
- (interactive)
- (kill-new (org-element-property :raw-link (org-element-context)))
- (message "Link copied to clipboard"))
-#+end_src
*** org publishing
I decided, after trying many different things, to settle on org-publish.
@@ -2304,8 +2305,8 @@ This function filters the return value of ~org-md-link~.
`org-md-link` (LINKSTR) to generate a link compatible with Zola."
(cond ((string-match-p (rx ".md") linkstr)
(string-replace "](" "](@/org-roam/" linkstr))
- ((string-match-p (rx "](/") linkstr)
- (replace-regexp-in-string (rx "](/" (* any) "/org-roam/data") "](/org-roam-data" linkstr))
+ ((string-match-p (rx "](" (? (* alnum) "://") "/") linkstr)
+ (replace-regexp-in-string (rx "](" (? (* alnum) "://") "/" (* any) "/org-roam/data") "](/org-roam-data" linkstr))
(t linkstr)))
#+end_src