Comments (6)
My hunch was correct - it is indeed calling vertico-sort when :sort is set to t --
Debugger entered--entering a function:
* vertico-sort-history-length-alpha((#(" 20001 ..." 0 13 (node #s(org-roam-node :file "/home/akash/Desktop/test2/test/20001.org" :file-title "20001" :file-hash nil :file-atime (26185 49027 710064 549000) :file-mtime (26185 49027 710064 549000) :id "20240519T142944.642943" :level 0 :point 1 :todo nil :priority nil :scheduled nil :deadline nil :title "20001" :properties (("CATEGORY" . "20001") ("ID" . "20240519T142944.642943") ("BLOCKED" . "") ("FILE" . "/home/akash/Desktop/test2/test/20001.org") ("PRIORITY" . "B")) :olp nil :tags nil :aliases nil :refs nil)) 13 18 (node #s(org-roam-node :file "/home/akash/Desktop/test2/test/20001.org" :file-title "20001" :file-hash nil :file-atime (26185 49027 710064 549000) :file-mtime (26185 49027 710064 549000) :id "20240519T142944.642943" :level 0 :point 1 :todo nil :priority nil :scheduled nil :deadline nil :title "20001" :properties (("CATEGORY" . "20001") ("ID" . "20240519T142944.642943") ("BLOCKED" . "") ("FILE" . "/home/akash/Desktop/test2/test/20001.org") ("PRIORITY" . "B")) :olp nil :tags nil :aliases nil :refs nil) face bold) 18 130 (node #s(org-roam-node :file "/home/akash/Desktop/test2/test/20001.org" :file-title "20001" :file-hash nil :file-atime (26185 49027 710064 549000) :file-mtime (26185 49027 710064 549000) :id "20240519T142944.642943" :level 0 :point 1 :todo nil :priority nil :scheduled nil :deadline nil :title "20001" :properties (("CATEGORY" . "20001") ("ID" . "20240519T142944.642943") ("BLOCKED" . "") ("FILE" . "/home/akash/Desktop/test2/test/20001.org") ("PRIORITY" . "B")) :olp nil :tags nil :aliases nil :refs nil))) ... ... ... ... ... ... ... ... ... ... ... ... ... ...))
vertico--recompute(0 "")
vertico--update()
vertico--prepare()
consult--read((... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) :prompt "Node: " :initial nil :sort t :require-match nil :category org-roam-node :history org-roam-node-history :state ...)
(let* ((nodes (org-roam-node-read--completions filter-fn sort-fn)) (prompt (or prompt "Node: ")) (state-func (if nodes (progn (consult-org-roam--node-preview)))) (node (consult--read nodes :prompt prompt :initial initial-input :sort t :require-match require-match :category 'org-roam-node :history 'org-roam-node-history :state state-func :annotate #'(lambda (title) (funcall org-roam-node-annotation-function (get-text-property 0 ... title))) :lookup #'(lambda (selected candidates input narrow) (alist-get selected candidates input nil #'equal))))) (if (progn (and (memq (type-of node) cl-struct-org-roam-node-tags) t)) (progn node) (progn (record 'org-roam-node nil nil nil nil nil nil nil nil nil nil nil nil node nil nil nil nil nil))))
consult-org-roam-node-read(nil (lambda (node) (custom/org-roam-node--filter-by-entries node nil org-roam-filter-by-entries)) nil)
apply(consult-org-roam-node-read (nil (lambda (node) (custom/org-roam-node--filter-by-entries node nil org-roam-filter-by-entries)) nil))
org-roam-node-read(nil (lambda (node) (custom/org-roam-node--filter-by-entries node nil org-roam-filter-by-entries)) nil)
Should clarify this issue in the visible place to clear confusion,
And also let users configure it through a defcustom
maybe if possible.
from consult-org-roam.
I think I've found the solution:
remove / comment the line :
:sort nil ;; cands are already sorted
from the consult-org-roam-node-read function, in the call to the consult--read function.
from consult-org-roam.
Hi @Cletip ,
thanks for the update. Really nice that you found it. Do you think this should be changed or maybe exposed to the user to customize that?
Best,
jgru
from consult-org-roam.
Hello @jgru !
I think you should delete the line: if it's nil, then I don't think it's useful (because it's nil, but the order was modified because of the nil : it's not the behavior that we want, we want to not touch the order !). On the other hand, I don't know how the underlying of consult, so you'd have to check that it doesn't interfere with other things (and explain that the consult-org-roam-buffer-enabled variable just enables org-roam buffers in consult-buffer, and not doesn't change the order, for example).
So yes, to sum up, delete the line (and maybe explain the consult-org-roam-buffer-enabled variable in more detail in the readme ?).
Best too,
Cletip
from consult-org-roam.
I was looking for this too - I realised this was broken, when trying to test a cache to the #'org-roam-node-read--completions
It was turned off here 3c2701e
I am unsure how org-roam's sorting would clash with it -- if user sets a custom sort function. Will consult's sort override it ?
It was turned off in the first place because user complained that org-roam's sort was failing and being overriden -- if I am not incorrect?
If I may ask why is the history commented out?
Thanks.
from consult-org-roam.
Also I want to note that I think org-roam's atime implementation is broken. the atime is stored in a node -- but nodes are not updated unless some change is pushed -- so the atime sort is bound to fail. atime and mtime are functionally the same.
For test,
select files.atime from files where files.title like "%filetitle%";
(org-roam-db-query
[:select [files:atime]
:from files
:where (like files:title "%filetitle%")])
replace filetitle with a title of a org file in your system tracked by org roam
Youll notice that the atime doesn't change if you simply visit the file. So its broken because the atime sort is broken in org-roam and users notice this as a fault of consult-org-roam because it relies on sort passed by org-roam -- my guess.
Please correct me if you have different result in your query. But if this is true -- it should default to nil - and force the user to either roll out their own sort-fn or get the sort function of their minibuffer by setting :sort to t -- which will override org-roam's.
from consult-org-roam.
Related Issues (20)
- Add function to create dummy data for testing purposes HOT 1
- Question: purpose of consult-org-roam-file-find HOT 3
- Strip leading path of candidates presented by consult-org-roam-file-find
- [BUG] cursor moved when previewing the same buffer and the first item is far from the current cursor HOT 5
- consult-buffer doesn't show capture buffers HOT 4
- consult-buffer shows duplicate capture buffers
- `consult-buffer` slowness when using `consult-org-roam` HOT 6
- Remove org-roam-buffer-source when disabling consult-org-roam-mode
- After using :preview-key M-., how to jump to the previewed file directly? HOT 3
- `org-roam-node-insert` failed to insert into correct place. HOT 2
- Sorting (sort-fn) function does not work HOT 7
- major-mode not applied in previews for consult-org-roam-node-read HOT 2
- consult-org-roam-buffer-after-buffers does not produce the expected outcome
- consult-org-roam-buffer, do not alter visiting order of buffers HOT 4
- How to jump to the search result? HOT 3
- Org heading node is not searched HOT 3
- consult-org-roam-forward-links is not working HOT 2
- Get only Org results HOT 2
- Can I call `consult-org-roam-buffer` source as a command ? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from consult-org-roam.