Only add categories automatically to org files

This commit is contained in:
Emmet 2023-10-04 21:02:03 -05:00
parent 85adc45787
commit 307d5d57cd
2 changed files with 16 additions and 0 deletions

View file

@ -902,6 +902,14 @@ tasks."
(when
(string-prefix-p (concat "/home/" user-username "/Org") (expand-file-name (buffer-file-name)))
(org-set-property "CATEGORY" (substring (string-trim-left (expand-file-name (buffer-file-name)) (concat "/home/" user-username "/Org/")) 0 (string-match "/" (string-trim-left (expand-file-name (buffer-file-name)) (concat "/home/" user-username "/Org/")))))
(when (string= (message "%s" major-mode) "org-mode")
(when
(string-prefix-p (concat "/home/" user-username "/Org") (expand-file-name (buffer-file-name)))
(setq categorizer-old-line (line-number-at-pos))
(evil-goto-first-line)
(org-set-property "CATEGORY" (substring (string-trim-left (expand-file-name (buffer-file-name)) (concat "/home/" user-username "/Org/")) 0 (string-match "/" (string-trim-left (expand-file-name (buffer-file-name)) (concat "/home/" user-username "/Org/")))))
(evil-goto-line categorizer-old-line)
)
)
)

View file

@ -1055,6 +1055,14 @@ On Wayland, EAF doesn't work.
(when
(string-prefix-p (concat "/home/" user-username "/Org") (expand-file-name (buffer-file-name)))
(org-set-property "CATEGORY" (substring (string-trim-left (expand-file-name (buffer-file-name)) (concat "/home/" user-username "/Org/")) 0 (string-match "/" (string-trim-left (expand-file-name (buffer-file-name)) (concat "/home/" user-username "/Org/")))))
(when (string= (message "%s" major-mode) "org-mode")
(when
(string-prefix-p (concat "/home/" user-username "/Org") (expand-file-name (buffer-file-name)))
(setq categorizer-old-line (line-number-at-pos))
(evil-goto-first-line)
(org-set-property "CATEGORY" (substring (string-trim-left (expand-file-name (buffer-file-name)) (concat "/home/" user-username "/Org/")) 0 (string-match "/" (string-trim-left (expand-file-name (buffer-file-name)) (concat "/home/" user-username "/Org/")))))
(evil-goto-line categorizer-old-line)
)
)
)