emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Martin Carlé" <mc@aiguphonie.com>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>,
	John Kitchin <jkitchin@andrew.cmu.edu>
Subject: Re: abbreviations of link-type "file"
Date: Mon, 22 Aug 2016 01:38:32 +0300	[thread overview]
Message-ID: <m11t1h3fyv.fsf@aiguphonie.com> (raw)
In-Reply-To: <874m6e1n8d.fsf@saiph.selenimh>


[-- Attachment #1.1: Type: text/plain, Size: 463 bytes --]

Thank your for taking up this quick posting.

While writing up the attached 'Exemple Complet Minimal', the
parsing turned out to work well.

Now only the :help-echo, not being triggered by an abbreviated link,
remains still an issue as demonstrated by the ECM below.


I shall consider your suggestion. However, I like the application-link
feature for its convenience not being forced to duplicate quite some
code in the :follow and :store functions.

Best,
mc



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: link_ECM.org --]
[-- Type: text/x-org, Size: 1749 bytes --]

Demonstrate parsing of an abbreviated link:


Define the link
#+begin_src emacs-lisp
  (org-link-set-parameters "file+my-lengthy-application-link"
                             :help-echo "help-echo not showing, if mouse is on abbreviated link!")
#+end_src

#+RESULTS:


Set some abbreviations
#+begin_src emacs-lisp
  (setq org-link-abbrev-alist
        '(
          ("_" . "file+my-lengthy-application-link:::%s")
          ("__" . "file+my-lengthy-application-link:%s")
          ))
#+end_src

#+RESULTS:
: ((_ . file+my-lengthy-application-link:::%s) (__ . file+my-lengthy-application-link:%s))



* in-buffer links


the plain link: [[file+my-lengthy-application-link:::goto_in_buffer_target]]

=check :help-echo by mouse roll-over=

the abbreviated link: [[_:goto_in_buffer_target]]



* links with a relative path

to ~./someFile.org~


the plain link: [[file+my-lengthy-application-link:./someFile.org::goto_target]]

=check :help-echo by mouse roll-over=

the abbreviated link: [[__:./someFile.org::goto_target]]



* goto_in_buffer_target
a link target


* parse the links in this buffer
#+begin_src emacs-lisp :results verbatim
  (org-element-map (org-element-parse-buffer) 'link
    (lambda (el)
      ;; (message "link: %s" (org-element-type el))
      (let* ((link (org-element-context el))
             (path (org-link-unescape (org-element-property :path link)))
             (option (org-element-property :search-option link)))
             (message "path: %s \noption: %s \n\n" path option)
             )))
#+end_src

#+RESULTS:
#+begin_example
("path:
option: goto_in_buffer_target

" "path:
option: goto_in_buffer_target

" "path: ./someFile.org
option: goto_target

" "path: ./someFile.org
option: goto_target

")
#+end_example

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.3: someFile.org --]
[-- Type: text/x-org, Size: 34 bytes --]

* goto_target
another link target

[-- Attachment #1.4: Type: text/plain, Size: 674 bytes --]



On 2016-08-21 Sun 09:32, Nicolas Goaziou wrote:

> Hello,
>
> mc <mc@aiguphonie.com> writes:
>
>> As we talk about link abbreviations, another issue might add some useful information:
>>
>> links of link-type "file" (e.g. "file+new-link"), if follow via an
>> abbreviation, is not parsed correctly:
>
> I suggest to avoid using so called "application" links, i.e.,
> type+application syntax as it may be ditched at some point. You can
> define a new link type instead, e.g., "newlink" or "applink".
>
> In any case, could you provide an ECM?
>
> Thank you.
>
> Regards,


-- 
Fetch my gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 7E3CA33F

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 805 bytes --]

  reply	other threads:[~2016-08-21 22:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-20 18:51 abbreviations of link-type "file" mc
2016-08-21  9:32 ` Nicolas Goaziou
2016-08-21 22:38   ` Martin Carlé [this message]
2016-09-10  9:41     ` Nicolas Goaziou

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=m11t1h3fyv.fsf@aiguphonie.com \
    --to=mc@aiguphonie.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=jkitchin@andrew.cmu.edu \
    --cc=mail@nicolasgoaziou.fr \
    /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).