EFLS / zetteldeft

A Zettelkasten system! Or rather, some functions on top of the emacs deft package.
https://efls.github.io/zetteldeft
GNU General Public License v3.0
393 stars 42 forks source link

Error: Wrong number of arguments with either zetteldeft-new-file or zetteldeft-new-file-and-link #87

Closed sjsrey closed 3 years ago

sjsrey commented 3 years ago

I'm seeing the following error:

let: Wrong number of arguments: (lambda nil "Generate an ID in the format of `zetteldeft-id-format'." (format-time-string zetteldeft-id-format)), 1

and this is on a fresh install of spacemacs (master) and zetteldeft (master).

EFLS commented 3 years ago

Can you share some more details on your setup? Do you have any configuration in your init.el?

sjsrey commented 3 years ago
;; zettledeft
(add-to-list 'load-path "~/packages/zetteldeft/")
(require 'zetteldeft)
(spacemacs/declare-prefix "d" "deft")

(spacemacs/set-leader-keys "dd" 'deft)
(spacemacs/set-leader-keys "dR" 'deft-refresh)
(spacemacs/set-leader-keys "dD" 'zetteldeft-deft-new-search)
(spacemacs/set-leader-keys "ds" 'zetteldeft-search-at-point)
(spacemacs/set-leader-keys "dc" 'zetteldeft-search-current-id)
(spacemacs/set-leader-keys "df" 'zetteldeft-follow-link)
(spacemacs/set-leader-keys "dF" 'zetteldeft-avy-file-search-ace-window)
(spacemacs/set-leader-keys "dl" 'zetteldeft-avy-link-search)
(spacemacs/set-leader-keys "dt" 'zetteldeft-avy-tag-search)
(spacemacs/set-leader-keys "dT" 'zetteldeft-tag-buffer)
(spacemacs/set-leader-keys "di" 'zetteldeft-find-file-id-insert)
(spacemacs/set-leader-keys "dI" 'zetteldeft-find-file-full-title-insert)
(spacemacs/set-leader-keys "do" 'zetteldeft-find-file)
(spacemacs/set-leader-keys "dn" 'zetteldeft-new-file)
(spacemacs/set-leader-keys "dN" 'zetteldeft-new-file-and-link)
(spacemacs/set-leader-keys "dr" 'zetteldeft-file-rename)
(spacemacs/set-leader-keys "dx" 'zetteldeft-count-words)

(setq deft-directory "~/Dropbox/org/notes/zetteldeft")
(setq deft-recursive t)

(defcustom zetteldeft-id-format "%Y-%m-%d-%H%M"
  "Format used when generating zetteldeft IDs.

Be warned: the regexp to find IDs is set separately.
If you change this value, set `zetteldeft-id-regex' so that
the IDs can be found.

Check the documentation of the `format-time-string'
function to see which placeholders can be used."
  :type 'string
  :group 'zetteldeft)

(setq deft-new-file-format zetteldeft-id-format)

(defun zetteldeft-generate-id ()
  "Generate an ID in the format of `zetteldeft-id-format'."
  (format-time-string zetteldeft-id-format))
EFLS commented 3 years ago

Everything below the line with deft-recursive is not needed for your setup.

The issue is caused by the defun zetteldeft-generate-id. The way you define it, it doesn't do anything different from the default, so you can just drop it.

Moreover, the way you define it is the cause of the issue: it should take two arguments, the second of which is optional. But for your setup, you could just drop it altogether. And I'd drop the defcustom too.

sjsrey commented 3 years ago

Thanks - that was the issue!