Browse Source

Add regexp for org-roam title slugs

master
Riyyi 4 years ago
parent
commit
a3ef78c8ff
  1. 1
      .config/emacs/config.org

1
.config/emacs/config.org

@ -1382,6 +1382,7 @@ If point is on:
"Convert TITLE to a filename-suitable slug, strip out common words." "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")) (let* ((common-words '("a" "an" "and" "as" "at" "by" "is" "it" "of" "the" "to"))
(title (replace-regexp-in-string "\\(c\\+\\+\\)" "cpp" title)) (title (replace-regexp-in-string "\\(c\\+\\+\\)" "cpp" title))
(title (replace-regexp-in-string "\\(c\\#\\)" "cs" title))
(words (split-string (org-roam--title-to-slug title) "\_"))) (words (split-string (org-roam--title-to-slug title) "\_")))
(string-join (seq-remove (lambda (element) (member element common-words)) words) "_"))) (string-join (seq-remove (lambda (element) (member element common-words)) words) "_")))
#+END_SRC #+END_SRC

Loading…
Cancel
Save