Move note taking related configs behind a flag

This commit is contained in:
Andreas Zweili 2023-10-04 09:56:11 +02:00
parent 4035e8b325
commit 17b146fc12
3 changed files with 56 additions and 53 deletions

View File

@ -1,33 +1,34 @@
(use-package deft (when (boundp 'enable-notes)
:ensure nil (use-package deft
:bind ("<f5>" . open-notes) :ensure nil
:commands (deft) :bind ("<f5>" . open-notes)
:config :commands (deft)
(add-to-list 'evil-emacs-state-modes 'deft-mode) :config
(setq deft-extensions '("md") (add-to-list 'evil-emacs-state-modes 'deft-mode)
deft-default-extension "md" (setq deft-extensions '("md")
deft-markdown-mode-title-level 1 deft-default-extension "md"
deft-auto-save-interval 300.0 deft-markdown-mode-title-level 1
deft-file-limit 50 deft-auto-save-interval 300.0
deft-use-filename-as-title nil deft-file-limit 50
deft-use-filter-string-for-filename t deft-use-filename-as-title nil
deft-strip-summary-regexp (concat "\\(" deft-use-filter-string-for-filename t
"[\n\t]" ;; blank deft-strip-summary-regexp (concat "\\("
"\\|^#\\+[[:upper:]_]+:.*$" ;; org-mode metadata "[\n\t]" ;; blank
"^---\\(?:\n.*\\)*---.*$" "\\|^#\\+[[:upper:]_]+:.*$" ;; org-mode metadata
"\\)") "^---\\(?:\n.*\\)*---.*$"
"\\)")
deft-recursive t) deft-recursive t)
(setq deft-file-naming-rules (setq deft-file-naming-rules
'((noslash . "-") '((noslash . "-")
(nospace . "_") (nospace . "_")
(case-fn . downcase))) (case-fn . downcase)))
(setq deft-directory "~/nextcloud/10_documents/") (setq deft-directory "~/nextcloud/10_documents/")
(add-hook 'deft-mode-hook (lambda() (display-line-numbers-mode -1))) (add-hook 'deft-mode-hook (lambda() (display-line-numbers-mode -1)))
;; A function to create a persp for my notes ;; A function to create a persp for my notes
(defun open-notes () (defun open-notes ()
"Create a notes perspective and open deft" "Create a notes perspective and open deft"
(interactive) (interactive)
(persp-switch "notes") (persp-switch "notes")
(deft))) (deft))))

View File

@ -1,23 +1,24 @@
(use-package denote (when (boundp 'enable-notes)
:bind (use-package denote
(("C-c n r" . denote-rename-file) :bind
("C-c n p" . az-denote-create-new-note-from-region) (("C-c n r" . denote-rename-file)
("C-c n n" . denote)) ("C-c n p" . az-denote-create-new-note-from-region)
:config ("C-c n n" . denote))
(defun az-denote-create-new-note-from-region (beg end) :config
"Create note whose contents include the text between BEG and END. Prompt (defun az-denote-create-new-note-from-region (beg end)
"Create note whose contents include the text between BEG and END. Prompt
for title and keywords of the new note." for title and keywords of the new note."
(interactive "r") (interactive "r")
(if-let (((region-active-p)) (if-let (((region-active-p))
(text (text
(buffer-substring-no-properties beg end))) (buffer-substring-no-properties beg end)))
(progn (denote (progn (denote
(denote-title-prompt) (denote-keywords-prompt)) (insert text)) (denote-title-prompt) (denote-keywords-prompt)) (insert text))
(user-error (user-error
"No region is available"))) "No region is available")))
(add-hook 'find-file-hook #'denote-link-buttonize-buffer) (add-hook 'find-file-hook #'denote-link-buttonize-buffer)
(setq denote-rename-buffer-mode 1 (setq denote-rename-buffer-mode 1
denote-excluded-directories-regexp "99_archive" denote-excluded-directories-regexp "99_archive"
denote-file-type "markdown-yaml" denote-file-type "markdown-yaml"
denote-directory "~/nextcloud/10_documents/" denote-directory "~/nextcloud/10_documents/"
denote-yaml-front-matter "---\ntitle: %s\ndate: %s\ntags: %s\nidentifier: %S\n---\n\n")) denote-yaml-front-matter "---\ntitle: %s\ndate: %s\ntags: %s\nidentifier: %S\n---\n\n")))

View File

@ -4,5 +4,6 @@
;;(setq enable-emojis t) ;;(setq enable-emojis t)
;;(setq enable-font t) ;;(setq enable-font t)
;;(setq enable-lantool t) ;;(setq enable-lantool t)
;;(setq enable-notes t)
;;(setq enable-pdf-tools t) ;;(setq enable-pdf-tools t)
;;(setq enable-scroll-bar t) ;;(setq enable-scroll-bar t)