     (defun modi/deft-dwim (open-deft-buffer)
       "Launch deft or quit a deft opened file based on context.
 
-If major-mode is `deft-mode', bury the buffer.
-If in a deft-opened file buffer, call `modi/deft-quit'.
-Else call `deft'.
+If OPEN-DEFT-BUFFER is non-nil, open `deft'.
 
-With prefix argument, open `deft'."
+Else if major-mode is `deft-mode', bury the buffer.
+Else if in a deft-opened file buffer, call `modi/deft-quit'.
+Else call `deft'."
       (interactive "P")
       (cond
        (open-deft-buffer ; when using `C-u'

;; https://github.com/jrblevin/deft

(use-package deft
  :commands (modi/deft-dwim deft deft-new-file deft-find-file)
  :init
  (progn
    (bind-key "C-c d" #'modi/deft-dwim modi-mode-map)
    (bind-key "<f6>"  #'modi/deft-dwim modi-mode-map))
  :config
  (progn
    (setq deft-directory (concat org-directory "notes/"))
    (setq deft-extensions '("org"))
    (setq deft-default-extension (copy-sequence (car deft-extensions)))
    (setq deft-use-filename-as-title nil) ; show actual titles in *Deft* buffer
    (setq deft-use-filter-string-for-filename t)
    (setq deft-auto-save-interval 0) ; default is 1.0, 0 to disable auto-save
    (setq deft-file-naming-rules '((nospace . "_")
                                   (case-fn . downcase)))

    ;; http://pragmaticemacs.com/emacs/tweaking-deft-quicker-notes/
    (defvar modi/pre-deft-window-configuration nil

    (define-key deft-mode-map (kbd "C-o") nil)
    (bind-keys
     :map deft-mode-map
      ("RET"        . modi/deft-complete)
      ("C-S-m"      . deft-new-file)
      ("<S-return>" . deft-new-file)
      ("C-c C-o"    . deft-open-file-other-window))))


(provide 'setup-deft)
