emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <carsten.dominik@gmail.com>
To: Rainer@krugs.de
Cc: 42 147 <aeuster@gmail.com>, Org Mode <emacs-orgmode@gnu.org>
Subject: Re: saving state of buffer
Date: Thu, 21 Mar 2013 14:50:23 +0100	[thread overview]
Message-ID: <3B3EBAE4-EF9B-48B3-8379-86F5BFF41C53@gmail.com> (raw)
In-Reply-To: <514AF615.7010000@gmail.com>

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)
 
-(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 <r.m.krug@gmail.com> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 21/03/13 12:38, Carsten Dominik wrote:
>> 
>> On 21 mrt. 2013, at 12:25, Rainer M Krug <r.m.krug@gmail.com> wrote:
>> 
>> On 21/03/13 12:02, Carsten Dominik wrote:
>>>>> This is nice, does anyone of you have write permissions on Work to add this?
>> 
>> I should have, but I have never done it.
>> 
>>> Well, you can try, or else I'll do it.
> 
> 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.
> 
> I just relised, I was only registered to repo.or.cz - but I will register as described at
> 
> http://orgmode.org/worg/worg-git.html
> 
> If it should be up earlier, please feel free to do it.
> 
> Cheers,
> 
> Rainer
> 
> 
>> 
>>> - Carsten
>> 
>> 
>> Rainer
>> 
>>>>> 
>>>>> - Carsten
>>>>> 
>>>>> On 21 mrt. 2013, at 11:16, 42 147 <aeuster@gmail.com <mailto:aeuster@gmail.com>> wrote:
>>>>> 
>>>>>>> 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 <r.m.krug@gmail.com <mailto:r.m.krug@gmail.com>>
>>>>>> 
>>>>> On 21/03/13 10:28, Carsten Dominik wrote:
>>>>> 
>>>>>> On 21 mrt. 2013, at 10:23, Rainer M Krug <r.m.krug@gmail.com
>>>>>> <mailto:r.m.krug@gmail.com>> 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 
>>>>>>>>> <mailto:carsten.dominik@gmail.com>
>>>>> <mailto: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>
>>>>> <mailto: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 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/
> 
> iQEcBAEBAgAGBQJRSvYUAAoJENvXNx4PUvmCDcIIANZf6cBZOJ1ydJap3hiHmXab
> EeURoiwNxpyh8/vtuxn1VPKBQEPFPw52ybEKHGCby5Tsm0txtj4ySo9aZj1sYfPf
> UmUekIM1u5iqhBBy8xaMnUda4VfrN1o7kyJGVKMDlnF27ED1+Oa99rbugaLhDvB9
> D+witVVPIOOXisgssGJiIpTSrOToUczVDjgcVsvKRCVXqXtwcwy/3r/gL2vmUb6g
> GIhHpzQLKK/5qRCdMiSMmZ3sAhDDqndP+VCXF5g6keX6qQLj60OQ7yu1gW3Aw2fx
> eQSjkXKZ0+8sZRRzhTT0WasBAzVYZqEMb9UtI0Y0stBZ+J2rl8sPbJ69Sq8ZVrQ=
> =dJLC
> -----END PGP SIGNATURE-----

  reply	other threads:[~2013-03-21 13:50 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-20 11:19 saving state of buffer 42 147
2013-03-20 13:49 ` Bastien
2013-03-20 17:00   ` 42 147
2013-03-20 17:09     ` Christoph
2013-03-20 18:28     ` 42 147
2013-03-20 18:57       ` Loyall, David
2013-03-21  6:58       ` Carsten Dominik
2013-03-21  7:14         ` Marcin Borkowski
2013-03-21  9:05         ` 42 147
2013-03-21  9:23           ` Rainer M Krug
2013-03-21  9:28             ` Carsten Dominik
2013-03-21  9:42               ` Rainer M Krug
2013-03-21 10:16                 ` 42 147
2013-03-21 11:02                   ` Carsten Dominik
2013-03-21 11:25                     ` Rainer M Krug
2013-03-21 11:38                       ` Carsten Dominik
2013-03-21 11:59                         ` Rainer M Krug
2013-03-21 13:50                           ` Carsten Dominik [this message]
2013-04-06  1:03                             ` Bastien
2013-03-21 16:10                   ` Thomas S. Dye
2013-03-22 16:36                     ` 42 147
2013-03-22 21:30                       ` Thomas S. Dye
2013-03-22 22:24                         ` 42 147
2013-03-21  9:47           ` Carsten Dominik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3B3EBAE4-EF9B-48B3-8379-86F5BFF41C53@gmail.com \
    --to=carsten.dominik@gmail.com \
    --cc=Rainer@krugs.de \
    --cc=aeuster@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).