Re: [O] displaying thumbnails in heading or subheadings

2017-04-25 Thread numbch...@gmail.com
Does this `insert-image` function insert image with overlay which is not
literately inserting?

[stardiviner] GPG key ID: 47C32433
IRC(freeenode): stardiviner Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/

On Tue, Apr 25, 2017 at 10:56 PM, cédric ody 
wrote:

> Hi everyone,
>
> I'd like to be able to display thumbnails of images in headlines.
>
> Assume I define a ICON property with the path to a thumbnail. For instance
>
> * Emacs heading
>   :PROPERTIES:
>   :ICON:  /tmp/emacs.png
>   :END:
>
> I have been able to get some results with the following code
>
> #+BEGIN_SRC elisp
> (defun my-function ()
>   "comment"
>   (interactive)
>   (save-excursion
> (org-with-limited-levels (org-map-tree 'my_subfunction)))
>   (org-fix-position-after-promote))
> (defun my_subfunction ()
> "comment"
>   (org-with-wide-buffer
>(org-back-to-heading t)
>(let ((e (org-element-at-point)))
>(looking-at org-outline-regexp) (goto-char (1- (match-end 0)))
> (insert-image (create-image (org-element-property :ICON e))
> #+END_SRC
>
> There are two issues I'd like to solve:
>
> - when the document is saved and re-opened, a blank space has
> substituted the thumbnail.
> - is it possible to control the appearance or not of thel thumbnails
> of all headlinesin one command?
>
> Thanks,
>
> cedric
>
>


[O] displaying thumbnails in heading or subheadings

2017-04-25 Thread cédric ody
Hi everyone,

I'd like to be able to display thumbnails of images in headlines.

Assume I define a ICON property with the path to a thumbnail. For instance

* Emacs heading
  :PROPERTIES:
  :ICON:  /tmp/emacs.png
  :END:

I have been able to get some results with the following code

#+BEGIN_SRC elisp
(defun my-function ()
  "comment"
  (interactive)
  (save-excursion
(org-with-limited-levels (org-map-tree 'my_subfunction)))
  (org-fix-position-after-promote))
(defun my_subfunction ()
"comment"
  (org-with-wide-buffer
   (org-back-to-heading t)
   (let ((e (org-element-at-point)))
   (looking-at org-outline-regexp) (goto-char (1- (match-end 0)))
(insert-image (create-image (org-element-property :ICON e))
#+END_SRC

There are two issues I'd like to solve:

- when the document is saved and re-opened, a blank space has
substituted the thumbnail.
- is it possible to control the appearance or not of thel thumbnails
of all headlinesin one command?

Thanks,

cedric