Re: [O] [Orgmode] Automatic screenshot insertion
On Sun, Jan 15, 2012 at 12:37:16AM -0600, Marcelo de Moraes Serpa wrote: A bit OT, but related. --- It would be *awesome* if we could somehow hook into the emacs paste/(drag-and)drop events and automatically paste or drop the image in an org buffer. I don't know if it's possible, but I imagine that if hooking into those events was somehow possible, then we could get the event handle with information regarding the file, and automatically insert a link to it, and if iimage is activated, it would then render the image. It would be freaking awesome, this is the only thing I miss from Evernote. --- - Marcelo. Emacs has drag'n'drop support. In fact, I've been able to drag and drop image files from KDE's file manager (dolphin?) into emacs and make them custom links. .emacs: (defun dnd-from-kde (url action) (insert url) (select-frame-set-input-focus (selected-frame))) (custom-set-variables '(dnd-protocol-alist (quote ((file:/// . dnd-from-kde) This ought to give you a place to start. The URL format may need to change to make it an Org link, I was using file:// for another text format. -- Russell Adamsrlad...@adamsinfoserv.com PGP Key ID: 0x1160DCB3 http://www.adamsinfoserv.com/ Fingerprint:1723 D8CA 4280 1EC9 557F 66E8 1154 E018 1160 DCB3
Re: [O] [Orgmode] Automatic screenshot insertion
Awesome! I will try that out. What about hooking into the pasting event and check when it's an image (or whatever file you want) ? Thanks, - Marcelo. On Sun, Jan 15, 2012 at 6:10 AM, Russell Adams rlad...@adamsinfoserv.comwrote: On Sun, Jan 15, 2012 at 12:37:16AM -0600, Marcelo de Moraes Serpa wrote: A bit OT, but related. --- It would be *awesome* if we could somehow hook into the emacs paste/(drag-and)drop events and automatically paste or drop the image in an org buffer. I don't know if it's possible, but I imagine that if hooking into those events was somehow possible, then we could get the event handle with information regarding the file, and automatically insert a link to it, and if iimage is activated, it would then render the image. It would be freaking awesome, this is the only thing I miss from Evernote. --- - Marcelo. Emacs has drag'n'drop support. In fact, I've been able to drag and drop image files from KDE's file manager (dolphin?) into emacs and make them custom links. .emacs: (defun dnd-from-kde (url action) (insert url) (select-frame-set-input-focus (selected-frame))) (custom-set-variables '(dnd-protocol-alist (quote ((file:/// . dnd-from-kde) This ought to give you a place to start. The URL format may need to change to make it an Org link, I was using file:// for another text format. -- Russell Adamsrlad...@adamsinfoserv.com PGP Key ID: 0x1160DCB3 http://www.adamsinfoserv.com/ Fingerprint:1723 D8CA 4280 1EC9 557F 66E8 1154 E018 1160 DCB3
Re: [O] [Orgmode] Automatic screenshot insertion
Marcelo, You can check out the Emacs DND (drag-n-drop) help files for more information. I'm not sure what other capabilities it has. I know that I was subscribing my function to the files event only, there were a few other types. Thanks. On Sun, Jan 15, 2012 at 01:31:02PM -0600, Marcelo de Moraes Serpa wrote: Awesome! I will try that out. What about hooking into the pasting event and check when it's an image (or whatever file you want) ? Thanks, - Marcelo. On Sun, Jan 15, 2012 at 6:10 AM, Russell Adams rlad...@adamsinfoserv.comwrote: On Sun, Jan 15, 2012 at 12:37:16AM -0600, Marcelo de Moraes Serpa wrote: A bit OT, but related. --- It would be *awesome* if we could somehow hook into the emacs paste/(drag-and)drop events and automatically paste or drop the image in an org buffer. I don't know if it's possible, but I imagine that if hooking into those events was somehow possible, then we could get the event handle with information regarding the file, and automatically insert a link to it, and if iimage is activated, it would then render the image. It would be freaking awesome, this is the only thing I miss from Evernote. --- - Marcelo. Emacs has drag'n'drop support. In fact, I've been able to drag and drop image files from KDE's file manager (dolphin?) into emacs and make them custom links. .emacs: (defun dnd-from-kde (url action) (insert url) (select-frame-set-input-focus (selected-frame))) (custom-set-variables '(dnd-protocol-alist (quote ((file:/// . dnd-from-kde) This ought to give you a place to start. The URL format may need to change to make it an Org link, I was using file:// for another text format. -- Russell Adamsrlad...@adamsinfoserv.com PGP Key ID: 0x1160DCB3 http://www.adamsinfoserv.com/ Fingerprint:1723 D8CA 4280 1EC9 557F 66E8 1154 E018 1160 DCB3 -- Russell Adamsrlad...@adamsinfoserv.com PGP Key ID: 0x1160DCB3 http://www.adamsinfoserv.com/ Fingerprint:1723 D8CA 4280 1EC9 557F 66E8 1154 E018 1160 DCB3
Re: [O] [Orgmode] Automatic screenshot insertion
Skip Collins skip.coll...@gmail.com writes: 2012/1/10 François Pinard pin...@iro.umontreal.ca: Some sad people think of me as a programmer. While deep down, I am fundamentally an artist. Programming is mere mean of expression :-). You and Jambunathan K. should form a club. I do not know Jambunathan, but I'll pay attention! :-) François P.S. This Org mode mailing list is quite active. I did not pay attention in the last few days (being busy elsewhere) and messages accumulated at a relatively fast pace!
Re: [O] [Orgmode] Automatic screenshot insertion
A bit OT, but related. --- It would be *awesome* if we could somehow hook into the emacs paste/(drag-and)drop events and automatically paste or drop the image in an org buffer. I don't know if it's possible, but I imagine that if hooking into those events was somehow possible, then we could get the event handle with information regarding the file, and automatically insert a link to it, and if iimage is activated, it would then render the image. It would be freaking awesome, this is the only thing I miss from Evernote. --- - Marcelo. 2012/1/14 François Pinard pin...@iro.umontreal.ca Skip Collins skip.coll...@gmail.com writes: 2012/1/10 François Pinard pin...@iro.umontreal.ca: Some sad people think of me as a programmer. While deep down, I am fundamentally an artist. Programming is mere mean of expression :-). You and Jambunathan K. should form a club. I do not know Jambunathan, but I'll pay attention! :-) François P.S. This Org mode mailing list is quite active. I did not pay attention in the last few days (being busy elsewhere) and messages accumulated at a relatively fast pace!
Re: [O] [Orgmode] Automatic screenshot insertion
On Wed, Jan 11, 2012 at 12:50 AM, Jambunathan K kjambunat...@gmail.com wrote: You and Jambunathan K. should form a club. Since I am being dragged in to the conversaion, Of course I intend no disrespect for you or François. I have noticed that org, perhaps not surprisingly, attracts people with a certain detail-oriented aesthetic, similar in some ways to Knuth's obsessive perfectionism. While Francois fancies himself an artist who works in the medium of code, I suspect that most of those afflicted with OCD (Org Compulsive Disorder) are closer in spirit to the artisan or craftsman than to the artist.
Re: [O] [Orgmode] Automatic screenshot insertion
Hi Skip, I love OCD! Thanks for that one. And, thank goodness the Org mode community is big enough for artists, artisans, and crafts people. I find it fascinating to use software created by such a diverse community. I've often thought I'm glimpsing the future. All the best, Tom Skip Collins skip.coll...@gmail.com writes: On Wed, Jan 11, 2012 at 12:50 AM, Jambunathan K kjambunat...@gmail.com wrote: You and Jambunathan K. should form a club. Since I am being dragged in to the conversaion, Of course I intend no disrespect for you or François. I have noticed that org, perhaps not surprisingly, attracts people with a certain detail-oriented aesthetic, similar in some ways to Knuth's obsessive perfectionism. While Francois fancies himself an artist who works in the medium of code, I suspect that most of those afflicted with OCD (Org Compulsive Disorder) are closer in spirit to the artisan or craftsman than to the artist. -- Thomas S. Dye http://www.tsdye.com
Re: [O] [Orgmode] Automatic screenshot insertion
pin...@iro.umontreal.ca (François Pinard) writes: [...] 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. This correction did not work for me out of the box. I had to add a call to expand-file-name for getting a file name which worked on my system for some reason. I also re-arranged your second (unless ...) to an (if ...): #+begin_src emacs-lisp (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 (expand-file-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) (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))) (insert (concat [[ name ]])) (org-display-inline-images)) #+end_src This now appears to work (for me). 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.67.g56c73)
Re: [O] [Orgmode] Automatic screenshot insertion
Eric S Fraga e.fr...@ucl.ac.uk writes: Hi again, Eric. I'll be using your corrections on the code, thanks! 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? 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: (if (not (file-writable-p name)) (error Cannot create image file) (message Taking screenshot into %s name) (call-process import nil nil nil name) (message Taking screenshot...done)) Then, besides a few exceptions, I generally do not like else clauses after returning or other escaping statements, so the above becomes: (if (not (file-writable-p name)) (error Cannot create image file)) (message Taking screenshot into %s name) (call-process import nil nil nil name) (message Taking screenshot...done) Finally, I avoid (not ...) when this is easily done. I will always exchange the two branches of an if to get rid of one (unless it would imply re-introducing (progn ...), as progn is uglier than not :-). Easier here, as (if (not ...)) may be rewritten (unless ...). By the way, (when ...) is always nicer than a single-branched if. Scheme is especially irritating. They said it is minimalist, and yet, they have many ways to write conditional code, forcing me to choose constantly. I will turn (if ...) into (cond ...) if a (begin ...) becomes necessary on either branch. And a (cond ...) back to an (if ...) if while simplifying a cond, I see it could written to an if without begin. And there is always this stretch towards tail recursion, and so many ways to reuse or not local variables as arguments, doing so. Irritating I say. And yet, I love this language. Maniacal I am, really! 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
Re: [O] [Orgmode] Automatic screenshot insertion
pin...@iro.umontreal.ca (François Pinard) writes: Eric S Fraga e.fr...@ucl.ac.uk 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
Eric S Fraga e.fr...@ucl.ac.uk writes: 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)... :-) Who cares about computation! :-) Some sad people think of me as a programmer. While deep down, I am fundamentally an artist. Programming is mere mean of expression :-). Thanks again, I'm the one thanking you! François
Re: [O] [Orgmode] Automatic screenshot insertion
2012/1/10 François Pinard pin...@iro.umontreal.ca: Some sad people think of me as a programmer. While deep down, I am fundamentally an artist. Programming is mere mean of expression :-). You and Jambunathan K. should form a club.
Re: [O] [Orgmode] Automatic screenshot insertion
pin...@iro.umontreal.ca (François Pinard) writes: Some sad people think of me as a programmer. While deep down, I am fundamentally an artist. Programming is mere mean of expression :-). Hence: D Knuth: The Art of computer programming https://en.wikipedia.org/wiki/The_Art_of_Computer_Programming or programming for expression (well, a form of art) instead: Prusinkiewicz Lindenmayer (1990), The algorithmic beauty of plants [[http://algorithmicbotany.org/papers/#abop]] You can download the latter from the site! Anyway, totally and utterly OT! :-) I'm done! -- : Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.92.1 : using Org-mode version 7.8.03 (release_7.8.03.73.gd2b3d)
Re: [O] [Orgmode] Automatic screenshot insertion
Skip Collins skip.coll...@gmail.com writes: 2012/1/10 François Pinard pin...@iro.umontreal.ca: Some sad people think of me as a programmer. While deep down, I am fundamentally an artist. Programming is mere mean of expression :-). You and Jambunathan K. should form a club. Since I am being dragged in to the conversaion, I am digging out a reddit post that resonated with me (in a totally different setting). The clincher is actually the last paragraph and you need to read the first few paragraphs to enjoy the last one. There is also a story at the end of this post for everyone to ponder about. , From http://www.reddit.com/r/Buddhism/comments/if08k/when_did_you_first_discover_the_illusory_nature/ | At some point in my teens I'd started doing C programming. If you | don't know, computer code is usually formatted in a systematic way to | make it easier to read. Most languages give you a lot of freedom in | this, so every project has its own coding conventions. | | I was really into Linux and assumed Linus Torvalds was probably the | most wonderful genius hacker of all time. He's got his own write-up | about the Linux kernel coding style, which you can read here if you | happen to be interested. Some quotes: | | First off, I'd suggest printing out a copy of the GNU coding | standards, and NOT read it. Burn them, it's a great symbolic | gesture. | | [...] | | Tabs are 8 characters, and thus indentations are also 8 | characters. There are heretic movements that try to make | indentations 4 (or even 2! [this is the GNU standard]) characters | deep, and that is akin to trying to define the value of PI to be | 3. | | [...] | | You've probably been told by your long-time Unix user helper that | GNU emacs automatically formats the C sources for you, and | you've noticed that yes, it does do that, but the defaults it uses | are less than desirable (in fact, they are worse than random | typing - an infinite number of monkeys typing into GNU emacs would | never make a good program). | | So I read this at an impressionable age and it all seemed very obvious | and plainly true. Linux kernel source code, you could tell by just the | aesthetic impression of the code style, was fast, clean, and smart. It | looked good. On the other hand, the source code for GNU projects had a | weird ugly style. | | Here's some Linux-style code: | | static char *concat(char *s1, char *s2) | { | while (x == y) { | something(); | somethingelse(); | } | finalthing(); | } | | Here's the corresponding GNU-style code: | | static char * | concat (char *s1, char *s2) | { | while (x == y) | { | something (); | somethingelse (); | } | finalthing (); | } | | But then I started using GNU Emacs and became fascinated by the | founder of GNU, Richard Stallman, who wrote Emacs and popularized this | coding convention. I gradually began to think Linus was kind of | annoying and not as profoundly creative as rms (as Mr. Stallman is | known). | | Then one day I noticed that Linux kernel code looked weird ugly and | GNU code looked fast, clean, and smart. This was now the obvious and | plain truth. When I noticed myself feeling like this, it was obvious | that something was seriously weird with the aesthetic sense. | | And that's when I realized that subconscious judgments filter | experience in a very strange way. So I couldn't really trust myself | anymore. It was like glimpsing some uncanny fluttering in the veils of | my ego delusion... dun dun dun! | | How weird is this story? ` My own opinion on the matter is: Great hackers have *a* style and stick religiously to it. But they remain steady and productive (even) when working with a dump (pun intended) from a different school. , From http://users.rider.edu/~suler/zenstory/concentrate.html | After winning several archery contests, the young and rather boastful | champion challenged a Zen master who was renowned for his skill as an | archer. The young man demonstrated remarkable technical proficiency | when he hit a distant bull's eye on his first try, and then split that | arrow with his second shot. There, he said to the old man, see if | you can match that! Undisturbed, the master did not draw his bow, but | rather motioned for the young archer to follow him up the | mountain. Curious about the old fellow's intentions, the champion | followed him high into the mountain until they reached a deep chasm | spanned by a rather flimsy and shaky log. Calmly stepping out onto the | middle of the unsteady and certainly perilous bridge, the old master | picked a far away tree as a target, drew his bow, and fired a clean, | direct hit. Now it is your turn, he said as he gracefully stepped | back onto the safe ground. Staring with terror into the seemingly | bottomless and beckoning abyss, the young man could not force himself |
Re: [O] [Orgmode] Automatic screenshot insertion
pin...@iro.umontreal.ca (François Pinard) writes: Russell Adams rlad...@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)
Re: [O] [Orgmode] Automatic screenshot insertion
Eric S Fraga e.fr...@ucl.ac.uk writes: pin...@iro.umontreal.ca (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
Russell Adams rlad...@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) 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 (buffer-file-name) .png))) (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)) (insert (concat [[ name ]])) (org-display-inline-images)) The changes are: * LaTeX processing fails if there is more than one period, because everything after the first period is considered as the extension, which is not recognized as a graphic one. * Accepts a file name as an argument, defaulting to the current directory, so a mere Enter takes a screenshot. The user may choose another directory for taking the screenshot. Also, if he selects an existing file name, a screen shot is not taken and that image is reused instead. That may be useful when the same few images are overly used as inlined icons. Try to not call import if the file name is plain wrong (no way to create a file under that name). * No need to have the timestamp in the generated file name, as make-temp-name already adds a unique suffix. No need to have overly long names, and if the timestamp is needed, ls -l will give it anyway. The prefix of make-temp-name is made absolute, so it better checks that the file it creates does not spuriously exist. * The minibuffer let the user know that a screenshot is expected. François P.S. ImageMagick import is quick and easy, but has a few limitations, in that one cannot screenshot popups and menus. When documenting the usage of a program with a GUI, there are more flexible tools to take screenshots in some special circumstances. Should be parameterizable! But for the needs I have this week, import is quite sufficient. :-)
Re: [O] [Orgmode] Automatic screenshot insertion
At Tue, 29 Mar 2011 09:43:27 -0500, Russell Adams wrote: 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. (defun org-screenshot () Take a screenshot into a time stamped unique-named file in the same directory as the org-buffer and insert a link to this file. (interactive) (setq filename (concat (make-temp-name (concat (buffer-file-name) _ (format-time-string %Y%m%d_%H%M%S_)) ) .png)) (call-process import nil nil nil filename) (insert (concat [[ filename ]])) (org-display-inline-images)) Thanks, I update the function on Worg. Best, -- David -- OpenPGP... 0x99ADB83B5A4478E6 Jabber dmj...@jabber.org Email. dm...@ictsoc.de pgpTV8raJHu2b.pgp Description: PGP signature
[O] Re: [Orgmode] Automatic screenshot insertion
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] Best, -- David [1] http://orgmode.org/worg/org-hacks.php -- OpenPGP... 0x99ADB83B5A4478E6 Jabber dmj...@jabber.org Email. dm...@ictsoc.de 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. (defun org-screenshot () Take a screenshot into a time stamped unique-named file in the same directory as the org-buffer and insert a link to this file. (interactive) (setq filename (concat (make-temp-name (concat (buffer-file-name) _ (format-time-string %Y%m%d_%H%M%S_)) ) .png)) (call-process import nil nil nil filename) (insert (concat [[ filename ]])) (org-display-inline-images)) -- Russell Adamsrlad...@adamsinfoserv.com PGP Key ID: 0x1160DCB3 http://www.adamsinfoserv.com/ Fingerprint:1723 D8CA 4280 1EC9 557F 66E8 1154 E018 1160 DCB3
Re: [Orgmode] Automatic screenshot insertion
Hi Jonathan, Jonathan BISSON bissonjonat...@gmail.com writes: 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). I added this to worg/org-hacks.org Thanks! -- Bastien ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] Automatic screenshot insertion
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] Best, -- David [1] http://orgmode.org/worg/org-hacks.php -- OpenPGP... 0x99ADB83B5A4478E6 Jabber dmj...@jabber.org Email. dm...@ictsoc.de pgpdiCfMB9WSg.pgp Description: PGP signature ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
[Orgmode] Automatic screenshot insertion
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). (defun my-screenshot () Take a screenshot into a unique-named file in the current buffer file directory and insert a link to this file. (interactive) (setq filename (concat (make-temp-name (file-name-directory (buffer-file-name)) ) .jpg ) ) (call-process import nil nil nil filename) (insert (concat [[ filename ]])) (org-display-inline-images) ) Cheers, ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode