{"action":"created","issue":{"url":"https://api.github.com/repos/jkitchin/org-ref/issues/550","repository_url":"https://api.github.com/repos/jkitchin/org-ref","labels_url":"https://api.github.com/repos/jkitchin/org-ref/issues/550/labels{/name}","comments_url":"https://api.github.com/repos/jkitchin/org-ref/issues/550/comments","events_url":"https://api.github.com/repos/jkitchin/org-ref/issues/550/events","html_url":"https://github.com/jkitchin/org-ref/issues/550","id":300201344,"number":550,"title":"Referencing images included from other files, or included by means of macros","user":{"login":"dangom","id":7881842,"avatar_url":"https://avatars3.githubusercontent.com/u/7881842?v=4","gravatar_id":"","url":"https://api.github.com/users/dangom","html_url":"https://github.com/dangom","followers_url":"https://api.github.com/users/dangom/followers","following_url":"https://api.github.com/users/dangom/following{/other_user}","gists_url":"https://api.github.com/users/dangom/gists{/gist_id}","starred_url":"https://api.github.com/users/dangom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dangom/subscriptions","organizations_url":"https://api.github.com/users/dangom/orgs","repos_url":"https://api.github.com/users/dangom/repos","events_url":"https://api.github.com/users/dangom/events{/privacy}","received_events_url":"https://api.github.com/users/dangom/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-02-26T11:26:36Z","updated_at":"2018-02-26T15:19:25Z","closed_at":null,"author_association":"NONE","body":"I'm writing an article with a somewhat large number of figures. The consequence is that my org-file looks somewhat distracting, an illustrated by the snippet below:\r\n\r\n\r\n```\r\nProin neque massa, cursus ut, gravida ut, lobortis eget, lacus ref:image.\r\nCras placerat accumsan nulla.  \r\n\r\n#+NAME: image\r\n#+CAPTION: This is a very nice looking image\r\n[[file:image.png]]\r\n\r\nCurabitur vulputate vestibulum lorem.  \r\nProin quam nisl, tincidunt et, mattis eget, convallis nec, purus, ref:another-image.  \r\n\r\n#+NAME: another-image\r\n#+CAPTION: This is also a very nice looking image\r\n[[file:another-image.png]]\r\n```\r\n\r\nTo get rid of the visual pollution of org's boilerplate I thought of using macros to insert the images, as in:\r\n\r\n```\r\n#+MACRO: img (eval \"#+NAME: $1\\n#+CAPTION:$2\\n[[file:$3]]\")\r\n```\r\n\r\n```\r\nProin neque massa, cursus ut, gravida ut, lobortis eget, lacus ref:image.\r\nCras placerat accumsan nulla.  \r\n{{{img(image, This is a very nice looking image, image.png)}}}\r\n\r\nCurabitur vulputate vestibulum lorem.  \r\nProin quam nisl, tincidunt et, mattis eget, convallis nec, purus, ref:another-image.  \r\n{{{img(another-image, This is a also a very nice looking image, another-image.png)}}}\r\n```\r\nOr alternatively, using includes:\r\n\r\n\r\n```\r\nProin neque massa, cursus ut, gravida ut, lobortis eget, lacus ref:image.\r\nCras placerat accumsan nulla.  \r\n#+INCLUDE: images.org::#image :only-contents t\r\n\r\nCurabitur vulputate vestibulum lorem.  \r\nProin quam nisl, tincidunt et, mattis eget, convallis nec, purus, ref:another-image.  \r\n#+INCLUDE: images.org::#another-image :only-contents t\r\n```\r\n\r\nUnfortunately, both of these solutions require me abandoning org-ref's \"context\" capabilities. What would be the recommended way to declutter an org-buffer without abandoning all the power of org-ref?\r\n"},"comment":{"url":"https://api.github.com/repos/jkitchin/org-ref/issues/comments/368537155","html_url":"https://github.com/jkitchin/org-ref/issues/550#issuecomment-368537155","issue_url":"https://api.github.com/repos/jkitchin/org-ref/issues/550","id":368537155,"user":{"login":"jkitchin","id":1610070,"avatar_url":"https://avatars3.githubusercontent.com/u/1610070?v=4","gravatar_id":"","url":"https://api.github.com/users/jkitchin","html_url":"https://github.com/jkitchin","followers_url":"https://api.github.com/users/jkitchin/followers","following_url":"https://api.github.com/users/jkitchin/following{/other_user}","gists_url":"https://api.github.com/users/jkitchin/gists{/gist_id}","starred_url":"https://api.github.com/users/jkitchin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkitchin/subscriptions","organizations_url":"https://api.github.com/users/jkitchin/orgs","repos_url":"https://api.github.com/users/jkitchin/repos","events_url":"https://api.github.com/users/jkitchin/events{/privacy}","received_events_url":"https://api.github.com/users/jkitchin/received_events","type":"User","site_admin":false},"created_at":"2018-02-26T15:19:25Z","updated_at":"2018-02-26T15:19:25Z","author_association":"OWNER","body":"I guess you will just be pushing the clutter around. One way might be using named results. That seems to work. The idea is to put the image text in a named src block, and put the results where you want them. strings in elisp self-evaluate, so on export you get the string where you want it, and the context labels from org-ref seem to still work.\r\n\r\n```\r\nProin neque massa, cursus ut, gravida ut, lobortis eget, lacus ref:image.\r\nCras placerat accumsan nulla.\r\n\r\n\r\n#+RESULTS: image\r\n\r\nCurabitur vulputate vestibulum lorem.\r\nProin quam nisl, tincidunt et, mattis eget, convallis nec, purus, ref:another-image.\r\n\r\n#+RESULTS: another-image\r\n\r\n\r\n* images                                                           :noexport:\r\n\r\n#+name: image\r\n#+BEGIN_SRC emacs-lisp :results value raw :eval export\r\n\"#+NAME: image\r\n,#+CAPTION: This is a very nice looking image\r\n[[file:image.png]]\"\r\n#+END_SRC\r\n\r\n\r\n#+name: another-image\r\n#+BEGIN_SRC emacs-lisp :results value raw :eval export\r\n\"#+NAME: another-image\r\n,#+CAPTION: This is also a very nice looking image\r\n[[file:another-image.png]]\"\r\n#+END_SRC\r\n```\r\n\r\nMore extreme would be to put overlays over the images to make them temporarily small, eg. only one line. Maybe something like:\r\n\r\n```\r\n(defvar *ov-decluttered* nil)\r\n\r\n(defun ov-declutter (&optional clear)\r\n  \"\"\r\n  (interactive)\r\n  (if *ov-decluttered*\r\n      (remove-from-invisibility-spec '(decluttered . t)) \r\n    (let ((file-links (org-element-map (org-element-parse-buffer) 'link\r\n\t\t\t(lambda (link)\r\n\t\t\t  (when (string= \"file\" (org-element-property :type link))\r\n\t\t\t    link))))\r\n\t  parent\r\n\t  beg end ov)\r\n      (loop for fl in file-links do\r\n\t    (when (setq parent (org-element-property :parent fl))\r\n\t      (setq end (org-element-property :end fl)\r\n\t\t    beg (org-element-property :begin parent)\r\n\t\t    ov (make-overlay beg end))\r\n\t      (overlay-put ov 'invisible 'decluttered))) \r\n      (add-to-invisibility-spec '(decluttered . t))))\r\n  (setq *ov-decluttered* (not *ov-decluttered*)))\r\n```\r\n\r\n"}}
{"actor":{"display_login":"jkitchin"}}