Browse Source

Filter common words from org-roam-title-to-slug function

master
Riyyi 4 years ago
parent
commit
36f3adbdc9
  1. 12
      .config/emacs/config.org

12
.config/emacs/config.org

@ -68,6 +68,7 @@
- [[#lsp-functions][LSP Functions]] - [[#lsp-functions][LSP Functions]]
- [[#neotree-functions][Neotree Functions]] - [[#neotree-functions][Neotree Functions]]
- [[#org-functions][Org Functions]] - [[#org-functions][Org Functions]]
- [[#org-roam-functions][Org Roam Functions]]
- [[#projectile-functions][Projectile Functions]] - [[#projectile-functions][Projectile Functions]]
- [[#selectrum-functions][Selectrum Functions]] - [[#selectrum-functions][Selectrum Functions]]
- [[#which-key-functions][Which-Key Functions]] - [[#which-key-functions][Which-Key Functions]]
@ -400,6 +401,7 @@ Setup =org-roam=.
(setq org-roam-directory (expand-file-name "./" org-directory)) (setq org-roam-directory (expand-file-name "./" org-directory))
;; Exclude Syncthing backup directory ;; Exclude Syncthing backup directory
(setq org-roam-file-exclude-regexp "\\.stversions") (setq org-roam-file-exclude-regexp "\\.stversions")
(setq org-roam-title-to-slug-function #'dot/org-roam-title-to-slug)
(setq org-roam-verbose nil)) (setq org-roam-verbose nil))
#+END_SRC #+END_SRC
@ -1331,6 +1333,16 @@ If point is on:
))) )))
#+END_SRC #+END_SRC
*** Org Roam Functions
#+BEGIN_SRC emacs-lisp
(defun dot/org-roam-title-to-slug (title)
"Convert TITLE to a filename-suitable slug, strip out common words."
(let ((common-words '("a" "an" "and" "as" "at" "by" "is" "it" "of" "the" "to"))
(words (split-string (org-roam--title-to-slug title) "\_")))
(string-join (seq-remove (lambda (element) (member element common-words)) words) "_")))
#+END_SRC
*** Projectile Functions *** Projectile Functions
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp

Loading…
Cancel
Save