# Normal assignment doesn't work.
lines=$(printf "abc\n123\n\n"); echo -n "$lines" | wc -l
# 1 -- WRONG
empty=$(printf ""); echo -n "$empty" | wc -l
# 0 -- WRONG
# Problem is that variable assignment strips all newlines when assigning the
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Non-macro macro helper | |
(defun run-and-act-on-new-window (cmd props timeout function) | |
"Run a command, setup a handler to apply a function to the new window once it's open." | |
(let* (focus-window-handler | |
timeout-handler | |
(timer (run-with-timer timeout nil | |
#'(lambda () | |
;; Remove hooks after period of time should something go wrong. | |
(when focus-window-handler | |
(remove-hook *focus-window-hook* focus-window-handler)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defvar org-roam-directories nil | |
"Paths to org-roam files. List where CAR is name and CDR is path.") | |
;; Example: | |
;; (setq org-roam-directories '(("Home roam" . "~/Documents/home-roam") | |
;; ("Work roam" . "~/Documents/work-roam"))) | |
;; Set first directory | |
(setq org-roam-directory (cdar org-roam-directories)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; -*- lexical-binding: t -*- | |
(defun org-roam-search () | |
"Search for backlinks for a given article in a new buffer." | |
(interactive) | |
(let* ((source-org-roam-directory org-roam-directory) | |
(completions (org-roam--get-title-path-completions)) | |
(title (completing-read "File: " completions)) | |
(file-path (cdr (assoc title completions))) | |
(buf-name (format "*org-roam-search-%s*" title)) |
OlderNewer