From mboxrd@z Thu Jan 1 00:00:00 1970 From: 42 147 Subject: Re: saving state of buffer Date: Thu, 21 Mar 2013 06:16:59 -0400 Message-ID: References: <878v5inpfd.fsf@bzg.ath.cx> <514AD187.6080903@gmail.com> <514AD606.30505@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=f46d0407142d9eaabc04d86ca312 Return-path: Received: from eggs.gnu.org ([208.118.235.92]:49721) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIcYU-0004PW-RS for emacs-orgmode@gnu.org; Thu, 21 Mar 2013 06:17:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UIcYP-0004pR-IW for emacs-orgmode@gnu.org; Thu, 21 Mar 2013 06:17:06 -0400 Received: from mail-la0-x22e.google.com ([2a00:1450:4010:c03::22e]:61192) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIcYP-0004p8-7b for emacs-orgmode@gnu.org; Thu, 21 Mar 2013 06:17:01 -0400 Received: by mail-la0-f46.google.com with SMTP id fq12so4826959lab.33 for ; Thu, 21 Mar 2013 03:17:00 -0700 (PDT) In-Reply-To: <514AD606.30505@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, Carsten Dominik Cc: Org Mode --f46d0407142d9eaabc04d86ca312 Content-Type: text/plain; charset=ISO-8859-1 > 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. QUESTION How do I restore the state of my buffer where I left it? ANSWER When Emacs first visits an Org file, the global state is set to OVERVIEW, i.e., only the top level headlines are visible. If you wish Emacs to restore the position of point where you left it in your previous session, add the following code to your .emacs: (require 'saveplace) (setq-default save-place t) 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: (setq org-show-siblings '((default) (isearch t) (bookmark-jump . t))) 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. 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. 2013/3/21 Rainer M Krug > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On 21/03/13 10:28, Carsten Dominik wrote: > > > > On 21 mrt. 2013, at 10:23, Rainer M Krug wrote: > > > > 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). > > > > 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 guess it would make a good FAQ entry. > > Haven't thought about these - they would even be better then worg. > > > > >> I also think that maybe the current default is not good, show-siblings > should probably > >> default to t for bookmark jump. > > Would make much sense - I assume that would then open the location when > doing a search - replace. > > Cheers, > > Rainer > > > > >> - Carsten > > > > > >>>> But I should also thank you for finding the words I struggled to find > ("folded state"). > > > > And we have to thank you for this useful question! > > > > Cheers, > > > > Rainer > > > >>>> > >>>> I feel honored that royalty stepped into the discussion. > >>>> > >>>> Herzlichen Dank, > >>>> > >>>> 42 > >>>> > >>>> > >>>> 2013/3/21 Carsten Dominik carsten.dominik@gmail.com>> > >>>> > >>>> > >>>> On 20.3.2013, at 19:28, 42 147 aeuster@gmail.com>> wrote: > >>>> > >>>>>> (require 'saveplace) (setq-default save-place t) > >>>>> > >>>>>> works for me. It just opens the place where I had the point, > nothing more, but that's > >>>>>> what I need most. > >>>>> > >>>>> 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. > >>>>> > >>>> > >>>> 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. 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. > >>>> > >>>> You can do this with customize, or just like this: > >>>> > >>>> (setq org-show-siblings '((default) (isearch t) (bookmark-jump . t))) > >>>> > >>>> There are companion variables, they are all in the customization group > >>>> org-reveal-context. > >>>> > >>>> - Carsten > >>>> > >>>> > > > > > > > > - -- > Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation > Biology, UCT), Dipl. Phys. > (Germany) > > Centre of Excellence for Invasion Biology > Stellenbosch University > South Africa > > Tel : +33 - (0)9 53 10 27 44 > Cell: +33 - (0)6 85 62 59 98 > Fax : +33 - (0)9 58 10 27 44 > > Fax (D): +49 - (0)3 21 21 25 22 44 > > email: Rainer@krugs.de > > Skype: RMkrug > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.11 (GNU/Linux) > Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ > > iQEcBAEBAgAGBQJRStYGAAoJENvXNx4PUvmCOYQH/iun7nUB4Wr4KJXwGuCJizgW > 7h7565oAlV0ka6JONGG03xnxh0PvZCrj3Ns7xE6kitLeVZ0oIEa8Wp1I4eMGX1PI > qXGnTuJ/nwVtpdn9geswCM11Rfz3KdlBWUz6zYFUXrD1GVaEyXBJPj2j0H1N27RD > 6pK0IS3T7pnuycIpmqzEU5aWAkgK01sB3mIs5JYvnMGfoV0ZXLGcVplqXO0Hc3XR > P1Ea/uzzWSSKgJWGSlB9ELVC1sZg8xPqjM/vWPG2U+/fp3VfJ2aeJJc9v87mq3li > YI8Z4fYKO00oKv+quEOGWyDr0bO3w9PjJGAWmlw0cFu9UzxU4pRAmHR+XyTTCOc= > =y9LZ > -----END PGP SIGNATURE----- > --f46d0407142d9eaabc04d86ca312 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
> Good - May I suggest, that you write a step - by step howto and m=
ail 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.

QUESTION
How do I restore the state of my buffer where I left it?

ANSWER

When Emacs first visits an Org file, the global state is set to
OVER= VIEW, i.e., only the top level headlines are visible.

If you wish Em= acs to restore the position of point where you left it in
your previous = session, add the following code to your .emacs:

(require 'saveplace)
(setq-default save-place t)

If you w= ish Org-mode to restore the folded state of the buffer (not just
the pos= ition of point), you can either use customize, or add the following
to .emacs:

(setq org-show-siblings '((default) (isearch t) (book= mark-jump . t)))

If you use customize, take look at the variable org= -show-siblings and set a
special context for bookmark-jump. This will wo= rk for both saveplace and
bookmarks.

Org-mode has very precise control for situations when a j= ump into invisible
text happens, for example by isearch or by bookmark-j= ump or saveplace.
There are companion variables, and they are all in the= customization group
org-reveal-context.

2013/3/21 Rainer M Kr= ug <r.m.krug@gmail.com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 21/03/13 10:28, Carsten Dominik wrote:
>
> On 21 mrt. 2013, at 10:23, Rainer M Krug <r.m.krug@gmail.com> wrote:
>
> On 21/03/13 10:05, 42 147 wrote:
>>>> Thanks David, but what Carsten suggested completely resolv= ed my problem (it applies not
>>>> just to bookmarks; it fully preserves my buffer's fold= ed state after adding Christoph's
>>>> code to my .emacs).
>
> Good - May I suggest, that you write a step - by step howto and mail i= t here or even add it to
> worg? This would be a useful addition.
>
>> I guess it would make a good FAQ entry.

Haven't thought about these - they would even be better then worg= .

>
>> I also think that maybe the current default is not good, show-sibl= ings should probably
>> default to t for bookmark jump.

Would make much sense - I assume that would then open the location wh= en doing a search - replace.

Cheers,

Rainer

>
>> - Carsten
>
>
>>>> But I should also thank you for finding the words I strugg= led to find ("folded state").
>
> And we have to thank you for this useful question!
>
> Cheers,
>
> Rainer
>
>>>>
>>>> I feel honored that royalty stepped into the discussion. >>>>
>>>> Herzlichen Dank,
>>>>
>>>> 42
>>>>
>>>>
>>>> 2013/3/21 Carsten Dominik <carsten.dominik@gmail.com <mailto:carsten.dominik@gmail.com>>
>>>>
>>>>
>>>> On 20.3.2013, at 19:28, 42 147 <aeuster@gmail.com <mailto:aeuster@gmail.com>> wrote:
>>>>
>>>>>> (require 'saveplace) (setq-default save-place = t)
>>>>>
>>>>>> works for me. It just opens the place where I had = the point, nothing more, but that's
>>>>>> what I need most.
>>>>>
>>>>> This is more convenient than Emacs bookmarks, but stil= l breaks org-mode to a certain
>>>>> extent: all non top-level headlines below point are hi= dden. At least for me.
>>>>>
>>>>
>>>> Org-mode has very precise control for situations when a ju= mp into invisible text happens,
>>>> for example by isearch or by bookmark-jump or saveplace. = =A0Take a look at the variable
>>>> org-show-siblings and set a special context for bookmark-j= ump, that should do it. =A0This
>>>> will work for both saveplace and bookmarks.
>>>>
>>>> You can do this with customize, or just like this:
>>>>
>>>> (setq org-show-siblings '((default) (isearch t) (bookm= ark-jump . t)))
>>>>
>>>> There are companion variables, they are all in the customi= zation group
>>>> org-reveal-context.
>>>>
>>>> - Carsten
>>>>
>>>>
>
>
>

- --
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,= UCT), Dipl. Phys.
(Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel : =A0 =A0 =A0 +33 - (0)9 53 10 27 44
Cell: =A0 =A0 =A0 +33 - (0)6 85 62 59 98
Fax : =A0 =A0 =A0 +33 - (0)9 58 10 27 44

Fax (D): =A0 =A0+49 - (0)3 21 21 25 22 44

email: =A0 =A0 =A0Rainer@krugs.de
Skype: =A0 =A0 =A0RMkrug
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJRStYGAAoJENvXNx4PUvmCOYQH/iun7nUB4Wr4KJXwGuCJizg= W
7h7565oAlV0ka6JONGG03xnxh0PvZCrj3Ns7xE6kitLeVZ0oIEa8Wp1I4eMGX1PI
qXGnTuJ/nwVtpdn9geswCM11Rfz3KdlBWUz6zYFUXrD1GVaEyXBJPj2j0H1N27RD
6pK0IS3T7pnuycIpmqzEU5aWAkgK01sB3mIs5JYvnMGfoV0ZXLGcVplqXO0Hc3XR
P1Ea/uzzWSSKgJWGSlB9ELVC1sZg8xPqjM/vWPG2U+/fp3VfJ2aeJJc9v87mq3li
YI8Z4fYKO00oKv+quEOGWyDr0bO3w9PjJGAWmlw0cFu9UzxU4pRAmHR+XyTTCOc=3D
=3Dy9LZ
-----END PGP SIGNATURE-----

--f46d0407142d9eaabc04d86ca312--