From: Kyle Meyer <kyle@kyleam.com>
To: Giacomo M <jackjackk@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Parent path for links
Date: Thu, 19 Feb 2015 00:17:04 -0500 [thread overview]
Message-ID: <87a90a4h0v.fsf@kmlap.domain.org> (raw)
In-Reply-To: CA+GKSr7SXcO_vnx6w-Vb5HrjGJhpwm9Kt0os8A_eRvLNwBS_6Q@mail.gmail.com
Giacomo M <jackjackk@gmail.com> wrote:
[...]
> What happens is that in project.org I end up specifying a lot of links all
> starting with ~/working/project/. This is useful as I can directly jump
> from "organization" to "action", or just to switch in a quicker way across
> project files.
[...]
> Would you have any suggestions for reducing the redundancy of a common
> parent path for links in a subtree/file?
Is the reason this redundancy bothers you visual? (I'm guessing it is
because it shouldn't be any extra work to insert the link if you're
using org-store-link.) In that case, you could make a command that adds
a link description with the file base name (assuming these file links
tend to not have descriptions).
Another possibility (which I haven't really thought through or tested)
is to use a custom link type that grabs the project directory from
somewhere (below I use a property value) and then uses that as the
default directory.
#+begin_src elisp
(org-add-link-type "project" 'km/org-project-open)
(defun km/org-project-open (path)
"Open PATH with `default-directory' set to PROJECT property."
(let ((project (org-entry-get nil "PROJECT" 'inherit)))
(if project
(let ((default-directory project))
(org-open-link-from-string (concat "file:" path)))
(user-error "Project property not defined"))))
#+end_src
(Notice that km/org-project-open is actually making an ordinary file
link to support things like "::*heading"... definitely a hack).
You could specify the property value at the top of the project file
#+PROPERTY: project /path/to/project
or as a project property on a heading
* heading
:PROPERTIES:
:PROJECT: /path/to/project
:END:
This would then allow for links to a file name relative to the project
directory, like
project:file-name.org
and
project:file-name.org::*Heading
--
Kyle
next prev parent reply other threads:[~2015-02-19 5:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-19 1:55 Parent path for links Giacomo M
2015-02-19 5:17 ` Kyle Meyer [this message]
2015-02-19 23:49 ` Christian Wittern
2015-02-20 0:07 ` Kyle Meyer
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=87a90a4h0v.fsf@kmlap.domain.org \
--to=kyle@kyleam.com \
--cc=emacs-orgmode@gnu.org \
--cc=jackjackk@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).