Re: [O] RFQ - new contribution - org-screenshot.el
Max Mikhanosha m...@openchat.com writes: At Mon, 20 May 2013 13:45:48 -0500, Russell Adams wrote: What advantages would org-screenshot provide by comparison? To me the most useful feature is actually screenshot rotation shortcuts, I also have my own screenshot tool (this was my first own addition to Org mode, soon after I started to use it, quite a while ago now!) which is intermediate in features between Russell's and Max's. One thing I like in Max's approach is this capability of doing a Dired display, in which one segregates between used screenshots and orphan ones. When a document has many screenshots, such diagnostic help eases eliminating the dead wood and staying clean overall. François
Re: [O] RFQ - new contribution - org-screenshot.el
On Tue, May 21, 2013 at 08:03:45AM -0400, François Pinard wrote: I also have my own screenshot tool (this was my first own addition to Org mode, soon after I started to use it, quite a while ago now!) which is intermediate in features between Russell's and Max's. I can't take credit, that snippet has floated around on the ML for a while and I only changed the filename format to suit my tastes. Thanks. -- 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] RFQ - new contribution - org-screenshot.el
Max Mikhanosha m...@openchat.com writes: Hi All, I've been writing some documentation in OrgMode with screenshots, and as with any screenshot taking, it takes a while to get one just right. A few tiny helper utilities, quickly snowballed into this :-) It may need some cleanup, but IMHO its too awesome not to share it with the list. To try it out, you'll need /usr/bin/scrot which is available as scrot package on most distributions. Cool. Can you make this a bit portable. On Mac OSX, the utility is called screencapture, and can be run with the same flags. Here is a piece of code that was published earlier with a sample use. http://thread.gmane.org/gmane.emacs.orgmode/69221/focus=69272 , | #+BEGIN_SRC emacs-lisp | (defun paste-clipboard-to-file (optional filename temp-dir) | Take a screenshot using the crosshairs and saveit to FILENAME, | if it is given or to a temp file in the TEMP-DIR | directory. Then add an orgmode style link at point. | (interactive) | (let* ((temporary-file-directory (or temp-dir images)) |(fname (or filename (make-temp-file img nil .jpg | (call-process-shell-command (concat | /usr/sbin/screencapture -s fname)) | (insert \n[[file: fname ]]) | (org-display-inline-images))) | ;; | (global-set-key (kbd C-c p) 'paste-clipboard-to-file) | | #+END_SRC ` Regards, -- Haider
Re: [O] RFQ - new contribution - org-screenshot.el
Haider Rizvi hari...@gmail.com writes: Max Mikhanosha m...@openchat.com writes: Hi All, I've been writing some documentation in OrgMode with screenshots, and as with any screenshot taking, it takes a while to get one just right. A few tiny helper utilities, quickly snowballed into this :-) It may need some cleanup, but IMHO its too awesome not to share it with the list. To try it out, you'll need /usr/bin/scrot which is available as scrot package on most distributions. Cool. Can you make this a bit portable. On Mac OSX, the utility is called screencapture, and can be run with the same flags. Here is a piece of code that was published earlier with a sample use. It's a good idea, import has nearly same feature as scrot and should work with org-screenshot ,it is included imagemagick https://wiki.archlinux.org/index.php/Taking_a_Screenshot http://thread.gmane.org/gmane.emacs.orgmode/69221/focus=69272 , | #+BEGIN_SRC emacs-lisp | (defun paste-clipboard-to-file (optional filename temp-dir) | Take a screenshot using the crosshairs and saveit to FILENAME, | if it is given or to a temp file in the TEMP-DIR | directory. Then add an orgmode style link at point. | (interactive) | (let* ((temporary-file-directory (or temp-dir images)) |(fname (or filename (make-temp-file img nil .jpg | (call-process-shell-command (concat | /usr/sbin/screencapture -s fname)) | (insert \n[[file: fname ]]) | (org-display-inline-images))) | ;; | (global-set-key (kbd C-c p) 'paste-clipboard-to-file) | | #+END_SRC ` Regards, --
Re: [O] RFQ - new contribution - org-screenshot.el
Feng Shu tuma...@gmail.com writes: Haider Rizvi hari...@gmail.com writes: Max Mikhanosha m...@openchat.com writes: scrot screencapture import (imagemagick) https://wiki.archlinux.org/index.php/Taking_a_Screenshot http://thread.gmane.org/gmane.emacs.orgmode/69221/focus=69272 Thanks for these links! :-) François
Re: [O] RFQ - new contribution - org-screenshot.el
Hi, Haider Rizvi wrote: Max Mikhanosha m...@openchat.com writes: Hi All, I've been writing some documentation in OrgMode with screenshots, and as with any screenshot taking, it takes a while to get one just right. A few tiny helper utilities, quickly snowballed into this :-) It may need some cleanup, but IMHO its too awesome not to share it with the list. To try it out, you'll need /usr/bin/scrot which is available as scrot package on most distributions. Cool. Can you make this a bit portable. On Mac OSX, the utility is called screencapture, and can be run with the same flags. Attached is a very first try at making org-screenshot run on OS X. Many open issues remain: - Clicking in a window will not take a screenshot using `screencapture -s' but aborts the process altogether and does not create a file. To capture a window one has to use `screencapture -w'. Another option is to use `screencapture -i' and toggle between window and selection mode using the space bar. The problem with this approach is that hitting the control key will place the screenshot into the clipboard and not create a file either. - Delay does not work because `screencapture -d' has a different meaning. To delay a screenshot, one has to use `screencapture -T'. Cheers, Viktor Here is a piece of code that was published earlier with a sample use. http://thread.gmane.org/gmane.emacs.orgmode/69221/focus=69272 , | #+BEGIN_SRC emacs-lisp | (defun paste-clipboard-to-file (optional filename temp-dir) | Take a screenshot using the crosshairs and saveit to FILENAME, | if it is given or to a temp file in the TEMP-DIR | directory. Then add an orgmode style link at point. | (interactive) | (let* ((temporary-file-directory (or temp-dir images)) |(fname (or filename (make-temp-file img nil .jpg | (call-process-shell-command (concat | /usr/sbin/screencapture -s fname)) | (insert \n[[file: fname ]]) | (org-display-inline-images))) | ;; | (global-set-key (kbd C-c p) 'paste-clipboard-to-file) | | #+END_SRC ` Regards, -- Haider
Re: [O] RFQ - new contribution - org-screenshot.el
Forgot to attach the patch in my last mail. Sorry about the double posting. Viktor Rosenfeld wrote: Hi, Haider Rizvi wrote: Max Mikhanosha m...@openchat.com writes: Hi All, I've been writing some documentation in OrgMode with screenshots, and as with any screenshot taking, it takes a while to get one just right. A few tiny helper utilities, quickly snowballed into this :-) It may need some cleanup, but IMHO its too awesome not to share it with the list. To try it out, you'll need /usr/bin/scrot which is available as scrot package on most distributions. Cool. Can you make this a bit portable. On Mac OSX, the utility is called screencapture, and can be run with the same flags. Attached is a very first try at making org-screenshot run on OS X. Many open issues remain: - Clicking in a window will not take a screenshot using `screencapture -s' but aborts the process altogether and does not create a file. To capture a window one has to use `screencapture -w'. Another option is to use `screencapture -i' and toggle between window and selection mode using the space bar. The problem with this approach is that hitting the control key will place the screenshot into the clipboard and not create a file either. - Delay does not work because `screencapture -d' has a different meaning. To delay a screenshot, one has to use `screencapture -T'. Cheers, Viktor Here is a piece of code that was published earlier with a sample use. http://thread.gmane.org/gmane.emacs.orgmode/69221/focus=69272 , | #+BEGIN_SRC emacs-lisp | (defun paste-clipboard-to-file (optional filename temp-dir) | Take a screenshot using the crosshairs and saveit to FILENAME, | if it is given or to a temp file in the TEMP-DIR | directory. Then add an orgmode style link at point. | (interactive) | (let* ((temporary-file-directory (or temp-dir images)) |(fname (or filename (make-temp-file img nil .jpg | (call-process-shell-command (concat | /usr/sbin/screencapture -s fname)) | (insert \n[[file: fname ]]) | (org-display-inline-images))) | ;; | (global-set-key (kbd C-c p) 'paste-clipboard-to-file) | | #+END_SRC ` Regards, -- Haider From 5938b848f4b9b30b25c903e3487834f9400f6ad9 Mon Sep 17 00:00:00 2001 From: Viktor Rosenfeld listuse...@gmail.com Date: Tue, 21 May 2013 19:32:16 +0200 Subject: [PATCH] org-screenshot: Let user configure capture program. * org-screenshot.el (org-screenshot-capture-binary): Configure the binary to capture a screenshot. (org-screenshot-take): Do not use hardcoded `scrot' binary. --- contrib/lisp/org-screenshot.el | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/contrib/lisp/org-screenshot.el b/contrib/lisp/org-screenshot.el index a54cb8f..54c8074 100644 --- a/contrib/lisp/org-screenshot.el +++ b/contrib/lisp/org-screenshot.el @@ -85,6 +85,11 @@ Options for taking and managing screen-shots :group 'org-link) +(defcustom org-screenshot-capture-binary scrot + Binary to capture screen contents. Use `scrot' on Linux and `screencapture' on Mac OS X. + :type 'string + :group 'org-screenshot) + (defcustom org-screenshot-image-directory ./images/ Directory in which screenshot image files will be stored, it be automatically created if it does't already exist. @@ -307,7 +312,7 @@ screenshot is done, any more `C-u' after that increases delay by (or (apply 'start-process (append - (list scrot *scrot* scrot -s path) + (list scrot *scrot* org-screenshot-capture-binary -s path) (when (plusp delay) (list -d (format %d delay) (error Unable to start scrot process))) -- 1.8.2.3
Re: [O] RFQ - new contribution - org-screenshot.el
Max Mikhanosha m...@openchat.com writes: [...] (require 'org-screenshot) [...] Thanks, Max, for sharing this! :-) François P.S. I appreciate the org-screenshot-image-directory function: by making it easy to override, the feature has been immediately useful to me.
Re: [O] RFQ - new contribution - org-screenshot.el
On Thu, May 16, 2013 at 11:21:56PM -0400, Max Mikhanosha wrote: Hi All, I've been writing some documentation in OrgMode with screenshots, and as with any screenshot taking, it takes a while to get one just right. Max, I use this for all screenshots. This inserts a link named by buffer with a timestamp appended using the Imagemagick import utility, where I can just click a window or drag an area. (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 ]]))) What advantages would org-screenshot provide by comparison? Thanks. -- 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] RFQ - new contribution - org-screenshot.el
On Mon, May 20, 2013 at 08:14:16PM -0400, Max Mikhanosha wrote: To me the most useful feature is actually screenshot rotation shortcuts, that cycle image before point, with other files in the `(org-screenshot-image-directory)'. That is useful! Taking screenshot itself and inserting link is simple I agree. True. Maybe that rotation code can be uplifted into Org itself , because I think its probably useful for people working with a lot of image links, not just screenshots. Another is specifying screenshot delay by C-u prefix (C-u C-u C-u - 3 seconds), for making screenshot of menus. I suppose that depends on the tool? I would love to add more to it, but don't have time. If someone wants to hack on it, you welcome :-) I think you were off to a great start! Thanks. -- 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] RFQ - new contribution - org-screenshot.el
Hi Max, Max Mikhanosha m...@openchat.com writes: To try it out, you'll need /usr/bin/scrot which is available as scrot package on most distributions. Then (require 'org-screenshot) and try C-c M-s (org-screenshot-take) in an Org File. Make sure to turn on inline image display (C-c C-x C-v) after taking the first screenshot. Tested, and it works *great*! Thanks for this neat package. -- Bastien
Re: [O] RFQ - new contribution - org-screenshot.el
Bastien b...@gnu.org writes: Hi Max, Max Mikhanosha m...@openchat.com writes: To try it out, you'll need /usr/bin/scrot which is available as scrot package on most distributions. Then (require 'org-screenshot) and try C-c M-s (org-screenshot-take) in an Org File. Make sure to turn on inline image display (C-c C-x C-v) after taking the first screenshot. Tested, and it works *great*! Thanks for this neat package. #secure method=pgpmime mode=sign Nice and very useful. Can this be included in /contrib? Rainer -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax : +33 - (0)9 58 10 27 44 Fax (D):+49 - (0)3 21 21 25 22 44 email: rai...@krugs.de Skype: RMkrug
Re: [O] RFQ - new contribution - org-screenshot.el
At Fri, 17 May 2013 09:38:29 +0200, Rainer M. Krug wrote: Nice and very useful. Can this be included in /contrib? That is my intention, I have the FSF paper signed for Emacs and Org. So what I'm looking for some minimum amount of eyes on the code, and advice as to minimum set of things I need to adjust before committing it? My list is. 1. Convert defvar to defcustom 2. Is (require 'dired) fine? It uses macro `dired-mark-if' defined in dired.el 3. The prefix C-c M-s seems awkward but Org is so big everything else is taken, and C-c C-x s is too close to C-c C-x C-s, which is archive subtree (I initially had it there and moved after archiving subtree by mistake) Its its fine to go in as is, then its fine too, I'm pretty lazy :-) Regards, Max
Re: [O] RFQ - new contribution - org-screenshot.el
It looks great! I think I'd only convert defvars to defcustom. Personally, I don't worry about prefixes that much, because if I am not using a command very often I just tend do run it using M-x command-name - Dan On Fri, May 17, 2013 at 2:41 PM, Max Mikhanosha m...@openchat.com wrote: At Fri, 17 May 2013 09:38:29 +0200, Rainer M. Krug wrote: Nice and very useful. Can this be included in /contrib? That is my intention, I have the FSF paper signed for Emacs and Org. So what I'm looking for some minimum amount of eyes on the code, and advice as to minimum set of things I need to adjust before committing it? My list is. 1. Convert defvar to defcustom 2. Is (require 'dired) fine? It uses macro `dired-mark-if' defined in dired.el 3. The prefix C-c M-s seems awkward but Org is so big everything else is taken, and C-c C-x s is too close to C-c C-x C-s, which is archive subtree (I initially had it there and moved after archiving subtree by mistake) Its its fine to go in as is, then its fine too, I'm pretty lazy :-) Regards, Max -- Sincerely yours, -- Daniil
Re: [O] RFQ - new contribution - org-screenshot.el
On 17.5.2013, at 09:38, Rainer M. Krug rai...@krugs.de wrote: Bastien b...@gnu.org writes: Hi Max, Max Mikhanosha m...@openchat.com writes: To try it out, you'll need /usr/bin/scrot which is available as scrot package on most distributions. Then (require 'org-screenshot) and try C-c M-s (org-screenshot-take) in an Org File. Make sure to turn on inline image display (C-c C-x C-v) after taking the first screenshot. Tested, and it works *great*! Thanks for this neat package. #secure method=pgpmime mode=sign Nice and very useful. Can this be included in /contrib? Certainly! - Carsten Rainer -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax : +33 - (0)9 58 10 27 44 Fax (D):+49 - (0)3 21 21 25 22 44 email: rai...@krugs.de Skype: RMkrug
Re: [O] RFQ - new contribution - org-screenshot.el
On 17.5.2013, at 09:38, Rainer M. Krug rai...@krugs.de wrote: Bastien b...@gnu.org writes: Hi Max, Max Mikhanosha m...@openchat.com writes: To try it out, you'll need /usr/bin/scrot which is available as scrot package on most distributions. Then (require 'org-screenshot) and try C-c M-s (org-screenshot-take) in an Org File. Make sure to turn on inline image display (C-c C-x C-v) after taking the first screenshot. Tested, and it works *great*! Thanks for this neat package. #secure method=pgpmime mode=sign Nice and very useful. Can this be included in /contrib? Certainly! - Carsten Rainer -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax : +33 - (0)9 58 10 27 44 Fax (D):+49 - (0)3 21 21 25 22 44 email: rai...@krugs.de Skype: RMkrug
Re: [O] RFQ - new contribution - org-screenshot.el
Hi Max, Max Mikhanosha m...@openchat.com writes: My list is. 1. Convert defvar to defcustom 2. Is (require 'dired) fine? It uses macro `dired-mark-if' defined in dired.el Seems fine to me. 3. The prefix C-c M-s seems awkward but Org is so big everything else is taken, and C-c C-x s is too close to C-c C-x C-s, which is archive subtree (I initially had it there and moved after archiving subtree by mistake) I'd favor reserving C-c C-x for core packages, and use anything else for contrib/ packages. Its its fine to go in as is, then its fine too, I'm pretty lazy :-) Whatever sounds more practical to you! You can include it now, have more eyes watching (after) your code, then feel the pressure to overcome the laziness in implementing the above :) -- Bastien
Re: [O] RFQ - new contribution - org-screenshot.el
At Fri, 17 May 2013 15:05:05 +0200, Carsten Dominik wrote: Nice and very useful. Can this be included in /contrib? Certainly! Ok cool, I've already cleaned up the docstrings, I'll change some defvars to defcustoms and commit it later today. Regards, Max
Re: [O] RFQ - new contribution - org-screenshot.el
Hi Max, Max Mikhanosha m...@openchat.com writes: I have committed org-screenshot to master This sounds like a great idea. And just to prove that no good deed goes unpunished, here is a bug report: In an org-mode file I run M-x org-screenshot-take, scrot runs and I can either click on a window or draw a selection box. However, lifting the mouse button leads to: error in process sentinel: Symbol's value as variable is void: return [2 times] An actual PNG is produced in the expected images/ subdir and also I confirm that running /usr/bin/scrot -s /path/to/file.png by hand works returning a 0 error code. My org is: Org-mode version 8.0.3 (8.0.3-elpa @ /home/bviren/.emacs.d/elpa/org-20130514/) Running in: GNU Emacs 24.1.1 (i486-pc-linux-gnu, GTK+ Version 2.24.10) of 2012-07-20 on murphy, modified by Debian I copied the org-screenshot.el you just pushed from git's contrib/ to my load path and added a (require 'org-screenshot) just after my (require 'org). The same behavior also occurs with the original copy you posted to this mailing list. A quick Google search just left me confused (I'm not great with elisp). Is there anything I can do to debug this further? Thanks, -Brett. pgpJZFNBqF1WX.pgp Description: PGP signature
Re: [O] RFQ - new contribution - org-screenshot.el
At Fri, 17 May 2013 13:20:16 -0400, Brett Viren wrote: Hi Max, Max Mikhanosha m...@openchat.com writes: I have committed org-screenshot to master This sounds like a great idea. And just to prove that no good deed goes unpunished, here is a bug report: In an org-mode file I run M-x org-screenshot-take, scrot runs and I can either click on a window or draw a selection box. However, lifting the mouse button leads to: error in process sentinel: Symbol's value as variable is void: return [2 times] Just committed a potential fix, can you see if it works? Commit 0d68eef0372b6b57359a49cb5e35b67c651c5ee2 If it does not work, I'll need you to give me a backtrace, instructions on how to are http://orgmode.org/manual/Feedback.html#Feedback around 1 page down under How to create a useful backtrace Regards, Max