From: pinmacs <pinmacs@cas.cat>
To: emacs-orgmode@gnu.org
Subject: [FR] yank media: allow customization of absolute path a filter for type candidates
Date: Mon, 16 Sep 2024 01:56:50 -0300 [thread overview]
Message-ID: <a7d4e731-1af6-4ce9-9f4d-d49ddcf5750d@cas.cat> (raw)
Hi,
So I was using org-download, and I would like to replace it entirely
with yank-media
and what I am missisng is:
1. do a variable for selecting absolute path: to be able to have a file
link that works with absolute path; and the reason is that being
relative, this, does not combine good when you move your latex export
somewhere else (in my case, I usually move it to /tmp/, and from there I
decide when I want to save something persistently), hence it fails, and
I got tired on fixing the links, in fact, the absolute path sometimes is
smaller than the relative one
=file:/tmp/clipboard-20240916T013308.png]]= vs
=[[file:../../../tmp/clipboard-20240916T011913.png]]=
2. do a variable that allow a list that would filter and reduce the type
candidates of yank-media. In org-download, everything was png so I was
not having the "Several types available, choose one" with 7 options. But
then is like, oh, maybe I would like to be able to switch between png
(synthetic image), jpg (natural image)... anyway, I hope you see
customizing this is interesting for the users.
What I did to solve the absolute path meanwhile the discussion and
development happens is defining on my own the entire function
=org--image-yank-media-handler= just changing this:
#+begin_src diff
-(setq link (org-link-make-string (concat "file:" (file-relative-name
absname))))
+(setq link (org-link-make-string (concat "file:" absname)))
#+end_src
source (sorry, this link is slow to open):
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/org.el?id=cdcde091b9bdc14fc2254b0e594d8e0da6c4e6c6#n20895
and here is the equivalent to the org-download
#+begin_src emacs-lisp
(defun my/yank-media ()
"org-download replacement"
(interactive)
(let ((org-yank-image-save-method "/tmp/")
(org-yank-dnd-method 'file-link))
(yank-media))
;; facilitate image size on preview
(save-excursion
(previous-line)
(insert "\n#+attr_org: :width 350px")))
;; thanks for all the fish, org-download
;; (global-set-key (kbd "C-M-y") 'org-download-clipboard)
(global-set-key (kbd "C-M-y") 'my/yank-media)
#+end_src
Thanks for your attention,
pinmacs
next reply other threads:[~2024-09-16 4:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-16 4:56 pinmacs [this message]
2024-09-16 17:10 ` [FR] yank media: allow customization of absolute path a filter for type candidates Visuwesh
2024-09-22 11:38 ` Ihor Radchenko
2024-09-22 13:01 ` Visuwesh
2024-09-22 17:04 ` Pedro
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a7d4e731-1af6-4ce9-9f4d-d49ddcf5750d@cas.cat \
--to=pinmacs@cas.cat \
--cc=emacs-orgmode@gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.