emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric S Fraga <e.fraga@ucl.ac.uk>
To: "François Pinard" <pinard@iro.umontreal.ca>
Cc: emacs-orgmode@gnu.org
Subject: Re: [Orgmode] Automatic screenshot insertion
Date: Mon, 09 Jan 2012 18:27:57 +0000	[thread overview]
Message-ID: <87fwfoohn6.fsf@ucl.ac.uk> (raw)
In-Reply-To: <87ehveyck1.fsf@iro.umontreal.ca> ("François Pinard"'s message of "Wed, 04 Jan 2012 23:54:06 -0500")

pinard@iro.umontreal.ca (François Pinard) writes:

> Russell Adams <RLAdams@AdamsInfoServ.Com> writes:
>> On Sun, Nov 28, 2010 at 08:35:23PM +0100, David Maus wrote:
>>> At Thu, 18 Nov 2010 18:16:22 +0100, Jonathan BISSON wrote:
>
>>> > Here is a little function that allows a user to insert a screenshot
>>> > easily. Only works on unix-like systems where ImageMagick is installed
>>> > (adapt "import" to your screenshot program if needed).
>
>>> Nice.  Do you mind of I put the function on Org mode'S wiki (Worg) in
>>> the "Org hacks" page?[1]
>
>> I made a minor change. File names are now generated by using the
>> current org buffer filename, plus the date and time, and a unique
>> number. This allows me to sort out the images better.
>
> For my own usage, I modified it further, like below:
>
>
> (defun fp-org-image (name)

[...]

Thanks!  Very nice update.  I'd been using the original code for a while
but prompting for the file name is quite helpful.  However, if I give it
a directory name, the function fails with "Cannot create image file" in
the mini-buffer.  With debug (note: only function name is different):

,----
| Debugger entered--Lisp error: (error "Cannot create image file")
|   signal(error ("Cannot create image file"))
|   error("Cannot create image file")
|   (if (file-writable-p name) nil (error "Cannot create image file"))
|   (unless (file-writable-p name) (error "Cannot create image file"))
|   (if (file-exists-p name) nil (unless (file-writable-p name) (error "Cannot create image file")) (message "Taking screenshot...") (call-process "import" nil nil nil name) (message "Taking screenshot...done"))
|   (unless (file-exists-p name) (unless (file-writable-p name) (error "Cannot create image file")) (message "Taking screenshot...") (call-process "import" nil nil nil name) (message "Taking screenshot...done"))
|   esf/org-screenshot("~/s/test")
|   call-interactively(esf/org-screenshot nil nil)
`----

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.

thanks,
eric
-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.90.1
: using Org-mode version 7.8.03 (release_7.8.03.66.g1283.dirty)

  reply	other threads:[~2012-01-09 19:35 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-18 17:16 Automatic screenshot insertion Jonathan BISSON
2010-11-18 17:50 ` Sébastien Vauban
2010-11-28 19:35 ` David Maus
2011-03-29 14:43   ` [Orgmode] " Russell Adams
2011-06-06 18:59     ` David Maus
2012-01-05  4:54     ` François Pinard
2012-01-09 18:27       ` Eric S Fraga [this message]
2012-01-09 20:22         ` François Pinard
2012-01-10  8:57           ` Eric S Fraga
2012-01-10 14:53             ` François Pinard
2012-01-10 16:08               ` Eric S Fraga
2012-01-10 19:27                 ` François Pinard
2012-01-10 19:46                   ` Skip Collins
2012-01-11  5:50                     ` Jambunathan K
2012-01-12  5:26                       ` Skip Collins
2012-01-12  6:26                         ` Thomas S. Dye
2012-01-14 21:35                     ` François Pinard
2012-01-15  6:37                       ` Marcelo de Moraes Serpa
2012-01-15 12:10                         ` Russell Adams
2012-01-15 19:31                           ` Marcelo de Moraes Serpa
2012-01-15 21:45                             ` Russell Adams
2012-01-10 20:26                   ` Eric S Fraga
2011-02-03 13:33 ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fwfoohn6.fsf@ucl.ac.uk \
    --to=e.fraga@ucl.ac.uk \
    --cc=emacs-orgmode@gnu.org \
    --cc=pinard@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).