Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add an example for README.md #147

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ optionally add a timestamp to the file name.
Customize `org-download-backend` to choose between `url-retrieve`
(the default) or `wget` or `curl`.

if you don't want to show the `#+DOWNLOAD` anonotate, use this:
```
(setq org-download-annotate-function (lambda (_link) ""))
```

## Set up

```elisp
Expand All @@ -69,3 +74,29 @@ Customize `org-download-backend` to choose between `url-retrieve`

## Pasting from the clipboard
If you have the image stored in the clipboard, use `org-download-clipboard`.

here is an example. shortcut `C-M-y` will have the image stored from the clipboard in the path `images/$currentfilename/%Y%m%d-%H%M%S_$imagename.png`

```
(defun zz/org-download-paste-clipboard (&optional use-default-filename)
(interactive "P")
(require 'org-download)
(setq org-download-image-dir (concat "images/" (file-name-sans-extension (buffer-name))))
(let ((file
(if (not use-default-filename)
(read-string (format "Filename [%s]: " org-download-screenshot-basename)
nil nil org-download-screenshot-basename)
nil)))
(org-download-clipboard file)))

(after! org
(setq org-download-method 'directory)
(setq org-download-image-dir "images/")
(setq org-download-heading-lvl nil)
(setq org-download-timestamp "%Y%m%d-%H%M%S_")
(setq org-image-actual-width nil)
(setq org-src-window-setup 'split-window-right)
(setq org-download-annotate-function (lambda (_link) ""))
(map! :map org-mode-map
"C-M-y" #'zz/org-download-paste-clipboard ))
```