[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] [Orgmode] Automatic screenshot insertion
From: |
Eric S Fraga |
Subject: |
Re: [O] [Orgmode] Automatic screenshot insertion |
Date: |
Tue, 10 Jan 2012 16:08:52 +0000 |
User-agent: |
Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.90 (gnu/linux) |
address@hidden (François Pinard) writes:
> Eric S Fraga <address@hidden> writes:
>
> Hi again, Eric. I'll be using your corrections on the code, thanks!
You're welcome!
>> I had to add a call to expand-file-name for getting a file name which
>> worked on my system for some reason.
>
> (make-temp-name
> (expand-file-name
> (concat (file-name-as-directory name)
> (subst-char-in-string
> "." "-"
> (file-name-sans-extension
> (file-name-nondirectory
> (buffer-file-name)))))))
> ".png")))
>
> Not a big deal, but I wonder if it should not rather be:
>
> (make-temp-name
> (concat (expand-file-name
> (file-name-as-directory name))
> (subst-char-in-string
> "." "-"
> (file-name-sans-extension
> (file-name-nondirectory
> (buffer-file-name))))))
>
> as there is nothing to expand in the base part of the file name?
Yes, this would be equivalent in this case. I guess I prefer the
former but only for reasons of style!
>> I also re-arranged your second (unless ...) to an (if ...):
>
> (if (file-writable-p name)
> (progn
> (message "Taking screenshot into %s" name)
> (call-process "import" nil nil nil name)
> (message "Taking screenshot...done"))
> (error "Cannot create image file"))
>
> I kept it, but I might likely revert it back routinely to the earlier
> state, if I later happen to revisit that code.
> Just to show you how maniacal I may be, let me explain. I just do not
> like "(progn ...)", and make stunts to avoid it. I would rather
> write:
Well, the progn is only there because of the debugging messages I needed
to see what was happening... I should probably get to grips with the
debugger instead :(
[...]
> Maniacal I am, really!
No, simply differing styles! I appreciate your reasoning in each case
I've elided but, in the end, the different versions or approaches you
mention are all essentially equivalent (computationally)... :-)
> François
>
> P.S. If you happen to grok French, you might have fun reading me (or
> making fun of me reading...):
>
> http://icule.blogspot.com/1997/02/dieu-la-douleur-et-l.html
I grok French a little (as a Canadian, albeit one from the west...) so
will have a look at this when I am back online!
Thanks again,
eric
--
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.90.1
: using Org-mode version 7.8.03 (release_7.8.03.69.gfadca)
- 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, 2012/01/09
- 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 <=
- 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
- Re: [O] [Orgmode] Automatic screenshot insertion, Russell Adams, 2012/01/15
- Re: [O] [Orgmode] Automatic screenshot insertion, Marcelo de Moraes Serpa, 2012/01/15
- Re: [O] [Orgmode] Automatic screenshot insertion, Russell Adams, 2012/01/15