* Re: abbreviations of link-type "file"
2016-08-21 9:32 ` Nicolas Goaziou
@ 2016-08-21 22:38 ` Martin Carlé
2016-09-10 9:41 ` Nicolas Goaziou
0 siblings, 1 reply; 4+ messages in thread
From: Martin Carlé @ 2016-08-21 22:38 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: emacs-orgmode@gnu.org, John Kitchin
[-- 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 --]
^ permalink raw reply [flat|nested] 4+ messages in thread