emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] insert picture feature request.


From: Mark S.
Subject: Re: [O] insert picture feature request.
Date: Sun, 8 May 2011 19:05:13 -0700 (PDT)

Thanks Nick!

Revised code below with your help. Note that I've changed the name of function 
to reflect the fact that we're using the clipboard for the shot. Also, needed 
"file:" in the insert name for the inline images to view directly.

Note to Aankhen: To get inline images to work, you need to install the PNG and 
JPEG libraries from http://gnuwin32.sourceforge.net/ . Then put the resulting 
C:...gnuwin32/bin directory in your windows system path. Maybe everyone here 
already knew this, but I had to spend a bit of time to work it out.

Thanks!
Mark


(defun org-clipshot ()
  "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
       (convert-standard-filename
        (concat
         (make-temp-name
          (concat 
;;                  (buffer-file-name)
                 (file-name-directory (buffer-file-name))
                  "images/"
                 (file-name-nondirectory (buffer-file-name))
                  "_"
                  (format-time-string
                   "%Y%m%d_%H%M%S_")) ) ".png")))
  (call-process "C:\\Program Files\\IrfanView\\i_view32.exe" nil nil nil
                "/clippaste" (concat "/convert=" filename) )
  (insert (concat "[[file:" filename "]]"))
  (org-display-inline-images))




--- On Sun, 5/8/11, Nick Dokos <address@hidden> wrote:

> From: Nick Dokos <address@hidden>
> Subject: Re: [O] insert picture feature request.
> To: "Mark S." <address@hidden>
> Cc: address@hidden, address@hidden
> Date: Sunday, May 8, 2011, 4:11 PM
> Mark S. <address@hidden>
> wrote:
> 
> > Additional thought. Having all those pngs in the main
> directory will
> > get messy. I would like to put them in a sub-directory
> like
> > "images". But there doesn't seem to be an easy way to
> insert that into
> > (buffer-file-name). I've looked, but can't seem to be
> a variable that
> > just holds the current buffer directory. Where would I
> start?
> > 
> 
> C-h f file-name-directory <RET>
> C-h f file-name-nondirectory <RET>
> 
> Nick
> 
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]