Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
multiple deft #emacs
(defun deft-in-dir (directory &optional buffer)
(interactive "Ddir: ")
(setq buffer (or buffer "*deft-in-dir*"))
(switch-to-buffer (or buffer "*deft-in-dir*"))
;; load deft if not loaded yet
(unless (and
(boundp 'deft-directory)
(boundp 'deft-buffer))
(require 'deft))
;; must bind because deft-mode calls kill-all-local-variables
(unless (eq major-mode 'deft-mode)
(let ((deft-directory directory)
(deft-buffer buffer))
(deft-mode))
(make-local-variable 'deft-directory)
(make-local-variable 'deft-buffer)
(setq deft-directory directory deft-buffer buffer)))
;; sample
(defun snippets ()
(interactive)
(deft-in-dir "~/.snippets" "*snippets*"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.