From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: [PATCH] org-id-goto doesn't work if buffer is narrowed. Date: Sun, 25 Oct 2015 07:11:06 -0400 Message-ID: References: <874mhh1u7s.fsf@gmx.us> <87oafpz65e.fsf@gmx.us> <87d1w4zb5b.fsf@gmx.us> <87oafof8km.fsf@gmx.us> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49430) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZqJCl-0004P9-O0 for emacs-orgmode@gnu.org; Sun, 25 Oct 2015 07:11:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZqJCi-00083K-Ef for emacs-orgmode@gnu.org; Sun, 25 Oct 2015 07:11:15 -0400 Received: from mail-qg0-x22f.google.com ([2607:f8b0:400d:c04::22f]:36621) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZqJCi-000835-AK for emacs-orgmode@gnu.org; Sun, 25 Oct 2015 07:11:12 -0400 Received: by qgad10 with SMTP id d10so99493482qga.3 for ; Sun, 25 Oct 2015 04:11:10 -0700 (PDT) In-reply-to: <87oafof8km.fsf@gmx.us> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Rasmus Cc: emacs-orgmode@gnu.org, jkitchin@andrew.cmu.edu 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 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