mclear-tools / consult-notes

Use consult to search notes
GNU General Public License v3.0
164 stars 15 forks source link

Filter candidates fails if search pattern occurs in directory path #25

Closed hsingko closed 1 year ago

hsingko commented 1 year ago

Suppose I have these note source:

(setq consult-notes-sources
      '(("Org"             ?o "~/Dropbox/org-files")
        ("Org Refile"      ?r "~/Dropbox/Work/projects/notebook/org-refile")))

Patterns like D,Drop, Dropbox etc won't filter candidates.

This problem caused by below code: https://github.com/mclear-tools/consult-notes/blob/da0cd4105fcba365375cba45aa80d293969231fa/consult-notes.el#L182

Although the dir is invisible, it can still be searched by consult, but it's invisible to user, so it looks like nothing happened. It will be a problem if note title contains those pattern, say, 2022-messagebox.org

I noticed that consult-notes-denote handles this situation differently, dir is put into text-property, maybe consult-note should do similar thing?

mclearc commented 1 year ago

If you pull the most recent version I've cleaned this up so the path gets listed with the annotations. This still allows narrowing with the relevant char but there is no longer an invisible text property that might mess things up. See commit https://github.com/mclear-tools/consult-notes/commit/3f0947f22715ad9344797d382986e1b46d81c07d (note that some variables names have changed).

hsingko commented 1 year ago

filter works now.

hsingko commented 1 year ago

@mclearc btw, I think there's a mistake in README.org:

  :config
  (setq consult-notes-file-dir-sources '("Name"  ?key  "path/to/dir")) ;; Set notes dir(s), see below

consult-notes-file-dir-sources should be a list