💥 lang/org: conform to new name conventions
This commit is contained in:
parent
149b2617b0
commit
8147bc1aee
10 changed files with 198 additions and 196 deletions
|
@ -22,15 +22,39 @@
|
|||
;; Handle non-image files a little differently. Images should be inserted
|
||||
;; as-is, as image previews. Other files, like pdfs or zips, should be linked
|
||||
;; to, with an icon indicating the type of file.
|
||||
(advice-add #'org-download-insert-link :override #'+org-dragndrop*insert-link)
|
||||
(def-advice! +org-dragndrop-insert-link-a (_link filename)
|
||||
"Produces and inserts a link to FILENAME into the document.
|
||||
|
||||
(defun +org-dragndrop*download-fullname (path)
|
||||
If FILENAME is an image, produce an attach:%s path, otherwise use file:%s (with
|
||||
an file icon produced by `+org-attach--icon')."
|
||||
:override #'org-download-insert-link
|
||||
(if (looking-back "^[ \t]+" (line-beginning-position))
|
||||
(delete-region (match-beginning 0) (match-end 0))
|
||||
(newline))
|
||||
(cond ((image-type-from-file-name filename)
|
||||
(insert
|
||||
(concat (if (= org-download-image-html-width 0) ""
|
||||
(format "#+attr_html: :width %dpx\n" org-download-image-html-width))
|
||||
(if (= org-download-image-latex-width 0) ""
|
||||
(format "#+attr_latex: :width %dcm\n" org-download-image-latex-width))
|
||||
(cond ((file-in-directory-p filename org-attach-directory)
|
||||
(format "[[attach:%s]]" (file-relative-name filename org-attach-directory)))
|
||||
((file-in-directory-p filename org-directory)
|
||||
(format org-download-link-format (file-relative-name filename org-directory)))
|
||||
((format org-download-link-format filename)))))
|
||||
(org-display-inline-images))
|
||||
((insert
|
||||
(format "%s [[./%s][%s]] "
|
||||
(+org-attach--icon filename)
|
||||
(file-relative-name filename (file-name-directory buffer-file-name))
|
||||
(file-name-nondirectory (directory-file-name filename)))))))
|
||||
|
||||
(advice-add #'org-download--dir-2 :override #'ignore)
|
||||
(def-advice! +org-dragndrop-download-fullname-a (path)
|
||||
"Write PATH relative to current file."
|
||||
:filter-return #'org-download--fullname
|
||||
(let ((dir (or (if buffer-file-name (file-name-directory buffer-file-name))
|
||||
default-directory)))
|
||||
(if (file-in-directory-p dir org-directory)
|
||||
(file-relative-name path dir)
|
||||
path)))
|
||||
(advice-add #'org-download--dir-2 :override #'ignore)
|
||||
(advice-add #'org-download--fullname
|
||||
:filter-return #'+org-dragndrop*download-fullname))
|
||||
path))))
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
|
||||
(setq ob-ipython-resources-dir ".ob-ipython-resrc")
|
||||
|
||||
(defun +org|babel-load-ipython (lang)
|
||||
(and (string-prefix-p "jupyter-" (symbol-name lang))
|
||||
(require 'ob-ipython nil t)))
|
||||
(add-hook '+org-babel-load-functions #'+org|babel-load-ipython)
|
||||
(add-hook '+org-babel-load-functions
|
||||
(defun +org-babel-load-ipython-h (lang)
|
||||
(and (string-prefix-p "jupyter-" (symbol-name lang))
|
||||
(require 'ob-ipython nil t))))
|
||||
|
||||
(after! org-src
|
||||
(add-to-list 'org-src-lang-modes '("ipython" . python)))
|
||||
|
@ -27,14 +27,14 @@
|
|||
:select nil :quit nil :ttl nil)))
|
||||
|
||||
;; advices for remote kernel and org-src-edit
|
||||
(advice-add #'ob-ipython--create-repl :override #'+org*ob-ipython--create-repl)
|
||||
(advice-add #'org-babel-edit-prep:ipython :override #'+org*babel-edit-prep:ipython)
|
||||
(advice-add #'org-babel-execute:ipython :before #'+org*babel-execute:ipython)
|
||||
(advice-add #'org-babel-ipython-initiate-session :override #'+org*ob-ipython-initiate-session)
|
||||
(advice-add #'ob-ipython--create-repl :override #'+org-ob-ipython-create-repl-a)
|
||||
(advice-add #'org-babel-edit-prep:ipython :override #'+org-babel-edit-prep:ipython-a)
|
||||
(advice-add #'org-babel-execute:ipython :before #'+org-babel-execute:ipython-a)
|
||||
(advice-add #'org-babel-ipython-initiate-session :override #'+org-ob-ipython-initiate-session-a)
|
||||
|
||||
;; retina resolution image hack
|
||||
(when IS-MAC
|
||||
(advice-add #'ob-ipython--write-base64-string :around #'+org*ob-ipython--write-base64-string))
|
||||
(advice-add #'ob-ipython--write-base64-string :around #'+org-ob-ipython-write-base64-string-a))
|
||||
|
||||
;; ipython has its own async keyword, disable ipython in ob-async.
|
||||
(after! ob-async
|
||||
|
|
|
@ -36,10 +36,10 @@
|
|||
:n [left] #'org-tree-slide-move-previous-tree)
|
||||
|
||||
(add-hook! 'org-tree-slide-mode-after-narrow-hook
|
||||
#'(+org-present|detect-slide
|
||||
+org-present|add-overlays
|
||||
#'(+org-present-detect-slide-h
|
||||
+org-present-add-overlays-h
|
||||
org-display-inline-images))
|
||||
|
||||
(add-hook 'org-tree-slide-mode-hook #'+org-present|init-org-tree-window)
|
||||
(add-hook 'org-tree-slide-mode-hook #'+org-present-init-org-tree-window-h)
|
||||
(advice-add #'org-tree-slide--display-tree-with-narrow
|
||||
:around #'+org-present*narrow-to-subtree))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue