lang/org: move org-yt out of +attach in config.el
This commit is contained in:
parent
ecaa8fc7cd
commit
b2927955e7
2 changed files with 23 additions and 23 deletions
|
@ -63,28 +63,6 @@
|
||||||
(advice-add #'org-download--fullname
|
(advice-add #'org-download--fullname
|
||||||
:filter-return #'+org-attach*download-fullname))
|
:filter-return #'+org-attach*download-fullname))
|
||||||
|
|
||||||
(def-package! org-yt
|
|
||||||
:after org
|
|
||||||
:config
|
|
||||||
(defun +org-inline-data-image (_protocol link _description)
|
|
||||||
"Interpret LINK as base64-encoded image data."
|
|
||||||
(base64-decode-string link))
|
|
||||||
|
|
||||||
(defun +org-image-link (protocol link _description)
|
|
||||||
"Interpret LINK as base64-encoded image data."
|
|
||||||
(when (image-type-from-file-name link)
|
|
||||||
(let ((buf (url-retrieve-synchronously (concat protocol ":" link))))
|
|
||||||
;; TODO Better error handling
|
|
||||||
(cl-assert buf nil "Download of image \"%s\" failed." link)
|
|
||||||
(with-current-buffer buf
|
|
||||||
(goto-char (point-min))
|
|
||||||
(re-search-forward "\r?\n\r?\n")
|
|
||||||
(buffer-substring-no-properties (point) (point-max))))))
|
|
||||||
|
|
||||||
(org-link-set-parameters "http" :image-data-fun #'+org-image-link)
|
|
||||||
(org-link-set-parameters "https" :image-data-fun #'+org-image-link)
|
|
||||||
(org-link-set-parameters "img" :image-data-fun #'+org-inline-data-image))
|
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; Bootstrap
|
;; Bootstrap
|
||||||
|
|
|
@ -63,6 +63,28 @@
|
||||||
;; support for links to specific pages
|
;; support for links to specific pages
|
||||||
(add-to-list 'org-file-apps '("\\.pdf::\\([[:digit:]]+\\)\\'" . (lambda (_file link) (org-pdfview-open link))))))
|
(add-to-list 'org-file-apps '("\\.pdf::\\([[:digit:]]+\\)\\'" . (lambda (_file link) (org-pdfview-open link))))))
|
||||||
|
|
||||||
|
(def-package! org-yt
|
||||||
|
:after org
|
||||||
|
:config
|
||||||
|
(defun +org-inline-data-image (_protocol link _description)
|
||||||
|
"Interpret LINK as base64-encoded image data."
|
||||||
|
(base64-decode-string link))
|
||||||
|
|
||||||
|
(defun +org-image-link (protocol link _description)
|
||||||
|
"Interpret LINK as base64-encoded image data."
|
||||||
|
(when (image-type-from-file-name link)
|
||||||
|
(let ((buf (url-retrieve-synchronously (concat protocol ":" link))))
|
||||||
|
;; TODO Better error handling
|
||||||
|
(cl-assert buf nil "Download of image \"%s\" failed." link)
|
||||||
|
(with-current-buffer buf
|
||||||
|
(goto-char (point-min))
|
||||||
|
(re-search-forward "\r?\n\r?\n")
|
||||||
|
(buffer-substring-no-properties (point) (point-max))))))
|
||||||
|
|
||||||
|
(org-link-set-parameters "http" :image-data-fun #'+org-image-link)
|
||||||
|
(org-link-set-parameters "https" :image-data-fun #'+org-image-link)
|
||||||
|
(org-link-set-parameters "img" :image-data-fun #'+org-inline-data-image))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; Bootstrap
|
;; Bootstrap
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue