Re: [O] Link to named block

2014-10-20 Thread Bastien
Hi Greg,

Daimrod daim...@gmail.com writes:

 I've made a small function to link to a named block in org files.

 #+BEGIN_SRC emacs-lisp
 (defun dmd--org-link-to-named-block ()
   Create an org-link to the named block at point.

 Blocks are named with #+NAME.
   (when (eq major-mode 'org-mode)
 (let* ((el (org-element-at-point))
(name (org-element-property :name el)))
   (when name
 (org-store-link-props
  :link name)
 #+END_SRC

 Do you think it should be added to org? I find it useful to add a link
 to a figure when I'm exporting to latex.

I'm not sure how to use the function above -- how do you set the link
itself, not just its properties?

 I tried to add it to `org-store-link` but it's a big function and I
 wonder why it's not splitted in smaller functions. (e.g.
 org-help-store-link, org-w3-store-link, org-image-store-link, ...).
 If you agree, I could split it.

Yes, please go ahead.

Thanks,

-- 
 Bastien



Re: [O] Link to named block

2014-10-20 Thread Daimrod
Bastien b...@gnu.org writes:

 Hi Greg,

Hi Bastien,

 Daimrod daim...@gmail.com writes:

 I've made a small function to link to a named block in org files.

 #+BEGIN_SRC emacs-lisp
 (defun dmd--org-link-to-named-block ()
   Create an org-link to the named block at point.

 Blocks are named with #+NAME.
   (when (eq major-mode 'org-mode)
 (let* ((el (org-element-at-point))
(name (org-element-property :name el)))
   (when name
 (org-store-link-props
  :link name)
 #+END_SRC

 Do you think it should be added to org? I find it useful to add a link
 to a figure when I'm exporting to latex.

 I'm not sure how to use the function above -- how do you set the link
 itself, not just its properties?

I don't. The link name is enough because named block usually have nice
name. For example, given the following named block:

#+NAME: fig:my-fig
[[file:my-fig.png]]

Then link will be [[fig:my-fig]].

 I tried to add it to `org-store-link` but it's a big function and I
 wonder why it's not splitted in smaller functions. (e.g.
 org-help-store-link, org-w3-store-link, org-image-store-link, ...).
 If you agree, I could split it.

 Yes, please go ahead.

noted.

-- 
Daimrod/Greg


signature.asc
Description: PGP signature


[O] Link to named block

2014-10-19 Thread Daimrod
Hi,

I've made a small function to link to a named block in org files.
#+BEGIN_SRC emacs-lisp
(defun dmd--org-link-to-named-block ()
  Create an org-link to the named block at point.

Blocks are named with #+NAME.
  (when (eq major-mode 'org-mode)
(let* ((el (org-element-at-point))
   (name (org-element-property :name el)))
  (when name
(org-store-link-props
 :link name)
#+END_SRC

Do you think it should be added to org? I find it useful to add a link
to a figure when I'm exporting to latex.

I tried to add it to `org-store-link` but it's a big function and I
wonder why it's not splitted in smaller functions. (e.g.
org-help-store-link, org-w3-store-link, org-image-store-link, ...).
If you agree, I could split it.

WDYT?

Best,

--
Daimrod/Greg


signature.asc
Description: PGP signature