[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] [Orgmode] Automatic screenshot insertion
From: |
François Pinard |
Subject: |
Re: [O] [Orgmode] Automatic screenshot insertion |
Date: |
Mon, 09 Jan 2012 15:22:27 -0500 |
User-agent: |
Gnus/5.110018 (No Gnus v0.18) Emacs/23.3 (gnu/linux) |
Eric S Fraga <address@hidden> writes:
> address@hidden (François Pinard) writes:
> Thanks! However, if I give it a directory name, the function fails
> with "Cannot create image file" in the mini-buffer. [...] In
> summary, if I give it an existing file name, that works; if I give it
> a non-existing file name, that also works. It only fails if I give it
> a directory.
Hi, Eric. Sorry. Here is a quick correction for that problem. This is
only this week that I plan to use that function for actual work; last
week was rather an exploration of the capability of various tools. Of
course, do not hesitate if you see that I goofed elsewhere! :-).
Thanks, François
(defun fp-org-image (name)
"Insert a link to an already existing image, or else to a screenshot.
The screenshot is either taken to the given non-existing file name,
or added into the given directory, defaulting to the current one."
;; FIXME: Should limit to '("pdf" "jpeg" "jpg" "png" "ps" "eps")
;; which is org-export-latex-inline-image-extensions.
(interactive "GImage name? ")
(when (file-directory-p name)
(setq name (concat
(make-temp-name
(concat (file-name-as-directory name)
(subst-char-in-string
"." "-"
(file-name-sans-extension
(file-name-nondirectory
(buffer-file-name))))))
".png")))
(unless (file-exists-p name)
(unless (file-writable-p name)
(debug)
(error "Cannot create image file"))
(message "Taking screenshot...")
(call-process "import" nil nil nil name)
(message "Taking screenshot...done"))
(insert (concat "[[" name "]]"))
(org-display-inline-images))
- Re: [O] [Orgmode] Automatic screenshot insertion, François Pinard, 2012/01/05
- Re: [O] [Orgmode] Automatic screenshot insertion, Eric S Fraga, 2012/01/09
- Re: [O] [Orgmode] Automatic screenshot insertion,
François Pinard <=
- Re: [O] [Orgmode] Automatic screenshot insertion, Eric S Fraga, 2012/01/10
- Re: [O] [Orgmode] Automatic screenshot insertion, François Pinard, 2012/01/10
- Re: [O] [Orgmode] Automatic screenshot insertion, Eric S Fraga, 2012/01/10
- Re: [O] [Orgmode] Automatic screenshot insertion, François Pinard, 2012/01/10
- Re: [O] [Orgmode] Automatic screenshot insertion, Skip Collins, 2012/01/10
- Re: [O] [Orgmode] Automatic screenshot insertion, Jambunathan K, 2012/01/11
- Re: [O] [Orgmode] Automatic screenshot insertion, Skip Collins, 2012/01/12
- Re: [O] [Orgmode] Automatic screenshot insertion, Thomas S. Dye, 2012/01/12
- Re: [O] [Orgmode] Automatic screenshot insertion, François Pinard, 2012/01/14
- Re: [O] [Orgmode] Automatic screenshot insertion, Marcelo de Moraes Serpa, 2012/01/15