Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
;; Edrx, 2004oct10 ;; (find-elnode "Examining Properties") ;; (find-elnode "Property Search") ;; (find-elnode "File Name Expansion") ;; (find-angg ".fvwm/edrx-menus.fvwm") (defun eeimage-extent-line () (list (save-excursion (beginning-of-line) (point)) (save-excursion (end-of-line) (point)))) (defun eeimage-extent-sexp () (list (save-excursion (eek-backward-sexp) (point)) (point))) (defun eeimage-extent-image (pos) (if (get-text-property pos 'display) (list (previous-single-property-change (1+ pos) 'display) (next-single-property-change pos 'display)))) (defun eeimage-data (fname) (with-temp-buffer (set-buffer-multibyte nil) (insert-file-contents-literally fname) (buffer-string))) (defun eeimage-edit () (interactive) (eev (format "echo 'import %s' > $EEVTMPDIR/ee.getrect\ninkscape %s &" (get-text-property (point) 'eeimage-fname-png) (get-text-property (point) 'eeimage-fname-svg)))) (defun eeimage-reload () (interactive) (let* ((se (eeimage-extent-image (point))) (s (nth 0 se)) (e (nth 1 se)) (data (eeimage-data (get-text-property (point) 'eeimage-fname-png)))) (add-text-properties s e `(display (image :type png :data ,data))))) (defun eeimage-quit () (interactive) (let* ((se (eeimage-extent-image (point))) (s (nth 0 se)) (e (nth 1 se))) (remove-text-properties s e '(display keymap eeimage-fname-png eeimage-fname-svg)))) (defun eeimage-svg-png (stemsvg &optional stempng) (let* ((se (eeimage-extent-sexp)) (s (nth 0 se)) (e (nth 1 se)) (fnamesvg (expand-file-name (concat stemsvg ".svg"))) (fnamepng (expand-file-name (concat (or stempng stemsvg) ".png")))) (add-text-properties s e `(display (image :type png :data ,(eeimage-data fnamepng)) keymap (keymap (?e . eeimage-edit) ; edit the svg (?r . eeimage-reload) ; reload the new png (?q . eeimage-quit) ; makes the image text again ) eeimage-fname-svg ,fnamesvg eeimage-fname-png ,fnamepng )))) ;; (find-sh "cd ~/IMAGES/; cp -v pipes1.{svg,png} /tmp/") ;; (eeimage-svg-png "/tmp/pipes1")