From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: saving state of buffer Date: Thu, 21 Mar 2013 14:50:23 +0100 Message-ID: <3B3EBAE4-EF9B-48B3-8379-86F5BFF41C53@gmail.com> References: <878v5inpfd.fsf@bzg.ath.cx> <514AD187.6080903@gmail.com> <514AD606.30505@gmail.com> <514AEE46.5010502@gmail.com> <294AC636-BAF5-4A92-A806-8AF399924492@gmail.com> <514AF615.7010000@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 6.3 \(1503\)) Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:54491) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIft2-000446-9P for emacs-orgmode@gnu.org; Thu, 21 Mar 2013 09:50:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UIfsw-0001oh-II for emacs-orgmode@gnu.org; Thu, 21 Mar 2013 09:50:32 -0400 Received: from ezel.ic.uva.nl ([146.50.108.158]:39188) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIfsw-0001oN-7Z for emacs-orgmode@gnu.org; Thu, 21 Mar 2013 09:50:26 -0400 In-Reply-To: <514AF615.7010000@gmail.com> 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: Rainer@krugs.de Cc: 42 147 , Org Mode Here is a patch that would change the default values for bookmark-jump = and saveplace. Bastien, what do you think? - Carsten diff --git a/lisp/org.el b/lisp/org.el index bf74afd..1d48338 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -916,7 +916,7 @@ contexts. See `org-show-hierarchy-above' for valid = contexts." :group 'org-reveal-location :type org-context-choice) =20 -(defcustom org-show-siblings '((default . nil) (isearch t)) +(defcustom org-show-siblings '((default . nil) (isearch t) = (bookmark-jump t)) "Non-nil means show all sibling heading when revealing a location. Org-mode often shows locations in an org-mode file which might have been invisible before. When this is set, the sibling of the current = entry On 21 mrt. 2013, at 12:59, Rainer M Krug wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 >=20 > On 21/03/13 12:38, Carsten Dominik wrote: >>=20 >> On 21 mrt. 2013, at 12:25, Rainer M Krug wrote: >>=20 >> On 21/03/13 12:02, Carsten Dominik wrote: >>>>> This is nice, does anyone of you have write permissions on Work to = add this? >>=20 >> I should have, but I have never done it. >>=20 >>> Well, you can try, or else I'll do it. >=20 > I could, and I would (I was looking for an excuse for a long time), = but I have no time before > middle next week. I can put it into my TODO items for then. >=20 > I just relised, I was only registered to repo.or.cz - but I will = register as described at >=20 > http://orgmode.org/worg/worg-git.html >=20 > If it should be up earlier, please feel free to do it. >=20 > Cheers, >=20 > Rainer >=20 >=20 >>=20 >>> - Carsten >>=20 >>=20 >> Rainer >>=20 >>>>>=20 >>>>> - Carsten >>>>>=20 >>>>> On 21 mrt. 2013, at 11:16, 42 147 > wrote: >>>>>=20 >>>>>>> Good - May I suggest, that you write a step - by step howto and = mail it here or even >>>>>>> add it to worg? This would be a useful addition. >>>>>> I adapted this thread the best I could. Feel free to do with it = what you wish. >>>>>>=20 >>>>>> QUESTION >>>>>>=20 >>>>>> How do I restore the state of my buffer where I left it? >>>>>>=20 >>>>>> ANSWER >>>>>>=20 >>>>>> When Emacs first visits an Org file, the global state is set to = OVERVIEW, i.e., only >>>>>> the top level headlines are visible. >>>>>>=20 >>>>>> If you wish Emacs to restore the position of point where you left = it in your previous=20 >>>>>> session, add the following code to your .emacs: >>>>>>=20 >>>>>> (require 'saveplace) (setq-default save-place t) >>>>>>=20 >>>>>> If you wish Org-mode to restore the folded state of the buffer = (not just the position >>>>>> of point), you can either use customize, or add the following to = .emacs: >>>>>>=20 >>>>>> (setq org-show-siblings '((default) (isearch t) (bookmark-jump . = t))) >>>>>>=20 >>>>>> If you use customize, take look at the variable org-show-siblings = and set a special >>>>>> context for bookmark-jump. This will work for both saveplace and = bookmarks. >>>>>>=20 >>>>>> Org-mode has very precise control for situations when a jump into = invisible text >>>>>> happens, for example by isearch or by bookmark-jump or saveplace. = There are companion >>>>>> variables, and they are all in the customization group = org-reveal-context. >>>>>>=20 >>>>>> 2013/3/21 Rainer M Krug > >>>>>>=20 >>>>> On 21/03/13 10:28, Carsten Dominik wrote: >>>>>=20 >>>>>> On 21 mrt. 2013, at 10:23, Rainer M Krug >>>>> > wrote: >>>>>=20 >>>>>> On 21/03/13 10:05, 42 147 wrote: >>>>>>>>> Thanks David, but what Carsten suggested completely resolved = my problem (it >>>>>>>>> applies not just to bookmarks; it fully preserves my buffer's = folded state after >>>>>>>>> adding Christoph's code to my .emacs). >>>>>=20 >>>>>> Good - May I suggest, that you write a step - by step howto and = mail it here or even >>>>>> add it to worg? This would be a useful addition. >>>>>=20 >>>>>>> I guess it would make a good FAQ entry. >>>>>=20 >>>>> Haven't thought about these - they would even be better then worg. >>>>>=20 >>>>>=20 >>>>>>> I also think that maybe the current default is not good, = show-siblings should >>>>>>> probably default to t for bookmark jump. >>>>>=20 >>>>> Would make much sense - I assume that would then open the location = when doing a search -=20 >>>>> replace. >>>>>=20 >>>>> Cheers, >>>>>=20 >>>>> Rainer >>>>>=20 >>>>>=20 >>>>>>> - Carsten >>>>>=20 >>>>>=20 >>>>>>>>> But I should also thank you for finding the words I struggled = to find ("folded=20 >>>>>>>>> state"). >>>>>=20 >>>>>> And we have to thank you for this useful question! >>>>>=20 >>>>>> Cheers, >>>>>=20 >>>>>> Rainer >>>>>=20 >>>>>>>>>=20 >>>>>>>>> I feel honored that royalty stepped into the discussion. >>>>>>>>>=20 >>>>>>>>> Herzlichen Dank, >>>>>>>>>=20 >>>>>>>>> 42 >>>>>>>>>=20 >>>>>>>>>=20 >>>>>>>>> 2013/3/21 Carsten Dominik >>>>>>>> >>>>> >> >>>>>>>>>=20 >>>>>>>>>=20 >>>>>>>>> On 20.3.2013, at 19:28, 42 147 >>>>> >> wrote: >>>>>>>>>=20 >>>>>>>>>>> (require 'saveplace) (setq-default save-place t) >>>>>>>>>>=20 >>>>>>>>>>> works for me. It just opens the place where I had the point, = nothing more, >>>>>>>>>>> but that's what I need most. >>>>>>>>>>=20 >>>>>>>>>> This is more convenient than Emacs bookmarks, but still = breaks org-mode to a >>>>>>>>>> certain extent: all non top-level headlines below point are = hidden. At least >>>>>>>>>> for me. >>>>>>>>>>=20 >>>>>>>>>=20 >>>>>>>>> Org-mode has very precise control for situations when a jump = into invisible text=20 >>>>>>>>> happens, for example by isearch or by bookmark-jump or = saveplace. Take a look at >>>>>>>>> the variable org-show-siblings and set a special context for = bookmark-jump, that >>>>>>>>> should do it. This will work for both saveplace and = bookmarks. >>>>>>>>>=20 >>>>>>>>> You can do this with customize, or just like this: >>>>>>>>>=20 >>>>>>>>> (setq org-show-siblings '((default) (isearch t) (bookmark-jump = . t))) >>>>>>>>>=20 >>>>>>>>> There are companion variables, they are all in the = customization group=20 >>>>>>>>> org-reveal-context. >>>>>>>>>=20 >>>>>>>>> - Carsten >>>>>>>>>=20 >>>>>>>>>=20 >>>>>=20 >>>>>=20 >>>>>=20 >>>>>=20 >>>>>>=20 >>>>>>=20 >>>>>=20 >>=20 >>=20 >=20 > - --=20 > Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation = Biology, UCT), Dipl. Phys. > (Germany) >=20 > Centre of Excellence for Invasion Biology > Stellenbosch University > South Africa >=20 > Tel : +33 - (0)9 53 10 27 44 > Cell: +33 - (0)6 85 62 59 98 > Fax : +33 - (0)9 58 10 27 44 >=20 > Fax (D): +49 - (0)3 21 21 25 22 44 >=20 > email: Rainer@krugs.de >=20 > Skype: RMkrug > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.11 (GNU/Linux) > Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ >=20 > iQEcBAEBAgAGBQJRSvYUAAoJENvXNx4PUvmCDcIIANZf6cBZOJ1ydJap3hiHmXab > EeURoiwNxpyh8/vtuxn1VPKBQEPFPw52ybEKHGCby5Tsm0txtj4ySo9aZj1sYfPf > UmUekIM1u5iqhBBy8xaMnUda4VfrN1o7kyJGVKMDlnF27ED1+Oa99rbugaLhDvB9 > D+witVVPIOOXisgssGJiIpTSrOToUczVDjgcVsvKRCVXqXtwcwy/3r/gL2vmUb6g > GIhHpzQLKK/5qRCdMiSMmZ3sAhDDqndP+VCXF5g6keX6qQLj60OQ7yu1gW3Aw2fx > eQSjkXKZ0+8sZRRzhTT0WasBAzVYZqEMb9UtI0Y0stBZ+J2rl8sPbJ69Sq8ZVrQ=3D > =3DdJLC > -----END PGP SIGNATURE-----