You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Context: I want to have a menu of personal zetteldeft related functions that changes depending on whether I'm in zetteldeft territory or not.
I created my own version; it's just a rewrite of your version but it returns nil if we're outside of deft:
(defunmw::zetteldeft--check ()
"this is copied from zetteldeft--check, but doesn't throw errors."
(and (buffer-file-name)
(string-match-p
(regexp-quote (file-truename deft-directory))
(file-truename (buffer-file-name)))))
Here is how I'm using it:
;; If I ever want these interleaved I could turn them into cons cells;; or something and filter accordingly below
(setq mw::zetteldeft-ui-helper-functions-in-deft
'(mw::zetteldeft-cleanup-tags
mw::zetteldeft-add-tag
mw::zetteldeft-insert-template))
(setq mw::zetteldeft-ui-helper-functions-anywhere
'(mw-zetteldeft-find-notes-tagged-with
mw::zetteldeft-find-file))
;; I might someday want a list of functions -only-outside-deft, but so far I;; haven't had a need.
(defunmw::zetteldeft-custom-function ()
(interactive)
(let* ((in-deft (mw::zetteldeft--check))
(pool (-concat (if in-deft
mw::zetteldeft-ui-helper-functions-in-deft
nil)
mw::zetteldeft-ui-helper-functions-anywhere))
(func (funcall#'helm-comp-read;; zetteldeft-completing-read"run: "
pool))
(symbol (intern func)))
(funcall symbol)))
The text was updated successfully, but these errors were encountered:
I'm aware that this might require seven functions in zetteldeft.org to be rewritten -- not to mention its impact on an unknown amount of third party code that depends on zetteldeft--check. So, I wouldn't change zetteldeft--check just yet.
There's probably a good way to keep zetteldeft--check's behavior, create an unexceptional function that does basically the same thing, and not duplicate much code, but I haven't worked it out yet.
Context: I want to have a menu of personal zetteldeft related functions that changes depending on whether I'm in zetteldeft territory or not.
I created my own version; it's just a rewrite of your version but it returns
nil
if we're outside of deft:Here is how I'm using it:
The text was updated successfully, but these errors were encountered: