Hack Deft to respect #+TITLE file properties
This commit is contained in:
parent
e0e7f17a7d
commit
5cce6c5035
@ -95,10 +95,11 @@ Load [[https://github.com/raxod502/straight.el][straight.el]] to manage package
|
|||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
* Load org mode
|
* Load org mode
|
||||||
Load org-mode early to [[https://github.com/raxod502/straight.el#the-wrong-version-of-my-package-was-loaded][avoid a version clash]] (but don't load it if the bootstrap file already did):
|
Load org-mode early to [[https://github.com/raxod502/straight.el#the-wrong-version-of-my-package-was-loaded][avoid a version clash]].
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(use-package org
|
(use-package org
|
||||||
:straight org-plus-contrib
|
:straight org-plus-contrib
|
||||||
|
:commands (org-element-map)
|
||||||
:mode (("\\.org\\'" . org-mode)))
|
:mode (("\\.org\\'" . org-mode)))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
@ -1873,6 +1874,24 @@ Integrate Google calendar with org-mode:
|
|||||||
(general-def '(normal motion) org-agenda-mode-map "gr" #'org-agenda-redo-and-fetch-gcal)
|
(general-def '(normal motion) org-agenda-mode-map "gr" #'org-agenda-redo-and-fetch-gcal)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
** Utilities
|
||||||
|
A function to get the TITLE property of the current org buffer:
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defun org-get-title (&optional contents)
|
||||||
|
(let ((raw (or contents
|
||||||
|
(buffer-substring (point-min) (point-max)))))
|
||||||
|
(with-temp-buffer
|
||||||
|
(insert raw)
|
||||||
|
(car
|
||||||
|
(org-element-map
|
||||||
|
(org-element-parse-buffer)
|
||||||
|
'keyword
|
||||||
|
(lambda (el)
|
||||||
|
(when (string-match-p "TITLE"
|
||||||
|
(org-element-property :key el))
|
||||||
|
(org-element-property :value el))))))))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
* link-hint
|
* link-hint
|
||||||
A very helpful package that provides jump-to-link functionality:
|
A very helpful package that provides jump-to-link functionality:
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
@ -2533,7 +2552,6 @@ Run black on the current buffer:
|
|||||||
(append autoflake-args (list "--in-place" file)))))
|
(append autoflake-args (list "--in-place" file)))))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
|
||||||
* Hy
|
* Hy
|
||||||
Python but Lispy!
|
Python but Lispy!
|
||||||
|
|
||||||
@ -4802,6 +4820,18 @@ A fuzzy-finder for notes.
|
|||||||
(leader-def-key "D" #'deft)
|
(leader-def-key "D" #'deft)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
Tell Deft to use the TITLE property for entry titles, if it exists:
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(with-eval-after-load 'deft
|
||||||
|
(advice-add
|
||||||
|
'deft-parse-title :around
|
||||||
|
(lambda (old-fn file contents &rest args)
|
||||||
|
(let ((title (org-get-title contents)))
|
||||||
|
(if title
|
||||||
|
title
|
||||||
|
(apply old-fn file contents args))))))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
* Pollen
|
* Pollen
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(use-package pollen-mode
|
(use-package pollen-mode
|
||||||
|
Loading…
Reference in New Issue
Block a user