From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Mark S." Subject: Re: insert picture feature request. Date: Sun, 8 May 2011 19:05:13 -0700 (PDT) Message-ID: <52439.46653.qm@web32007.mail.mud.yahoo.com> References: <22031.1304896279@alphaville.dokosmarshall.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([140.186.70.92]:42894) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QJFqW-0007nV-Vz for emacs-orgmode@gnu.org; Sun, 08 May 2011 22:05:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QJFqV-00026l-Su for emacs-orgmode@gnu.org; Sun, 08 May 2011 22:05:16 -0400 Received: from nm12-vm0.bullet.mail.ac4.yahoo.com ([98.139.53.198]:34372) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1QJFqV-00026c-O1 for emacs-orgmode@gnu.org; Sun, 08 May 2011 22:05:15 -0400 In-Reply-To: <22031.1304896279@alphaville.dokosmarshall.org> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: nicholas.dokos@hp.com Cc: emacs-orgmode@gnu.org 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 wrote: > From: Nick Dokos > Subject: Re: [O] insert picture feature request. > To: "Mark S." > Cc: nicholas.dokos@hp.com, emacs-orgmode@gnu.org > Date: Sunday, May 8, 2011, 4:11 PM > Mark S. > 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 > C-h f file-name-nondirectory > > Nick > >