emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] Re: inline images


From: gregory mitchell
Subject: Re: [Orgmode] Re: inline images
Date: Mon, 6 Oct 2008 19:50:43 -0700

Hey all,

my first post to this list.  This topic has been bugging me for some time also.

The following is a snippet of elisp that can be used to take a file
name in a buffer and paste the image file right below it.  The image
is inserted just as any other character, and can be moved, yanked,
copied and/or pasted as such.

This only works for png, but it's easy enough to modify for jpeg, etc
as well.  I often use this method in combination with various other
things to generate postscript/pstricks/latex diagrams, etc, and view
the results immediately.



(global-set-key (kbd "C-S-p") 'insert-png-wrapper)
(defun insert-png-wrapper ()
  (interactive)
  (setq oldmark (mark)) ; save old mark
  (setq oldpoint (point))  ; and old point
  (beginning-of-line)
  (set-mark (point))     (end-of-line)
  (setq filename (buffer-substring (mark) (point)))  ; copy line
  (newline 1)
        (clear-image-cache)  ; images are cached until cleared
        (insert-image (create-image filename 'png))
  )


If you load "eimp.el" as a minor mode, you can use the functions
"eimp-increase-image-size" and "eimp-decrease-image-size" to make the
image smaller or larger.

There's my 2.5 cents.  Cheers.




reply via email to

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