meedstrom / quickroam Goto Github PK
View Code? Open in Web Editor NEWFast org-roam commands
License: GNU General Public License v3.0
Fast org-roam commands
License: GNU General Public License v3.0
This is the function that consumes most of the time when finding nodes:
https://gist.github.com/dmgerman/1c76743aa36c5d86112123fd333566e2
The advantage of memoizing this function is that it has no impact on querying the database.
I expect quickroam-insert
to insert in the same way org-roam-node-insert
does, which is to insert the link at (point)
. Instead, the link is inserted on the second line of the file and anything on that line is pushed to the side.
I suspect it's because of this bit:
;; Try to strip the todo keyword, whatever counts as todo syntax
;; in the target file. Fail silently because it matters not much.
(ignore-errors
(org-roam-with-file
(expand-file-name (plist-get node :file) org-roam-directory)
nil
(widen)
(goto-char 1)
(forward-line (1- (plist-get node :line-number)))
(setq link-desc (nth 4 (org-heading-components)))))
I don't understand the purpose of this code. Is the title not an appropriate link description? What's that about stripping the TODO
keyword? Does this assume something about the current buffer and/or the buffer of the node we've selected?
I restored my expected behavior by using a modified quickroam-insert
:
(defun cashpw/quickroam-insert ()
"Fast substitute for `org-roam-node-insert'."
(interactive nil org-mode)
(require 'org-roam)
(when (or (hash-table-empty-p quickroam-cache)
(not quickroam-mode))
(quickroam-reset))
(let* ((beg nil)
(end nil)
(region-text (when (region-active-p)
(setq beg (region-beginning))
(setq end (region-end))
(org-link-display-format
(buffer-substring-no-properties beg end))))
(title (completing-read "Node: " quickroam-cache nil nil nil 'org-roam-node-history))
(node (gethash title quickroam-cache))
(id (plist-get node :id))
(link-desc (or region-text title)))
(if node
(atomic-change-group
(when region-text
(delete-region beg end))
(insert (org-link-make-string (concat "id:" id) link-desc))
(run-hook-with-args 'org-roam-post-node-insert-hook id link-desc))
(atomic-change-group
(org-roam-capture-
:node (org-roam-node-create :title title)
:props (append
(when region-text
(list :region (cons (set-marker (make-marker) beg)
(set-marker (make-marker) end))))
(list :link-description link-desc
:finalize 'insert-link)))))))
This appears to be a ripgrep bug, which I filed: BurntSushi/ripgrep#2779
For now, if for some reason you write several empty subtree nodes, just leave a blank line or some text between in each.
Aliases defined in the PROPERTIES header with :ROAM_ALIASES:
are not picked up by quickroam.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.