emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Michael Brand <michael.ch.brand@gmail.com>
To: Org Mode <emacs-orgmode@gnu.org>
Subject: [PATCH] Link to Org file: regard startup view state
Date: Wed, 25 Jan 2012 18:28:26 +0100	[thread overview]
Message-ID: <CALn3zoj3t=xWvoQo4CN5+dFYxq4oPPH51GQhwC9qOdz2J-nZxQ@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 935 bytes --]

Hi all

I would like to ask for a review of the attached patch that resolves
an issue with org-open-at-point.

When opening a link to another Org file not yet opened (first close it
if opened) before this patch:
1) When point is on the line with the link and the line is not a
   heading then the target file is opened with the target file startup
   view state, e. g. the default OVERVIEW.
2) When point is on the heading of the entry of which the link is part
   of then the target file is opened with "SHOW ALL". But it is
   expected to regard the target file startup view state like case 1).
Note: Only in case 2) `org-open-at-point' uses
`org-offer-links-in-entry' and from there `org-open-link-from-string'.

example current buffer with link:
#+BEGIN_SRC org
  ,* section
  ,  [[file:myfile.org::*mytarget]]
#+END_SRC

example target file myfile.org:
#+BEGIN_SRC org
  ,* mytarget
  ,  text
  ,*** subsection
#+END_SRC

Michael

[-- Attachment #2: 0001-Link-to-Org-file-regard-startup-view-state.patch.txt --]
[-- Type: text/plain, Size: 1645 bytes --]

From 853ec865f0d0970eac9add6eb0bb626b37823835 Mon Sep 17 00:00:00 2001
From: Michael Brand <michael.ch.brand@gmail.com>
Date: Wed, 25 Jan 2012 18:24:58 +0100
Subject: [PATCH] Link to Org file: regard startup view state

* lisp/org.el (org-open-link-from-string): Regard `reference-buffer'
when setting `org-inhibit-startup'.

When opening a link to another Org file not yet opened (first close it
if opened) before this patch:
1) When point is on the line with the link and the line is not a
   heading then the target file is opened with the target file startup
   view state, e. g. the default OVERVIEW.
2) When point is on the heading of the entry of which the link is part
   of then the target file is opened with "SHOW ALL". But it is
   expected to regard the target file startup view state like case 1).
Note: Only in case 2) `org-open-at-point' uses
`org-offer-links-in-entry' and from there `org-open-link-from-string'.

example current buffer with link:
#+BEGIN_SRC org
  ,* section
  ,  [[file:myfile.org::*mytarget]]
#+END_SRC

example target file myfile.org:
#+BEGIN_SRC org
  ,* mytarget
  ,  text
  ,*** subsection
#+END_SRC
---
 lisp/org.el |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 1fa7259..1ffd1b3 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -9443,7 +9443,7 @@ Org-mode syntax."
   (interactive "sLink: \nP")
   (let ((reference-buffer (or reference-buffer (current-buffer))))
     (with-temp-buffer
-      (let ((org-inhibit-startup t))
+      (let ((org-inhibit-startup (not reference-buffer)))
 	(org-mode)
 	(insert s)
 	(goto-char (point-min))
-- 
1.7.1


             reply	other threads:[~2012-01-25 17:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-25 17:28 Michael Brand [this message]
2012-01-28 14:49 ` [PATCH] Link to Org file: regard startup view state 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='CALn3zoj3t=xWvoQo4CN5+dFYxq4oPPH51GQhwC9qOdz2J-nZxQ@mail.gmail.com' \
    --to=michael.ch.brand@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).