Fix #2429: replace defunct attach: links w/ download:
Forgot that support for attach: links were removed some time ago, but I still want short org-download links, so I've added 'download:' links.
This commit is contained in:
parent
871201dad6
commit
827225e331
4 changed files with 49 additions and 40 deletions
32
docs/faq.org
32
docs/faq.org
|
@ -64,30 +64,30 @@
|
|||
|
||||
* General
|
||||
** Why is it called Doom?
|
||||
An homage to idsoftware's classic game, whose open sourced code was my first
|
||||
exposure to programming.
|
||||
It's an homage to idsoftware's classic game, whose open sourced code was
|
||||
Henrik's (Doom's maintainer) first exposure to programming.
|
||||
|
||||
Also, if you're obsessed enough with a text editor that you write a community
|
||||
config for it, you're doomed from the get go.
|
||||
And if you're obsessed enough with a text editor that you write a community
|
||||
config for it, you're doomed from the start.
|
||||
|
||||
** Does Doom work on Windows?
|
||||
Windows support is weak and will generally lag behind Linux/MacOS support, so
|
||||
your mileage will vary. However, many have reported success installing Doom
|
||||
Emacs on Windows (using WSL, WSL2 or scoop/chocolatey). You'll find install
|
||||
instructions for Windows in the [[file:getting_started.org::On Windows][Getting Starting guide]].
|
||||
Windows support is weak and generally lags behind Linux/MacOS support, so your
|
||||
mileage will vary. However, some have reported success using Doom Emacs on
|
||||
Windows (using WSL, WSL2 or scoop/chocolatey). You'll find install instructions
|
||||
in the [[file:getting_started.org::On Windows][Getting Starting guide]].
|
||||
|
||||
If you're a Windows user, help us improve our documentation on Windows support!
|
||||
If you're a Windows user, help us improve our documentation!
|
||||
|
||||
** Is Doom only for vimmers?
|
||||
Henrik is a dyed-in-the-wool vimmer with more than a decade of vim muscle
|
||||
memory. Vim's is the only paradigm he truly knows, so vimmers will always be his
|
||||
primary audience.
|
||||
No, but it is Doom's primary audience. Its maintainer is a dyed-in-the-wool
|
||||
vimmer with almost two decades of vim muscle memory, and he came to Emacs to
|
||||
find a better vim.
|
||||
|
||||
That's not to say Doom won't work without evil, only that it is less polished in
|
||||
that respect. Our growing non-evil userbase are slowly improving the situation
|
||||
however. We welcome suggestions and PRs to help accommodate a non-evil workflow.
|
||||
Although Doom is less polished without evil, its growing non-evil user base is
|
||||
slowly improving the situation. We welcome suggestions and PRs to help
|
||||
accommodate a non-evil workflow.
|
||||
|
||||
If you'd still like a go at it, see the [[file:../modules/editor/evil/README.org::Removing%20evil-mode][Removing evil-mode]] section in the
|
||||
If you'd still like a go at it, see the [[file:../modules/editor/evil/README.org::Removing%20evil-mode][removing evil-mode]] section in the
|
||||
[[file:../modules/editor/evil/README.org][:editor evil]] module's documentation.
|
||||
|
||||
** I am a beginner. Can I use Doom?
|
||||
|
|
|
@ -1,5 +1,21 @@
|
|||
;;; lang/org/autoload/org-link.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defun +org--relpath (path root)
|
||||
(if (and buffer-file-name (file-in-directory-p buffer-file-name root))
|
||||
(file-relative-name path)
|
||||
path))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org-def-link (key dir)
|
||||
(org-link-set-parameters
|
||||
key
|
||||
:complete (lambda () (+org--relpath (+org-link-read-file key dir) dir))
|
||||
:follow (lambda (link) (find-file (expand-file-name link dir)))
|
||||
:face (lambda (link)
|
||||
(if (file-exists-p (expand-file-name link dir))
|
||||
'org-link
|
||||
'error))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org-link-read-file (key dir)
|
||||
(let ((file (read-file-name (format "%s: " (capitalize key)) dir)))
|
||||
|
|
|
@ -387,21 +387,6 @@ file isn't in `org-directory'."
|
|||
|
||||
|
||||
(defun +org-init-custom-links-h ()
|
||||
(defun +org--relpath (path root)
|
||||
(if (and buffer-file-name (file-in-directory-p buffer-file-name root))
|
||||
(file-relative-name path)
|
||||
path))
|
||||
|
||||
(defun +org-def-link (key dir)
|
||||
(org-link-set-parameters
|
||||
key
|
||||
:complete (lambda () (+org--relpath (+org-link-read-file key dir) dir))
|
||||
:follow (lambda (link) (find-file (expand-file-name link dir)))
|
||||
:face (lambda (link)
|
||||
(if (file-exists-p (expand-file-name link dir))
|
||||
'org-link
|
||||
'error))))
|
||||
|
||||
;; Highlight broken file links
|
||||
(org-link-set-parameters
|
||||
"file"
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
(advice-add #'org-download-enable :override #'ignore)
|
||||
:config
|
||||
(setq org-download-image-dir org-attach-id-dir
|
||||
org-download-link-format "[[download:%s]]\n"
|
||||
org-download-method 'attach
|
||||
org-download-heading-lvl nil
|
||||
org-download-timestamp "_%Y%m%d_%H%M%S"
|
||||
|
@ -20,6 +21,11 @@
|
|||
(cond ((executable-find "maim") "maim -s %s")
|
||||
((executable-find "scrot") "scrot -s %s")))))
|
||||
|
||||
;; A shorter link to attachments
|
||||
(+org-def-link "download" org-attach-id-dir)
|
||||
(setf (alist-get "download" org-link-abbrev-alist nil nil #'equal)
|
||||
(abbreviate-file-name org-attach-id-dir))
|
||||
|
||||
;; 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.
|
||||
|
@ -34,15 +40,17 @@ an file icon produced by `+org-attach-icon-for')."
|
|||
(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)))))
|
||||
(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))
|
||||
(format org-download-link-format
|
||||
(cond ((file-in-directory-p filename org-attach-directory)
|
||||
(file-relative-name filename org-download-image-dir))
|
||||
((file-in-directory-p filename org-directory)
|
||||
(file-relative-name filename org-directory))
|
||||
(filename)))))
|
||||
(org-display-inline-images))
|
||||
((insert
|
||||
(format "%s [[./%s][%s]] "
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue