emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bastien <bastienguerry@googlemail.com>
To: User <spamfilteraccount@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Showing hidden subtree automatically if point is hidden when the buffer is opened
Date: Tue, 28 Jul 2009 04:45:55 +0800	[thread overview]
Message-ID: <878wi9agq8.fsf@bzg.ath.cx> (raw)
In-Reply-To: <loom.20090727T134154-402@post.gmane.org> (User's message of "Mon, 27 Jul 2009 14:00:07 +0000 (UTC)")

User <spamfilteraccount@gmail.com> writes:

> I use folded view by default, but I also use saveplace.el,
> because it's nice to continue from the point I left off in the
> buffer, instead of navigating there again manually.
>
> The problem is the restored point can be in an automatically
> folded section when the buffer is opened, so I added this little
> code to my org-mode hook which opens the subtree automatically if
> point is hidden:
>
>   (run-with-idle-timer 0 nil
>                        (lambda ()
>                          (when (outline-invisible-p)
>                            (save-excursion
>                              (outline-previous-visible-heading 1)
>                              (org-show-subtree)))))
>
> I haven't seen an option for this in org, so I post the code
> here if someone has a similar problem.

I added this entry on org-hacks.org (Worg):

Fix a problem with saveplace.el putting you back in a folded position: 

#+begin_src emacs-lisp
(add-hook 'org-mode-hook
          (lambda ()
	    (when (outline-invisible-p)
	      (save-excursion
		(outline-previous-visible-heading 1)
		(org-show-subtree)))))
#+end_src

Note that I removed the timer - no sure why it was useful.  Feel free to
modify this hack the way you want on Worg.

-- 
 Bastien

  reply	other threads:[~2009-07-27 22:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-27 14:00 Showing hidden subtree automatically if point is hidden when the buffer is opened User
2009-07-27 20:45 ` Bastien [this message]
2009-07-28  4:19   ` User
2009-07-28 11:59     ` Bastien
2009-07-28 18:27       ` Bastien
2009-07-28 18:46         ` User
     [not found]           ` <8035.1248807278@alphaville.usa.hp.com>
     [not found]             ` <9cf79dfd0907281208r7e43fdfbn17af4d9e521e6fc8@mail.gmail.com>
2009-07-28 19:18               ` Nick Dokos
2009-07-29  5:41           ` Bastien

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=878wi9agq8.fsf@bzg.ath.cx \
    --to=bastienguerry@googlemail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=spamfilteraccount@gmail.com \
    /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).