My goal is to use
grep to find other Org files, use
next-error to switch to those files, copy the link to the
grep match, then go back and paste that link.
It worked for a long time as a macro, but when it finally broke I decided to write it as a proper function. But the buffer-switches that worked as macro don't seem to be working as a function. Why?
;; Can't use `with-current-buffer' because it's used in `next-error' (let ((thisbuf (current-buffer))) ;; Unless interactive, this doesn't change `current-buffer', at least not in time for `org-store-link' (next-error) ;; Message says thisbuf, not the one `next-error' takes me to (message (concat "Current buffer: " (current-buffer))) ;; Why does it store my link in `thisbuf' instead of the buffer `next-error' goes to? (org-store-link nil 1) (switch-to-buffer thisbuf))