emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Using a simpler link syntax in org-mode?
@ 2014-02-07  2:28 Aviv
  2014-02-12 17:26 ` John Kitchin
  0 siblings, 1 reply; 2+ messages in thread
From: Aviv @ 2014-02-07  2:28 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Using a simpler link syntax in org-mode?
  2014-02-07  2:28 Using a simpler link syntax in org-mode? Aviv
@ 2014-02-12 17:26 ` John Kitchin
  0 siblings, 0 replies; 2+ messages in thread
From: John Kitchin @ 2014-02-12 17:26 UTC (permalink / raw)
  To: Aviv; +Cc: emacs-orgmode@gnu.org

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

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 <orgmodegmaneFeb14.z.m1@dfgh.net>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
>
>
>

[-- Attachment #2: Type: text/html, Size: 3089 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-02-12 17:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-07  2:28 Using a simpler link syntax in org-mode? Aviv
2014-02-12 17:26 ` John Kitchin

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).