diff options
| author | Lars Ingebrigtsen | 2018-04-14 00:15:15 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2018-04-14 00:15:15 +0200 |
| commit | 3ba07bfc3ec43aa10d8e2d06a8f36f7022287573 (patch) | |
| tree | 605dfe8d532d1291fe7913799f5151505bdc0f92 | |
| parent | e442879b5a963a6eb37403fe09f476e7ee8e0f55 (diff) | |
| download | emacs-3ba07bfc3ec43aa10d8e2d06a8f36f7022287573.tar.gz emacs-3ba07bfc3ec43aa10d8e2d06a8f36f7022287573.zip | |
Move utility function to mm-util.el
* lisp/gnus/mm-util.el (mm-images-in-region-p): Move from
mm-decode.el and renamed, since it is generally useful.
| -rw-r--r-- | lisp/gnus/mm-decode.el | 15 | ||||
| -rw-r--r-- | lisp/gnus/mm-util.el | 13 |
2 files changed, 14 insertions, 14 deletions
diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el index d8753e5a1d5..69fc770ec72 100644 --- a/lisp/gnus/mm-decode.el +++ b/lisp/gnus/mm-decode.el | |||
| @@ -1856,7 +1856,7 @@ text/html;\\s-*charset=\\([^\t\n\r \"'>]+\\)[^>]*>" nil t) | |||
| 1856 | 'url-link start end | 1856 | 'url-link start end |
| 1857 | :help-echo (get-text-property start 'help-echo) | 1857 | :help-echo (get-text-property start 'help-echo) |
| 1858 | :keymap (setq keymap (copy-keymap | 1858 | :keymap (setq keymap (copy-keymap |
| 1859 | (if (mm--images-in-region-p start end) | 1859 | (if (mm-images-in-region-p start end) |
| 1860 | shr-image-map | 1860 | shr-image-map |
| 1861 | shr-map))) | 1861 | shr-map))) |
| 1862 | (get-text-property start 'shr-url)) | 1862 | (get-text-property start 'shr-url)) |
| @@ -1874,19 +1874,6 @@ text/html;\\s-*charset=\\([^\t\n\r \"'>]+\\)[^>]*>" nil t) | |||
| 1874 | (overlay-put overlay 'face nil)) | 1874 | (overlay-put overlay 'face nil)) |
| 1875 | (setq start end))))) | 1875 | (setq start end))))) |
| 1876 | 1876 | ||
| 1877 | (defun mm--images-in-region-p (start end) | ||
| 1878 | (let ((found nil)) | ||
| 1879 | (save-excursion | ||
| 1880 | (goto-char start) | ||
| 1881 | (while (and (not found) | ||
| 1882 | (< (point) end)) | ||
| 1883 | (let ((display (get-text-property (point) 'display))) | ||
| 1884 | (when (and (consp display) | ||
| 1885 | (eq (car display) 'image)) | ||
| 1886 | (setq found t))) | ||
| 1887 | (forward-char 1))) | ||
| 1888 | found)) | ||
| 1889 | |||
| 1890 | (defun mm-handle-filename (handle) | 1877 | (defun mm-handle-filename (handle) |
| 1891 | "Return filename of HANDLE if any." | 1878 | "Return filename of HANDLE if any." |
| 1892 | (or (mail-content-type-get (mm-handle-type handle) | 1879 | (or (mail-content-type-get (mm-handle-type handle) |
diff --git a/lisp/gnus/mm-util.el b/lisp/gnus/mm-util.el index 98f993367ef..42c2f3ab155 100644 --- a/lisp/gnus/mm-util.el +++ b/lisp/gnus/mm-util.el | |||
| @@ -882,6 +882,19 @@ gzip, bzip2, etc. are allowed." | |||
| 882 | (when decomp | 882 | (when decomp |
| 883 | (kill-buffer (current-buffer))))))) | 883 | (kill-buffer (current-buffer))))))) |
| 884 | 884 | ||
| 885 | (defun mm-images-in-region-p (start end) | ||
| 886 | (let ((found nil)) | ||
| 887 | (save-excursion | ||
| 888 | (goto-char start) | ||
| 889 | (while (and (not found) | ||
| 890 | (< (point) end)) | ||
| 891 | (let ((display (get-text-property (point) 'display))) | ||
| 892 | (when (and (consp display) | ||
| 893 | (eq (car display) 'image)) | ||
| 894 | (setq found t))) | ||
| 895 | (forward-char 1))) | ||
| 896 | found)) | ||
| 897 | |||
| 885 | (provide 'mm-util) | 898 | (provide 'mm-util) |
| 886 | 899 | ||
| 887 | ;;; mm-util.el ends here | 900 | ;;; mm-util.el ends here |