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?
相关问题
- Symbol's function definition is void: declare-
- How can I set the SVN password with Emacs 23.1 bui
- Emacs shell: save commit message
- How to take screenshots of running iPhone from bac
- How to scale down the size and quality of an Buffe
相关文章
- ess-rdired: I get this error “no ESS process is as
- Emacs/xterm color annoyance on Linux
- Pipe less to Emacs
- Capturing the output of “diff” with org-babel
- emacs terminal mode: how to copy and paste efficie
- How to permanently enable the hs-minor-mode in ema
- Error while executing adb command programmatically
- Pipe emacs shell output to a new buffer
For Windows 10 users, I modified the answer provided by @assem to work with out-of-the-box tools:
The whole write-up can be found here
The answers here focus on initiating the process within emacs. An alternative, on macos, is to place a screenshot image on the system clipboard using cmd-ctl-shift-4, and then to return to Emacs and use emacs lisp to call pngpaste to write the image from clipboard to file, and do whatever you need to with the image file (insert into org, LaTeX, or as a native Emacs inline image etc).
For example, to insert into org:
The org-download package is designed for this.
For OS X users. The following compliments Assem's answer.
The
import
command was not working for me, so I swapped it toscreencapture
with an-i
argument. I also find it more convenient to use a relative path for the link rather than the absolute.Update: Improvements
I have recently improved on the script a little. It now places screenshots in a subdirectory, creates the directory if required, and only inserts the link into emacs if the image was actually created (i.e., does nothing if you hit ESC). It also works on both Ubuntu and OS X.
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/emacs-orgmode@gnu.org/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
My solution is for the Windows platform. Many thanks to Assem for giving his solution on which I based mine.
I wrote a C# console app
CbImage2File
that writes the image on the clipboard (if there is one) to a path given as the command line argument. You will need a reference toSystem.Windows.Forms
assembly.I use Greenshot to take the screenshot, which (via its configuration) automatically copies the screenshot to the clipboard.
I then use a shortcut
C-S-v
to paste the image in the org mode buffer using the functionorg-insert-image-from-clipboard
:This function will work out a file path, then invoke the C# app to create
png
file, then it will add the image tag and then callorg-display-inline-images
to show the image. If there is no image on the clipboard, it will paste in the response from the C# app.