emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Using a simpler link syntax in org-mode?


From: John Kitchin
Subject: Re: [O] Using a simpler link syntax in org-mode?
Date: Wed, 12 Feb 2014 12:26:46 -0500

you can kind of achieve this with yasnippet. I made this below:

# -*- mode: snippet -*-
# name: simple-link
# key: sl
# --
[[$1.org][$1]

to use it, you type sl, press tab, type in the file, and then tab ], and you get your link. that may be better than typing everything out, if you remember sl for simple link, and press tab. I tried to not have the trailing ] typed in, but as soon as you type a character org shrinks the link and it does not behave as you want.

As an alternative, consider writing a short emacs function that inserts what you want.

(defun sl (link)
  (interactive "sLink: ")
  (insert (format "[[%s.org][%s]]" link link)))

Now you type M-x sl
then enter the link in the minibuffer.

What you want probably isn't feasible. How do you differentiate [[foo bar]] from a file and a heading in the current file? Another customization variable ;)



John

-----------------------------------
John Kitchin
Associate Professor
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
http://kitchingroup.cheme.cmu.edu



On Thu, Feb 6, 2014 at 9:28 PM, Aviv <address@hidden> wrote:
I'd like to have links with the syntax [[foo bar]] go to files with the name
foo bar.org. This would make using org-mode much more like using a personal
local wiki.

Is this possible without breaking existing link functionality? I'd also
ideally still be able to export to html, etc. with standard org-mode tools.

The best I've been able to do is something like:
(setq org-link-abbrev-alist '(("o" . "file:%s.org")))

This lets me use the syntax [[o:foo bar]], but that is more verbose, and
looks distractingly ugly inline.
For example: The quick brown o:fox jumps over the o:lazy_dog.
And `[[o:foo bar][foo bar]]` is even
more verbose to type and edit (though it reads fine in org modde).

FYI, I was asked to crosspost this from stackoverflow at
http://stackoverflow.com/q/21085720/1137803
(I waited several weeks with no answer; I hope that is appropriate)

Regards
- Aviv




reply via email to

[Prev in Thread] Current Thread [Next in Thread]