From 36f3adbdc97f670b9a09a7b92c8da0c10029f04a Mon Sep 17 00:00:00 2001 From: Riyyi Date: Thu, 18 Mar 2021 01:45:57 +0100 Subject: [PATCH] Filter common words from org-roam-title-to-slug function --- .config/emacs/config.org | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.config/emacs/config.org b/.config/emacs/config.org index b6b2138..4f10846 100644 --- a/.config/emacs/config.org +++ b/.config/emacs/config.org @@ -68,6 +68,7 @@ - [[#lsp-functions][LSP Functions]] - [[#neotree-functions][Neotree Functions]] - [[#org-functions][Org Functions]] + - [[#org-roam-functions][Org Roam Functions]] - [[#projectile-functions][Projectile Functions]] - [[#selectrum-functions][Selectrum Functions]] - [[#which-key-functions][Which-Key Functions]] @@ -400,6 +401,7 @@ Setup =org-roam=. (setq org-roam-directory (expand-file-name "./" org-directory)) ;; Exclude Syncthing backup directory (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)) #+END_SRC @@ -1331,6 +1333,16 @@ If point is on: ))) #+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 #+BEGIN_SRC emacs-lisp