From mboxrd@z Thu Jan 1 00:00:00 1970 From: Le Wang Subject: Re: `session-jump-to-last-change' and org-mode Date: Thu, 17 Mar 2011 14:20:23 +0800 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=20cf307f341416a67c049ea7a813 Return-path: Received: from [140.186.70.92] (port=59684 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q06ZN-0003iz-R8 for emacs-orgmode@gnu.org; Thu, 17 Mar 2011 02:20:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q06ZM-00013O-HC for emacs-orgmode@gnu.org; Thu, 17 Mar 2011 02:20:25 -0400 Received: from mail-vw0-f41.google.com ([209.85.212.41]:55124) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q06ZM-00013J-CQ for emacs-orgmode@gnu.org; Thu, 17 Mar 2011 02:20:24 -0400 Received: by vws4 with SMTP id 4so2917737vws.0 for ; Wed, 16 Mar 2011 23:20:23 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Samuel Wales Cc: Orgmode Mailing List --20cf307f341416a67c049ea7a813 Content-Type: text/plain; charset=ISO-8859-1 On Thu, Mar 17, 2011 at 12:27 AM, Le Wang wrote: > Yes, I didn't know about `org-reveal'. That could work. But how do I > figure out if I need to expand the heading? The last change could be to a > folded heading itself, in which case, it shouldn't be expanded. > > Is there a org-goto-char type of function that always goes to that location > in the buffer, expanding sections along the way? I've solved it by advising goto-char like so: (defadvice goto-char (around org-expand activate compile) (if (eq major-mode 'org-mode) (progn ad-do-it (org-reveal) ad-do-it) ad-do-it)) Can anyone see any problems with advising such a fundamental function? -- Le --20cf307f341416a67c049ea7a813 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On Thu, Mar 17, 2011 at 12:27 AM, Le Wang <l26wang@gmail.com&= gt; wrote:
Yes, I didn't know about `org-reveal'.=A0 That could work.=A0 But h= ow do I figure out if I need to expand the heading?=A0 The last change coul= d be to a folded heading itself, in which case, it shouldn't be expande= d.

Is there a org-goto-char type of function that always goes to that loca= tion in the buffer, expanding sections along the way?

= I've solved it by advising goto-char like so:

(defadvice goto-char (around org-expand activate compile)
=A0 (if (eq ma= jor-mode 'org-mode)
=A0=A0=A0=A0=A0 (progn
=A0=A0=A0=A0=A0=A0=A0 = ad-do-it
=A0=A0=A0=A0=A0=A0=A0 (org-reveal)
=A0=A0=A0=A0=A0=A0=A0 ad-= do-it)
=A0=A0=A0 ad-do-it))
=A0
Can anyone see any p= roblems with advising such a fundamental function?

--
Le
--20cf307f341416a67c049ea7a813--