fix(org): compatibility issues
This commit is contained in:
parent
aea71adb3c
commit
02bbdde2d2
11
config.org
11
config.org
|
@ -3160,9 +3160,8 @@ Inline images in Org are file links pointing to images without a description. Us
|
||||||
(defadvice! +org-inline-desc (old-fn protocol link description)
|
(defadvice! +org-inline-desc (old-fn protocol link description)
|
||||||
"Disable inline images with descriptions when `+org-inline-image-desc'
|
"Disable inline images with descriptions when `+org-inline-image-desc'
|
||||||
is non-nil."
|
is non-nil."
|
||||||
:around '(org-yt-image-data-fun
|
:around (list #'+org-inline-image-data-fn
|
||||||
+org-inline-image-data-fn
|
#'+org-http-image-data-fn)
|
||||||
+org-http-image-data-fn)
|
|
||||||
(when (or +org-inline-image-desc (null description))
|
(when (or +org-inline-image-desc (null description))
|
||||||
(funcall old-fn protocol link description)))
|
(funcall old-fn protocol link description)))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
@ -3294,19 +3293,17 @@ Annoyingly, the only good way to fix these issues is to completely override the
|
||||||
|
|
||||||
When an explicit category is not specified, Org mode typically defaults to the filename (sans extension). This ... sort of makes sense? I guess? It doesn't really, because filename conventions don't make for good agenda category names. I want my category names to be in title case, whereas a file name is typically going to be all lowercase and without spaces. This is especially bad for Org-roam, where filenames are automatically generated and way too long to be a UI element.
|
When an explicit category is not specified, Org mode typically defaults to the filename (sans extension). This ... sort of makes sense? I guess? It doesn't really, because filename conventions don't make for good agenda category names. I want my category names to be in title case, whereas a file name is typically going to be all lowercase and without spaces. This is especially bad for Org-roam, where filenames are automatically generated and way too long to be a UI element.
|
||||||
|
|
||||||
To fix this issue, it's... "easy" to patch Org-mode's category system[fn:2]. The following code sets things up so that the file's =#+title= metadata is used as the default category, falling back on the default behavior if a title is not given.
|
To fix this issue, it's... "easy" to patch Org-mode's category system. The following code sets things up so that the file's =#+title= metadata is used as the default category, falling back on the default behavior if a title is not given.
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(defadvice! ~/org-default-category (old-fn)
|
(defadvice! ~/org-default-category (old-fn)
|
||||||
"Modify how Org resolves the default category through the
|
"Modify how Org resolves the default category through the
|
||||||
`org-category' variable."
|
`org-category' variable."
|
||||||
:around '(org-refresh-category-properties org-element-org-data-parser)
|
:around #'org-element--get-category
|
||||||
(let ((org-category (or org-category (org-get-title))))
|
(let ((org-category (or org-category (org-get-title))))
|
||||||
(funcall old-fn)))
|
(funcall old-fn)))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
[fn:2] It took me multiple hours of combing through Org's source code in order to find the multiple places(???) where this behavior was implemented and to figure out how to modify it. At least the final code is short!
|
|
||||||
|
|
||||||
** Org Roam
|
** Org Roam
|
||||||
|
|
||||||
#+call: confpkg("Org: Roam")
|
#+call: confpkg("Org: Roam")
|
||||||
|
|
Loading…
Reference in a new issue