回答:
別のバッファに表示されている画像を気にしない場合は、
M-x ffap
現在のバッファに表示される画像を主張する場合は、もう少し作業を行う必要があります。
(require 'url)
(defun insert-image-from-url (&optional url)
(interactive)
(unless url (setq url (url-get-url-at-point)))
(unless url
(error "Couldn't find URL."))
(let ((buffer (url-retrieve-synchronously url)))
(unwind-protect
(let ((data (with-current-buffer buffer
(goto-char (point-min))
(search-forward "\n\n")
(buffer-substring (point) (point-max)))))
(insert-image (create-image data nil t)))
(kill-buffer buffer))))
(require 'url)
です。
次の書き換えられた関数を使用して、Orgモードでインライン画像とWeb画像(インライン画像を表示する方法とまったく同じ)を表示できます(作業環境がOrgモードの場合)。
任意の拡張が可能です。もちろん、インライン画像を表示することはできますが、わずかな変更でサムファイルを生成することはできません。しかし、私は上記の方法を好みます。
(defun org-display-inline-images (&optional include-linked refresh beg end)
"Display inline and url images.
Normally only links without a description part are inlined, because this
is how it will work for export. When INCLUDE-LINKED is set, also links
with a description part will be inlined. This
can be nice for a quick
look at those images, but it does not reflect what exported files will look
like.
When REFRESH is set, refresh existing images between BEG and END.
This will create new image displays only if necessary.
BEG and END default to the buffer boundaries."
(interactive "P")
(unless refresh
(org-remove-inline-images)
(if (fboundp 'clear-image-cache) (clear-image-cache)))
(save-excursion
(save-restriction
(widen)
(setq beg (or beg (point-min)) end (or end (point-max)))
(goto-char beg)
(let ((re (concat "\\(\\(http\\)\\|\\(\\[\\[\\(\\(file:\\)\\|\\([./~]\\)\\)\\)\\)\\([^]\n]+?"
(substring (org-image-file-name-regexp) 0 -2)
"\\)" (format "\\(\\(\\]%s\\)\\|\\)" (if include-linked "" "\\]"))))
old file ov img width point-begin point-end)
(while (re-search-forward re end t)
(setq old (get-char-property-and-overlay (match-beginning 1)
'org-image-overlay)
match (match-string-no-properties 0)
point-begin (match-beginning 0)
point-end (match-end 0))
(if (s-starts-with? "http" match)
(save-excursion
(let* ((buffer (url-retrieve-synchronously match))
(unwind-protect
(let ((data (with-current-buffer buffer
(goto-char (point-min))
(search-forward "\n\n")
(buffer-substring (point) (point-max)))))
(require 'image+)
(setq img (imagex--fit-to-size (create-image data 'jpeg t) 400 400)))))))
(setq file (expand-file-name
(concat (or (match-string 6) "") (match-string 7)))
width (if (eq (car (org-element-property :parent (org-element-at-point))) 'table) 200 400))
(when (file-exists-p file)
(let ((file-thumb (format "%s%s_thumb.png" (file-name-directory file) (file-name-base file))))
(if (file-exists-p file-thumb)
(let ((thumb-time (nth 5 (file-attributes file-thumb 'string)))
(file-time (nth 5 (file-attributes file 'string))))
(if (time-less-p thumb-time file-time)
(shell-command (format org-imagemagick-display-command
file width width file-thumb) nil nil)))
(shell-command (format org-imagemagick-display-command
file width width file-thumb) nil nil))
(if (and (car-safe old) refresh)
(image-refresh (overlay-get (cdr old) 'display))
(setq img (save-match-data (create-image file-thumb)))))))
(when img
(setq ov (make-overlay point-begin point-end))
(overlay-put ov 'display img)
(overlay-put ov 'face 'default)
(overlay-put ov 'org-image-overlay t)
(overlay-put ov 'modification-hooks
(list 'org-display-inline-remove-overlay))
(push ov org-inline-image-overlays)))))))