-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[question / feature request] using deft in a custom link? #52
Comments
I have also been thinking about using Currently, I am creating an |
@EFLS I'm doing something very similar. I'm creating my ids using the 201804021450 timestamp convention, which I have bound to an abbrev. Currently I'm copy-pasting ids into a deft field. I'd like a more efficient way of doing a bunch of things here. 😄 (Is there a place we could compare notes where we're not off-topic, if you've gotten farther on this problem than I have?) |
A function that would allow easier searching with deft would indeed be useful. You also might want to check out the |
Apparently, we can use The first function provides an API for global search in Deft notes (can be added to Deft mode): (defun deft-search-global (str)
"Call Deft search on filter string STR."
;; Sanitize the filter string
(setq str (replace-regexp-in-string "[[:space:]]+" " " str))
;; Call Deft search on the filter string
(let ((deft-incremental-search t)) (deft) (deft-filter str t))
;; If there is a single match, open the file
(when (= (length deft-current-files) 1)
(deft-open-file (car deft-current-files)))) The second function calls (defun deft-search ()
"Call Deft search on thing at point.
Thing can be a double-bracketed link, a hashtag, or a word."
(interactive)
(require 'thingatpt)
(let* ((link-re "\\[\\[\\([^]]+\\)\\]\\]")
(htag-re "\\([#@]\\(?:[[:alnum:]_-]+:\\)?[[:alnum:]_-]+\\)")
(string (cond
((thing-at-point-looking-at link-re)
(match-string-no-properties 1))
((thing-at-point-looking-at htag-re)
(match-string-no-properties 1))
(t (thing-at-point 'word t)))))
(if string
(deft-search-global string)
(user-error "No search term at point")))) |
Many thanks @saf-dmitry. I'm fairly new to Check it out here if you're interested: https://github.com/EFLS/zetteldeft @mediapathic, check it out if you're still looking for a Zettelkasten setup based on |
I am trying to implement a zettlekasten-like system in emacs using deft and org-mode. I'm currently making a custom link type that allows for seeing all items that match that id rather than linking to a file directly. Put another way: I want a custom link type that has the effect of executing
deft
with the contents of the link being the search string. I feel like I essentially understand how to create a custom link type, but callingdeft
with an argument doesn't work. My code currently looks like this:My question then, is, is there a function within deft that I could be calling that does take an argument and opens a deft buffer (preferably in other window)? If not, is it easy to modify
deft
to do so? Alternately, am I just going about this in a ridiculous way and there's already an easier solution?Thanks!
The text was updated successfully, but these errors were encountered: