aboutsummaryrefslogtreecommitdiffstats
path: root/doom/config.el
diff options
context:
space:
mode:
authorYann Herklotz <git@yannherklotz.com>2021-10-07 11:31:04 +0100
committerYann Herklotz <git@yannherklotz.com>2021-10-07 11:31:04 +0100
commit45ada01381cffdbeac3bd9532d2be1f09929cef0 (patch)
tree392f8cf8e93bdaa1f24c2854e1fb2470529366fd /doom/config.el
parente4f0e140b8c23a008171f3d47af7ce42fc7973fa (diff)
downloaddotfiles-45ada01381cffdbeac3bd9532d2be1f09929cef0.tar.gz
dotfiles-45ada01381cffdbeac3bd9532d2be1f09929cef0.zip
Add hugo to init and remove org-zettelkasten
Diffstat (limited to 'doom/config.el')
-rw-r--r--doom/config.el63
1 files changed, 8 insertions, 55 deletions
diff --git a/doom/config.el b/doom/config.el
index 0eaca7b..ec5b1be 100644
--- a/doom/config.el
+++ b/doom/config.el
@@ -629,64 +629,17 @@
;;(use-package! alectryon
;; :load-path "/Users/yannherklotz/Projects/alectryon/etc/elisp")
-(defun ymhg/incr-id (ident)
- (let* ((ident-list (append nil ident nil))
- (last-ident (last ident-list)))
- (setcar last-ident (+ (car last-ident) 1))
- (concat ident-list)))
-
-(defun ymhg/incr-id-total (ident)
- (if (string-match-p "\\(.*[a-z]\\)\\([0-9]+\\)$" ident)
- (progn
- (string-match "\\(.*[a-z]\\)\\([0-9]+\\)$" ident)
- (let ((pre (match-string 1 ident))
- (post (match-string 2 ident)))
- (concat pre (number-to-string (+ 1 (string-to-number post))))))
- (ymhg/incr-id ident)))
-
-(defun ymhg/branch-id (ident)
- (if (string-match-p ".*[0-9]$" ident)
- (concat ident "a")
- (concat ident "1")))
-
-(defun ymhg/org-zettelkasten-create (incr newheading)
- (let* ((current-id (org-entry-get nil "CUSTOM_ID"))
- (next-id (funcall incr current-id)))
- (funcall newheading)
- (org-set-property "CUSTOM_ID" next-id)))
-
-(defun org-zettelkasten-create-next ()
- (ymhg/org-zettelkasten-create
- 'ymhg/incr-id 'org-insert-heading))
-
-(defun org-zettelkasten-create-branch ()
- (ymhg/org-zettelkasten-create
- 'ymhg/branch-id '(lambda () (org-insert-subheading ""))))
-
-(defun org-zettelkasten-create-dwim ()
- (interactive)
- (let ((current-point (save-excursion
- (org-back-to-heading)
- (point)))
- (next-point (save-excursion
- (org-forward-heading-same-level 1 t)
- (point))))
- (if (= current-point next-point)
- (org-zettelkasten-create-next)
- (org-zettelkasten-create-branch))))
-
-;;(defun org-zettelkasten-search-current-id ()
-;; (interactive)
-;; (let ((current-id (org-entry-get nil "CUSTOM_ID")))
-;; (counsel-rg (concat "#" current-id) "~/Dropbox/zk" "-g *.org" "ID: ")))
-
-(defun org-zettelkasten-search-current-id ()
+(use-package! org-zettelkasten
+ :config
+ (add-hook 'org-mode-hook #'org-zettelkasten-mode)
+
+ (defun org-zettelkasten-search-current-id ()
+ "Use `consult-ripgrep' to search for the current ID in all files."
(interactive)
(let ((current-id (org-entry-get nil "CUSTOM_ID")))
- (consult-ripgrep "~/Dropbox/zk" (concat "[\\[:]." current-id "\\]#"))))
+ (consult-ripgrep org-zettelkasten-directory (concat "[\\[:]." current-id "\\]#"))))
-(define-key org-mode-map (kbd "C-c y n") #'org-zettelkasten-create-dwim)
-(define-key org-mode-map (kbd "C-c y z") #'org-zettelkasten-search-current-id)
+ (define-key org-zettelkasten-mode-map (kbd "s") #'org-zettelkasten-search-current-id))
(use-package! ox-hugo
:after ox)