06/12/08 19:24:35
>>204 むーぅ、その方がiimage-modeがトグルできて都合がいいですね!
とりあえず、howm-iimage 改め howm-extract-image
(defun howm-extract-image ()
(interactive)
(let (imagename encoding content)
(set (make-local-variable 'howm-image-del-list) nil)
(save-excursion
(beginning-of-buffer)
(while (re-search-forward
(concat "---image-" "\\(.+\\)"
"-encoding-" "\\(.+\\)" "-content-start---\n")
nil t)
(setq imagename (match-string 1))
(setq encoding (match-string 2))
(let ((start (point)))
(re-search-forward
(concat "---image-" imagename
"-encoding-" encoding "-content-end---\n")
nil t)
(unless (file-exists-p imagename)
(mime-write-decoded-region
start (match-beginning 0) imagename encoding)
(add-to-list 'howm-image-del-list imagename))))
(iimage-mode)
(make-local-hook 'kill-buffer-hook)
(add-hook 'kill-buffer-hook
(function (lambda () (mapcar 'delete-file howm-image-del-list)))
nil t))))