denote-grep does find subset of denote-grep-marked-dired-files only
Hello Prot,
I'm struggling with the denote-grep command once more.
So far what I observed is that I can query a string contained in two org files in the same denote silo, denote-grep will only find one of the occurrences while if I mark the not-found file explicitly in dired, denote-grep-marked-dired-files does indeed find that too.
Is there an upper bound to as many files can be in a silo for grep to still take each into account ?
Cheers
Hello @573!
Is there an upper bound to as many files can be in a silo for grep to still take each into account ?
I believe not, though I am not looking at the code right now.
Could it be that the discrepancy has to do with the file name in question? Maybe it is affect by the denote-exclude-* options we have? Again, I am not looking at the code. The point is to understand the case better.
I see
(setq denote-excluded-directories-regexp nil)
(setq denote-excluded-keywords-regexp nil)
I used the sample config no. 2 (C-h i g (denote)sample)
I also looked again there are also no codepage differences (umlauts and the like) at play.
We will need to reproduce this somehow. Can you use emacs -Q and then evaluate the following in the scratch buffer?
(require 'package)
(package-initialize)
;; YOUR DENOTE CONFIG HERE
Then check if the issue persists. I cannot get what you describe on my end.
We will need to reproduce this somehow. Can you use
emacs -Qand then evaluate the following in the scratch buffer?(require 'package) (package-initialize)
;; YOUR DENOTE CONFIG HERE
Then check if the issue persists. I cannot get what you describe on my end.
With 208 files in the denote-directory and the steps described I hit same issue.
For posterity my *scratch* buffer evaluated:
more
;; This buffer is for text that is not saved, and for Lisp evaluation.
;; To create a file, visit it with ‘C-x C-f’ and enter text in its buffer.
(require 'package)
(package-initialize)
(use-package denote
:ensure t
:hook
( ;; If you use Markdown or plain text files, then you want to make
;; the Denote links clickable (Org renders links as buttons right
;; away)
(text-mode . denote-fontify-links-mode-maybe)
;; Apply colours to Denote names in Dired. This applies to all
;; directories. Check `denote-dired-directories' for the specific
;; directories you may prefer instead. Then, instead of
;; `denote-dired-mode', use `denote-dired-mode-in-directories'.
(dired-mode . denote-dired-mode))
:bind
;; Denote DOES NOT define any key bindings. This is for the user to
;; decide. For example:
( :map global-map
("C-c n n" . denote)
("C-c n d" . denote-dired)
("C-c n g" . denote-grep)
;; If you intend to use Denote with a variety of file types, it is
;; easier to bind the link-related commands to the `global-map', as
;; shown here. Otherwise follow the same pattern for `org-mode-map',
;; `markdown-mode-map', and/or `text-mode-map'.
("C-c n l" . denote-link)
("C-c n L" . denote-add-links)
("C-c n b" . denote-backlinks)
("C-c n q c" . denote-query-contents-link) ; create link that triggers a grep
("C-c n q f" . denote-query-filenames-link) ; create link that triggers a dired
;; Note that `denote-rename-file' can work from any context, not just
;; Dired bufffers. That is why we bind it here to the `global-map'.
("C-c n r" . denote-rename-file)
("C-c n R" . denote-rename-file-using-front-matter)
;; Key bindings specifically for Dired.
:map dired-mode-map
("C-c C-d C-i" . denote-dired-link-marked-notes)
("C-c C-d C-r" . denote-dired-rename-files)
("C-c C-d C-k" . denote-dired-rename-marked-files-with-keywords)
("C-c C-d C-R" . denote-dired-rename-marked-files-using-front-matter))
:config
;; Remember to check the doc string of each of those variables.
(setq denote-directory (expand-file-name "Documents/zettelkasten" (getenv "USERPROFILE")))
(setq denote-save-buffers t)
(setq denote-known-keywords '("emacs"))
(setq denote-infer-keywords t)
(setq denote-sort-keywords t)
(setq denote-prompts '(title keywords))
(setq denote-excluded-directories-regexp nil)
(setq denote-excluded-keywords-regexp nil)
(setq denote-rename-confirmations '(rewrite-front-matter modify-file-name))
;; Pick dates, where relevant, with Org's advanced interface:
(setq denote-date-prompt-use-org-read-date t)
;; Automatically rename Denote buffers using the `denote-rename-buffer-format'.
(denote-rename-buffer-mode 1))
When, in dired buffer for denote-directory I hit U followed by t to mark all files and then hit ! to run wc -l * on them I get command line too long.
to run
wc -l *on them
Strange... In my case, in a directory with ~200 files, the same steps produce a buffer with the word count for each file. I tried it with 300 files as well. Same result.
Let me rephrase the problem you are facing so that I am sure I understand:
- The command
denote-grepdoes find all known matches. - If you go to Dired and mark the files where you know matches exist, then
denote-grep-marked-dired-filesfinds everything as expected. - Your goal is to have
denote-grepwork without having to mark any files.
Is this correct?
to run
wc -l *on themStrange... In my case, in a directory with ~200 files, the same steps produce a buffer with the word count for each file. I tried it with 300 files as well. Same result.
Let me rephrase the problem you are facing so that I am sure I understand:
* The command `denote-grep` does find all known matches. * If you go to Dired and mark the files where you know matches exist, then `denote-grep-marked-dired-files` finds everything as expected. * Your goal is to have `denote-grep` work without having to mark any files.Is this correct?
- The command denote-grep does NOT find all known matches.
- If [I] go to Dired and mark the files where [I] know matches exist, then denote-grep-marked-dired-files finds everything as expected.
- [My] goal is to have denote-grep work without having to mark any files.
Yes with correction.
- The command denote-grep does NOT find all known matches.
Right, I made a typo there.
Yes with correction.
I see. Then we need to see if anybody else has this experience.
I tried this on a Debian stable system running Emacs 31.0.50 (recent build from source).
$ which find grep wc xargs rg
/c/Users/username/scoop/apps/git/current/usr/bin/find
/c/Users/username/scoop/apps/git/current/usr/bin/grep
/c/Users/username/scoop/apps/git/current/usr/bin/wc
/c/Users/username/scoop/apps/git/current/usr/bin/xargs
GNU Emacs 30.1 (build 2, x86_64-w64-mingw32) of 2025-02-23