From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: Using a simpler link syntax in org-mode? Date: Wed, 12 Feb 2014 12:26:46 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11343f9491f4ae04f238e088 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44369) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WDdaG-0004Zz-Qi for emacs-orgmode@gnu.org; Wed, 12 Feb 2014 12:26:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WDdaB-0005JL-UP for emacs-orgmode@gnu.org; Wed, 12 Feb 2014 12:26:52 -0500 Received: from mail-pd0-x22e.google.com ([2607:f8b0:400e:c02::22e]:52307) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WDdaB-0005J3-Hf for emacs-orgmode@gnu.org; Wed, 12 Feb 2014 12:26:47 -0500 Received: by mail-pd0-f174.google.com with SMTP id z10so9323531pdj.33 for ; Wed, 12 Feb 2014 09:26:46 -0800 (PST) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Aviv Cc: "emacs-orgmode@gnu.org" --001a11343f9491f4ae04f238e088 Content-Type: text/plain; charset=ISO-8859-1 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 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 > > > --001a11343f9491f4ae04f238e088 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
you can kind of achieve this with yasnippet. I made this b= elow:

# -*- 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 yo= u get your link. that may be better than typing everything out, if you reme= mber 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 d= oes not behave as you want.

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

(defun sl (link)
=A0 (interactive "sLink: &= quot;)
=A0 (insert (format "[[%s.org][= %s]]" link link)))

Now you type M-x sl
then enter the link in the minibuffe= r.

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



John

-----------------------------------
John Kitchin
As= sociate Professor
Doherty Hall A207F
Department of Chemical Engineeri= ng
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
http://kitchingr= oup.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 ma= ke 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
h= ttp://stackoverflow.com/q/21085720/1137803
(I waited several weeks with no answer; I hope that is appropriate)

Regards
- Aviv



--001a11343f9491f4ae04f238e088--