Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Paste an image on clipboard to Emacs Org mode file without saving it

As I'm using the Emacs Org mode as a research log, sometime I want to keep track of something via screenshot images, and I definitely don't want to save them. So I'm wondering is there any way to insert those figures into my org mode file, like with word coping them from clipboard?

like image 334
lina Avatar asked Jul 02 '13 21:07

lina


People also ask

How do you insert a picture into Org mode?

With ctrl-drag-n-drop I want to add an attr_org line to set the image size, add a caption line, insert the image at the beginning of the line where the mouse cursor is, put the cursor on the caption line and then refresh the inline images in org-mode so the image is immediately visible.

How do I enter Org Mode in Emacs?

Emacs does not actually understand you are editing an Org document, yet. To enable Org mode on your current document, type M-x org-mode which will enable the Org mode on the current document. Those are minuses, not underscores.

Does Org mode come with Emacs?

Emacs has included Org Mode as a major mode by default since 2006. Bastien Guerry is the current maintainer, in cooperation with an active development community. Since its success in Emacs, some other systems now provide functions to work with org files.


1 Answers

The exact functionality you want isn't currently implemented, but I would be skeptical of saving lots of images into a research log if your opinion is that you "definitely don't want to save them."

Anyways, the functionality you desire has been expressed in the org-mode mailing list a couple of times in recent years - check

http://comments.gmane.org/gmane.emacs.orgmode/33770

http://www.mail-archive.com/[email protected]/msg50862.html

The first link includes some code to launch a screenshot utility (via ImageMagick) to [uniquely] save the file and insert an inline link in your org-mode buffer.

As stated in that thread, the code was improved upon and added to org-mode hacks page - which has lots of useful gems:

http://orgmode.org/worg/org-hacks.html

(defun my-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)) 
like image 199
assem Avatar answered Sep 19 '22 15:09

assem