In my solution I do store the buffer. Maybe for some reason the id is in another buffer with narrowing, and you want to preserve that narrowing when you return. I originally did that with a marker, so you could restore point to, but I decided to take that out. I wasn't aware you could have dangling markers! I guess you would want to use more global variables, so there would only be two. and hopefully you don't follow multiple id links through narrowed buffers in a row!
Rasmus writes: > John Kitchin <jkitc...@andrew.cmu.edu> writes: > >> I like the idea too. I worked out a partial solution for id links here: >> http://kitchingroup.cheme.cmu.edu/blog/2015/10/24/Saving-the-current-restriction-and-restoring-it-while-following-links/ >> using the idea for saving and restoring the restriction. > > Thanks, John. > > You will probably want to use markers since one might edit stuff > in-between the widening and going back to the narrow. > > > http://www.gnu.org/software/emacs/manual/html_node/elisp/Overview-of-Markers.html#Overview-of-Markers > > Markers should be cleaned up, which might prove difficult since one might > not go back with C-c &, but you can at least ensure that at most two loose > markers exists (potentially per Org buffer). > > Also, I wonder if there exits cases where you would need to store the > buffer as well as the narrow points... I guess not? > > Thanks, > Rasmus -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu