mirror of
https://github.com/foo-dogsquared/wiki.git
synced 2025-01-30 22:57:59 +00:00
Add EditorConfig and update project config
It is just the parts of the Emacs config from my dotfiles moved here.
This commit is contained in:
parent
ad8f37c356
commit
63ba008180
6
.editorconfig
Normal file
6
.editorconfig
Normal file
@ -0,0 +1,6 @@
|
||||
root = true
|
||||
|
||||
# Format the plain text documents.
|
||||
[*.{org,adoc,md}]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
58
config.el
58
config.el
@ -1,4 +1,6 @@
|
||||
(defvar +wiki-directory "~/writings/wiki")
|
||||
(defvar +structured-notes-directory-name "structured")
|
||||
(defvar +structured-notes-directory (f-join +wiki-directory +structured-notes-directory-name))
|
||||
(defvar my/wiki-asset-directory-name "assets")
|
||||
|
||||
(defun my/is-in-wiki-directory ()
|
||||
@ -37,4 +39,60 @@
|
||||
`((notes . ,(list (org-entry-get (point) anki-editor-prop-note-id)))))
|
||||
(org-entry-delete (point) anki-editor-prop-note-id)))
|
||||
|
||||
(setq
|
||||
org-roam-capture-templates `(("p" "permanent" plain "%?"
|
||||
:if-new
|
||||
(file+head "%<%Y-%m-%d-%H-%M-%S>.org"
|
||||
"#+title: ${title}
|
||||
#+date: \"%<%Y-%m-%d %T %:z>\"
|
||||
#+date_modified: \"%<%Y-%m-%d %T %:z>\"
|
||||
#+language: en")
|
||||
:unnarrowed t)
|
||||
|
||||
("c" "cards" plain "%?"
|
||||
:if-new
|
||||
(file+head ,(f-join +anki-cards-directory-name "%<%Y>.org") "#+title: Anki: ${title}
|
||||
#+date: \"%<%Y-%m-%d %T %:z>\"
|
||||
#+date_modified: \"%<%Y-%m-%d %T %:z>\"
|
||||
#+language: en
|
||||
#+property: anki_deck ${title}")
|
||||
:unnarrowed t)
|
||||
|
||||
("l" "literature" plain "%?"
|
||||
:if-new
|
||||
(file+head ,(f-join +structured-notes-directory-name "literature.${slug}.org") "#+title: ${title}
|
||||
#+date: \"%<%Y-%m-%d %T %:z>\"
|
||||
#+date_modified: \"%<%Y-%m-%d %T %:z>\"
|
||||
#+language: en")
|
||||
:unnarrowed t)
|
||||
|
||||
("d" "dailies" entry "* %?"
|
||||
:if-new
|
||||
(file+head ,(expand-file-name "%<%Y-%m-%d>.org" org-roam-dailies-directory) "#+title: %<%Y-%m-%d>\n"))
|
||||
|
||||
("s" "structured" plain "%?"
|
||||
:if-new
|
||||
(file+head ,(f-join +structured-notes-directory-name "${slug}.org") "#+title: ${title}")
|
||||
:unnarrowed t)))
|
||||
|
||||
(eval-after-load "org-roam"
|
||||
'(cl-defmethod org-roam-node-slug ((node org-roam-node))
|
||||
"Override the slug method with a kebab-case instead of the
|
||||
snake_case."
|
||||
(let ((title (org-roam-node-title node)))
|
||||
(cl-flet* ((nonspacing-mark-p (char)
|
||||
(memq char org-roam-slug-trim-chars))
|
||||
(strip-nonspacing-marks (s)
|
||||
(ucs-normalize-NFC-string
|
||||
(apply #'string (seq-remove #'nonspacing-mark-p
|
||||
(ucs-normalize-NFD-string s)))))
|
||||
(cl-replace (title pair)
|
||||
(replace-regexp-in-string (car pair) (cdr pair) title)))
|
||||
(let* ((pairs `(("[^[:alnum:][:digit:]_.]+" . "-") ;; convert anything not alphanumeric except "."
|
||||
("\s+" . "-") ;; remove whitespaces
|
||||
("__*" . "-") ;; remove sequential underscores
|
||||
("^_" . "") ;; remove starting underscore
|
||||
("_$" . ""))) ;; remove ending underscore
|
||||
(slug (-reduce-from #'cl-replace (strip-nonspacing-marks title) pairs)))
|
||||
(downcase slug))))))
|
||||
;;; config.el ends here
|
||||
|
Loading…
Reference in New Issue
Block a user