aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGnus developers2010-10-30 05:59:34 +0000
committerKatsumi Yamaoka2010-10-30 05:59:34 +0000
commit99e65b2d2e79edf3ed0c4f00916098d4ea3767f4 (patch)
tree700dfa334160dd15bd301528982a1f53a734ffc9
parent88f43c67491e301d5e0fe4476d1a7203c64a3762 (diff)
downloademacs-99e65b2d2e79edf3ed0c4f00916098d4ea3767f4.tar.gz
emacs-99e65b2d2e79edf3ed0c4f00916098d4ea3767f4.zip
Merge changes made in Gnus trunk.
gnus.el: Remove `gnus-nntp-service' variable. gnus.el: Make gnus-nntp-server and gnus-secondary-servers obsolete. gnus-sum.el (gnus-summary-delete-marked-as-read, gnus-summary-delete-marked-with): Remove obsolete defalias. gnus.el (gnus-use-long-file-name): Fix docstring. nnimap.el (nnimap-open-connection): Use AUTHENTICATE PLAIN on servers that say they support that. gnus-msg.el (gnus-inews-do-gcc): Don't have the backends do the slow *-request-group, which seems unnecessary. gnus-group.el (gnus-group-get-new-news-this-group): Don't have point move to the previous line on `M-g'. nnimap.el (nnimap-split-incoming-mail): Note that the INBOX has been selected. nnimap.el: Allow the user to say whether to split old messages or not in nnimap. shr.el (shr-tag-table-1): Only insert the images after the top-level table. shr.el (shr-tag-span): Drop colorisation of regions since we don't control the background color. shr.el (shr-tag-img): Ignore very small web bug type images. shr.el (shr-put-image): Add help-echo alt texts to the images. shr.el (shr-tag-video): Show the video poster image.
-rw-r--r--doc/misc/ChangeLog12
-rw-r--r--doc/misc/gnus.texi27
-rw-r--r--lisp/gnus/ChangeLog45
-rw-r--r--lisp/gnus/gnus-group.el2
-rw-r--r--lisp/gnus/gnus-int.el2
-rw-r--r--lisp/gnus/gnus-msg.el2
-rw-r--r--lisp/gnus/gnus-sum.el8
-rw-r--r--lisp/gnus/gnus-util.el8
-rw-r--r--lisp/gnus/gnus.el40
-rw-r--r--lisp/gnus/nnimap.el34
-rw-r--r--lisp/gnus/shr.el65
11 files changed, 152 insertions, 93 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog
index 587bbba3159..f1401cca9b7 100644
--- a/doc/misc/ChangeLog
+++ b/doc/misc/ChangeLog
@@ -1,3 +1,13 @@
12010-10-29 Lars Magne Ingebrigtsen <larsi@gnus.org>
2
3 * gnus.texi (Client-Side IMAP Splitting): Mention
4 nnimap-unsplittable-articles.
5
62010-10-29 Julien Danjou <julien@danjou.info>
7
8 * gnus.texi (Finding the News): Remove references to obsoletes
9 variables `gnus-nntp-server' and `gnus-secondary-servers'.
10
12010-10-29 Eli Zaretskii <eliz@gnu.org> 112010-10-29 Eli Zaretskii <eliz@gnu.org>
2 12
3 * makefile.w32-in (MAKEINFO): Add -I$(emacsdir). 13 * makefile.w32-in (MAKEINFO): Add -I$(emacsdir).
@@ -19,7 +29,7 @@
19 29
202010-10-24 Jay Belanger <jay.p.belanger@gmail.com> 302010-10-24 Jay Belanger <jay.p.belanger@gmail.com>
21 31
22 * calc.texi: Use emacsver.texi to determine Emacs version. 32 * calc.texi: Use emacsver.texi to determine Emacs version.
23 33
242010-10-24 Juanma Barranquero <lekktu@gmail.com> 342010-10-24 Juanma Barranquero <lekktu@gmail.com>
25 35
diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
index e0a3ca280b5..0afb57afd17 100644
--- a/doc/misc/gnus.texi
+++ b/doc/misc/gnus.texi
@@ -1020,22 +1020,6 @@ Gnus will see whether @code{gnus-nntpserver-file}
1020If that fails as well, Gnus will try to use the machine running Emacs 1020If that fails as well, Gnus will try to use the machine running Emacs
1021as an @acronym{NNTP} server. That's a long shot, though. 1021as an @acronym{NNTP} server. That's a long shot, though.
1022 1022
1023@vindex gnus-nntp-server
1024If @code{gnus-nntp-server} is set, this variable will override
1025@code{gnus-select-method}. You should therefore set
1026@code{gnus-nntp-server} to @code{nil}, which is what it is by default.
1027
1028@vindex gnus-secondary-servers
1029@vindex gnus-nntp-server
1030You can also make Gnus prompt you interactively for the name of an
1031@acronym{NNTP} server. If you give a non-numerical prefix to @code{gnus}
1032(i.e., @kbd{C-u M-x gnus}), Gnus will let you choose between the servers
1033in the @code{gnus-secondary-servers} list (if any). You can also just
1034type in the name of any server you feel like visiting. (Note that this
1035will set @code{gnus-nntp-server}, which means that if you then @kbd{M-x
1036gnus} later in the same Emacs session, Gnus will contact the same
1037server.)
1038
1039@findex gnus-group-browse-foreign-server 1023@findex gnus-group-browse-foreign-server
1040@kindex B (Group) 1024@kindex B (Group)
1041However, if you use one @acronym{NNTP} server regularly and are just 1025However, if you use one @acronym{NNTP} server regularly and are just
@@ -14945,6 +14929,11 @@ use the value of the @code{nnmail-split-methods} variable.
14945@item nnimap-split-fancy 14929@item nnimap-split-fancy
14946Uses the same syntax as @code{nnmail-split-fancy}. 14930Uses the same syntax as @code{nnmail-split-fancy}.
14947 14931
14932@item nnimap-unsplittable-articles
14933List of flag symbols to ignore when doing splitting. That is,
14934articles that have these flags won't be considered when splitting.
14935The default is @samp{(%Deleted %Seen)}.
14936
14948@end table 14937@end table
14949 14938
14950 14939
@@ -30102,11 +30091,11 @@ that means:
30102(setq gnus-read-active-file 'some) 30091(setq gnus-read-active-file 'some)
30103@end lisp 30092@end lisp
30104 30093
30105On the other hand, if the manual says ``set @code{gnus-nntp-server} to 30094On the other hand, if the manual says ``set @code{gnus-nntp-server-file} to
30106@samp{nntp.ifi.uio.no}'', that means: 30095@samp{/etc/nntpserver}'', that means:
30107 30096
30108@lisp 30097@lisp
30109(setq gnus-nntp-server "nntp.ifi.uio.no") 30098(setq gnus-nntp-server-file "/etc/nntpserver")
30110@end lisp 30099@end lisp
30111 30100
30112So be careful not to mix up strings (the latter) with symbols (the 30101So be careful not to mix up strings (the latter) with symbols (the
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index a56fe89b818..00451f7e6bd 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,5 +1,50 @@
12010-10-30 Lars Magne Ingebrigtsen <larsi@gnus.org>
2
3 * shr.el (shr-tag-span): Drop colorisation of regions since we don't
4 control the background color.
5 (shr-tag-img): Ignore very small web bug type images.
6 (shr-put-image): Add help-echo alt texts to the images.
7 (shr-tag-video): Show the video poster image.
8
92010-10-29 Lars Magne Ingebrigtsen <larsi@gnus.org>
10
11 * shr.el (shr-table-depth): New variable.
12 (shr-tag-table-1): Only insert the images after the top-level table.
13
14 * nnimap.el (nnimap-split-incoming-mail): Fix typo.
15
16 * gnus-util.el (gnus-list-memq-of-list): New function.
17
18 * nnimap.el (nnimap-split-incoming-mail): Note that the INBOX has been
19 selected.
20 (nnimap-unsplittable-articles): New slot.
21 (nnimap-new-articles): Use it.
22
232010-10-29 Stephen Berman <stephen.berman@gmx.net> (tiny change)
24
25 * gnus-group.el (gnus-group-get-new-news-this-group): Don't have point
26 move to the previous line on `M-g'.
27
282010-10-29 Lars Magne Ingebrigtsen <larsi@gnus.org>
29
30 * gnus-msg.el (gnus-inews-do-gcc): Don't have the backends do the slow
31 *-request-group, which seems unnecessary.
32
33 * nnimap.el (nnimap-quote-specials): Function copied over from
34 imap.el.
35 (nnimap-open-connection): Use AUTHENTICATE PLAIN on servers that say
36 they support that. Suggested by Tom Regner.
37
12010-10-29 Julien Danjou <julien@danjou.info> 382010-10-29 Julien Danjou <julien@danjou.info>
2 39
40 * gnus-sum.el (gnus-summary-delete-marked-as-read): Remove obsolete
41 defalias.
42 (gnus-summary-delete-marked-with): Remove obsolete defalias.
43
44 * gnus.el: Remove `gnus-nntp-service' variable.
45 (gnus-secondary-servers): Make obsolete.
46 (gnus-nntp-server): Make obsolete.
47
3 * gnus-start.el (gnus-1): Remove x-splash calls. 48 * gnus-start.el (gnus-1): Remove x-splash calls.
4 49
5 * gnus-ems.el (gnus-x-splash): Remove. 50 * gnus-ems.el (gnus-x-splash): Remove.
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index a777beb7485..83951834424 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -3988,7 +3988,7 @@ If DONT-SCAN is non-nil, scan non-activated groups as well."
3988 (let* ((groups (gnus-group-process-prefix n)) 3988 (let* ((groups (gnus-group-process-prefix n))
3989 (ret (if (numberp n) (- n (length groups)) 0)) 3989 (ret (if (numberp n) (- n (length groups)) 0))
3990 (beg (unless n 3990 (beg (unless n
3991 (point))) 3991 (point-marker)))
3992 group method 3992 group method
3993 (gnus-inhibit-demon t) 3993 (gnus-inhibit-demon t)
3994 ;; Binding this variable will inhibit multiple fetchings 3994 ;; Binding this variable will inhibit multiple fetchings
diff --git a/lisp/gnus/gnus-int.el b/lisp/gnus/gnus-int.el
index 318cdfebda2..b344a5ef15c 100644
--- a/lisp/gnus/gnus-int.el
+++ b/lisp/gnus/gnus-int.el
@@ -100,8 +100,6 @@ If CONFIRM is non-nil, the user will be asked for an NNTP server."
100 ;; Stream is already opened. 100 ;; Stream is already opened.
101 nil 101 nil
102 ;; Open NNTP server. 102 ;; Open NNTP server.
103 (unless gnus-nntp-service
104 (setq gnus-nntp-server nil))
105 (when confirm 103 (when confirm
106 ;; Read server name with completion. 104 ;; Read server name with completion.
107 (setq gnus-nntp-server 105 (setq gnus-nntp-server
diff --git a/lisp/gnus/gnus-msg.el b/lisp/gnus/gnus-msg.el
index a3c5112ee41..a7d67113b31 100644
--- a/lisp/gnus/gnus-msg.el
+++ b/lisp/gnus/gnus-msg.el
@@ -1628,7 +1628,7 @@ this is a reply."
1628 (unless (gnus-check-server method) 1628 (unless (gnus-check-server method)
1629 (error "Can't open server %s" (if (stringp method) method 1629 (error "Can't open server %s" (if (stringp method) method
1630 (car method)))) 1630 (car method))))
1631 (unless (gnus-request-group group nil method) 1631 (unless (gnus-request-group group t method)
1632 (gnus-request-create-group group method)) 1632 (gnus-request-create-group group method))
1633 (setq mml-externalize-attachments 1633 (setq mml-externalize-attachments
1634 (if (stringp gnus-gcc-externalize-attachments) 1634 (if (stringp gnus-gcc-externalize-attachments)
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index 60e3cc83d7f..85fe9f2538f 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -8303,10 +8303,6 @@ articles that are younger than AGE days."
8303 (gnus-summary-limit articles)) 8303 (gnus-summary-limit articles))
8304 (gnus-summary-position-point)) 8304 (gnus-summary-position-point))
8305 8305
8306(defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
8307(make-obsolete
8308 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread "Emacs 20.4")
8309
8310(defun gnus-summary-limit-to-unread (&optional all) 8306(defun gnus-summary-limit-to-unread (&optional all)
8311 "Limit the summary buffer to articles that are not marked as read. 8307 "Limit the summary buffer to articles that are not marked as read.
8312If ALL is non-nil, limit strictly to unread articles." 8308If ALL is non-nil, limit strictly to unread articles."
@@ -8397,10 +8393,6 @@ If UNREPLIED (the prefix), limit to unreplied articles."
8397 (gnus-summary-limit gnus-newsgroup-replied)) 8393 (gnus-summary-limit gnus-newsgroup-replied))
8398 (gnus-summary-position-point)) 8394 (gnus-summary-position-point))
8399 8395
8400(defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
8401(make-obsolete 'gnus-summary-delete-marked-with
8402 'gnus-summary-limit-exclude-marks "Emacs 20.4")
8403
8404(defun gnus-summary-limit-exclude-marks (marks &optional reverse) 8396(defun gnus-summary-limit-exclude-marks (marks &optional reverse)
8405 "Exclude articles that are marked with MARKS (e.g. \"DK\"). 8397 "Exclude articles that are marked with MARKS (e.g. \"DK\").
8406If REVERSE, limit the summary buffer to articles that are marked 8398If REVERSE, limit the summary buffer to articles that are marked
diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el
index 1a09e04193b..5bcda97ab1a 100644
--- a/lisp/gnus/gnus-util.el
+++ b/lisp/gnus/gnus-util.el
@@ -1974,6 +1974,14 @@ Sizes are in pixels."
1974 image))) 1974 image)))
1975 image))) 1975 image)))
1976 1976
1977(defun gnus-list-memq-of-list (elements list)
1978 "Return non-nil if any of the members of ELEMENTS are in LIST."
1979 (let ((found nil))
1980 (dolist (elem elements)
1981 (setq found (or found
1982 (memq elem list))))
1983 found))
1984
1977(provide 'gnus-util) 1985(provide 'gnus-util)
1978 1986
1979;;; gnus-util.el ends here 1987;;; gnus-util.el ends here
diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el
index baed48d7733..ab0d3b3e59a 100644
--- a/lisp/gnus/gnus.el
+++ b/lisp/gnus/gnus.el
@@ -1256,15 +1256,6 @@ by the user.
1256If you want to change servers, you should use `gnus-select-method'. 1256If you want to change servers, you should use `gnus-select-method'.
1257See the documentation to that variable.") 1257See the documentation to that variable.")
1258 1258
1259;; Don't touch this variable.
1260(defvar gnus-nntp-service "nntp"
1261 "NNTP service name (\"nntp\" or 119).
1262This is an obsolete variable, which is scarcely used. If you use an
1263nntp server for your newsgroup and want to change the port number
1264used to 899, you would say something along these lines:
1265
1266 (setq gnus-select-method '(nntp \"my.nntp.server\" (nntp-port-number 899)))")
1267
1268(defcustom gnus-nntpserver-file "/etc/nntpserver" 1259(defcustom gnus-nntpserver-file "/etc/nntpserver"
1269 "A file with only the name of the nntp server in it." 1260 "A file with only the name of the nntp server in it."
1270 :group 'gnus-files 1261 :group 'gnus-files
@@ -1288,20 +1279,11 @@ Check the NNTPSERVER environment variable and the
1288;;;###autoload (custom-autoload 'gnus-select-method "gnus")) 1279;;;###autoload (custom-autoload 'gnus-select-method "gnus"))
1289 1280
1290(defcustom gnus-select-method 1281(defcustom gnus-select-method
1291 (condition-case nil 1282 (list 'nntp (or (gnus-getenv-nntpserver)
1292 (nconc 1283 (when (and gnus-default-nntp-server
1293 (list 'nntp (or (condition-case nil 1284 (not (string= gnus-default-nntp-server "")))
1294 (gnus-getenv-nntpserver) 1285 gnus-default-nntp-server)
1295 (error nil)) 1286 "news"))
1296 (when (and gnus-default-nntp-server
1297 (not (string= gnus-default-nntp-server "")))
1298 gnus-default-nntp-server)
1299 "news"))
1300 (if (or (null gnus-nntp-service)
1301 (equal gnus-nntp-service "nntp"))
1302 nil
1303 (list gnus-nntp-service)))
1304 (error nil))
1305 "Default method for selecting a newsgroup. 1287 "Default method for selecting a newsgroup.
1306This variable should be a list, where the first element is how the 1288This variable should be a list, where the first element is how the
1307news is to be fetched, the second is the address. 1289news is to be fetched, the second is the address.
@@ -1386,14 +1368,14 @@ To make Gnus query you for a server, you have to give `gnus' a
1386non-numeric prefix - `C-u M-x gnus', in short." 1368non-numeric prefix - `C-u M-x gnus', in short."
1387 :group 'gnus-server 1369 :group 'gnus-server
1388 :type '(repeat string)) 1370 :type '(repeat string))
1371(make-obsolete-variable 'gnus-secondary-servers 'gnus-select-method "24.1")
1389 1372
1390(defcustom gnus-nntp-server nil 1373(defcustom gnus-nntp-server nil
1391 "*The name of the host running the NNTP server. 1374 "The name of the host running the NNTP server."
1392This variable is semi-obsolete. Use the `gnus-select-method'
1393variable instead."
1394 :group 'gnus-server 1375 :group 'gnus-server
1395 :type '(choice (const :tag "disable" nil) 1376 :type '(choice (const :tag "disable" nil)
1396 string)) 1377 string))
1378(make-obsolete-variable 'gnus-nntp-server 'gnus-select-method "24.1")
1397 1379
1398(defcustom gnus-secondary-select-methods nil 1380(defcustom gnus-secondary-select-methods nil
1399 "A list of secondary methods that will be used for reading news. 1381 "A list of secondary methods that will be used for reading news.
@@ -1492,7 +1474,7 @@ Also see `gnus-large-ephemeral-newsgroup'."
1492 integer)) 1474 integer))
1493 1475
1494(defcustom gnus-use-long-file-name (not (memq system-type '(usg-unix-v))) 1476(defcustom gnus-use-long-file-name (not (memq system-type '(usg-unix-v)))
1495 "*Non-nil means that the default name of a file to save articles in is the group name. 1477 "Non-nil means that the default name of a file to save articles in is the group name.
1496If it's nil, the directory form of the group name is used instead. 1478If it's nil, the directory form of the group name is used instead.
1497 1479
1498If this variable is a list, and the list contains the element 1480If this variable is a list, and the list contains the element
@@ -1502,8 +1484,8 @@ saving; and if it contains the element `not-kill', long file names
1502will not be used for kill files. 1484will not be used for kill files.
1503 1485
1504Note that the default for this variable varies according to what system 1486Note that the default for this variable varies according to what system
1505type you're using. On `usg-unix-v' and `xenix' this variable defaults 1487type you're using. On `usg-unix-v' this variable defaults to nil while
1506to nil while on all other systems it defaults to t." 1488on all other systems it defaults to t."
1507 :group 'gnus-start 1489 :group 'gnus-start
1508 :type '(radio (sexp :format "Non-nil\n" 1490 :type '(radio (sexp :format "Non-nil\n"
1509 :match (lambda (widget value) 1491 :match (lambda (widget value)
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el
index 8ea50632a55..37956058f0e 100644
--- a/lisp/gnus/nnimap.el
+++ b/lisp/gnus/nnimap.el
@@ -78,6 +78,9 @@ Uses the same syntax as nnmail-split-methods")
78(defvoo nnimap-split-fancy nil 78(defvoo nnimap-split-fancy nil
79 "Uses the same syntax as nnmail-split-fancy.") 79 "Uses the same syntax as nnmail-split-fancy.")
80 80
81(defvoo nnimap-unsplittable-articles '(%Deleted %Seen)
82 "Articles with the flags in the list will not be considered when splitting.")
83
81(make-obsolete-variable 'nnimap-split-rule "see `nnimap-split-methods'" 84(make-obsolete-variable 'nnimap-split-rule "see `nnimap-split-methods'"
82 "Emacs 24.1") 85 "Emacs 24.1")
83 86
@@ -412,9 +415,18 @@ textual parts.")
412 ;; physical address. 415 ;; physical address.
413 (nnimap-credentials nnimap-address ports))))) 416 (nnimap-credentials nnimap-address ports)))))
414 (setq nnimap-object nil) 417 (setq nnimap-object nil)
415 (setq login-result (nnimap-command "LOGIN %S %S" 418 (setq login-result
416 (car credentials) 419 (if (member "AUTH=PLAIN"
417 (cadr credentials))) 420 (nnimap-capabilities nnimap-object))
421 (nnimap-command
422 "AUTHENTICATE PLAIN %s"
423 (base64-encode-string
424 (format "\000%s\000%s"
425 (nnimap-quote-specials (car credentials))
426 (nnimap-quote-specials (cadr credentials)))))
427 (nnimap-command "LOGIN %S %S"
428 (car credentials)
429 (cadr credentials))))
418 (unless (car login-result) 430 (unless (car login-result)
419 ;; If the login failed, then forget the credentials 431 ;; If the login failed, then forget the credentials
420 ;; that are now possibly cached. 432 ;; that are now possibly cached.
@@ -431,6 +443,16 @@ textual parts.")
431 (nnimap-command "ENABLE QRESYNC")) 443 (nnimap-command "ENABLE QRESYNC"))
432 (nnimap-process nnimap-object)))))))) 444 (nnimap-process nnimap-object))))))))
433 445
446(defun nnimap-quote-specials (string)
447 (with-temp-buffer
448 (insert string)
449 (goto-char (point-min))
450 (while (re-search-forward "[\\\"]" nil t)
451 (forward-char -1)
452 (insert "\\")
453 (forward-char 1))
454 (buffer-string)))
455
434(defun nnimap-find-parameter (parameter elems) 456(defun nnimap-find-parameter (parameter elems)
435 (let (result) 457 (let (result)
436 (dolist (elem elems) 458 (dolist (elem elems)
@@ -1593,6 +1615,7 @@ textual parts.")
1593 new-articles) 1615 new-articles)
1594 (erase-buffer) 1616 (erase-buffer)
1595 (nnimap-command "SELECT %S" nnimap-inbox) 1617 (nnimap-command "SELECT %S" nnimap-inbox)
1618 (setf (nnimap-group nnimap-object) nnimap-inbox)
1596 (setq new-articles (nnimap-new-articles (nnimap-get-flags "1:*"))) 1619 (setq new-articles (nnimap-new-articles (nnimap-get-flags "1:*")))
1597 (when new-articles 1620 (when new-articles
1598 (nnimap-fetch-inbox new-articles) 1621 (nnimap-fetch-inbox new-articles)
@@ -1665,9 +1688,8 @@ textual parts.")
1665(defun nnimap-new-articles (flags) 1688(defun nnimap-new-articles (flags)
1666 (let (new) 1689 (let (new)
1667 (dolist (elem flags) 1690 (dolist (elem flags)
1668 (when (or (null (cdr elem)) 1691 (unless (gnus-list-memq-of-list nnimap-unsplittable-articles
1669 (and (not (memq '%Deleted (cdr elem))) 1692 (cdr elem))
1670 (not (memq '%Seen (cdr elem)))))
1671 (push (car elem) new))) 1693 (push (car elem) new)))
1672 (gnus-compress-sequence (nreverse new)))) 1694 (gnus-compress-sequence (nreverse new))))
1673 1695
diff --git a/lisp/gnus/shr.el b/lisp/gnus/shr.el
index 8bb532eb27e..bbb7ff18a46 100644
--- a/lisp/gnus/shr.el
+++ b/lisp/gnus/shr.el
@@ -90,6 +90,7 @@ cid: URL as the argument.")
90(defvar shr-list-mode nil) 90(defvar shr-list-mode nil)
91(defvar shr-content-cache nil) 91(defvar shr-content-cache nil)
92(defvar shr-kinsoku-shorten nil) 92(defvar shr-kinsoku-shorten nil)
93(defvar shr-table-depth 0)
93 94
94(defvar shr-map 95(defvar shr-map
95 (let ((map (make-sparse-keymap))) 96 (let ((map (make-sparse-keymap)))
@@ -369,18 +370,17 @@ redirects somewhere else."
369 (let ((alt (buffer-substring start end)) 370 (let ((alt (buffer-substring start end))
370 (inhibit-read-only t)) 371 (inhibit-read-only t))
371 (delete-region start end) 372 (delete-region start end)
372 (shr-put-image data start alt)))))) 373 (goto-char start)
374 (shr-put-image data alt))))))
373 (kill-buffer (current-buffer))) 375 (kill-buffer (current-buffer)))
374 376
375(defun shr-put-image (data point alt) 377(defun shr-put-image (data alt)
376 (if (display-graphic-p) 378 (if (display-graphic-p)
377 (let ((image (ignore-errors 379 (let ((image (ignore-errors
378 (shr-rescale-image data)))) 380 (shr-rescale-image data))))
379 (when image 381 (when image
380 (put-image image point alt))) 382 (insert-image image (or alt "*"))))
381 (save-excursion 383 (insert alt)))
382 (goto-char point)
383 (insert alt))))
384 384
385(defun shr-rescale-image (data) 385(defun shr-rescale-image (data)
386 (if (or (not (fboundp 'imagemagick-types)) 386 (if (or (not (fboundp 'imagemagick-types))
@@ -470,14 +470,6 @@ Return a string with image data."
470(defun shr-tag-s (cont) 470(defun shr-tag-s (cont)
471 (shr-fontize-cont cont 'strike-through)) 471 (shr-fontize-cont cont 'strike-through))
472 472
473(defun shr-tag-span (cont)
474 (let ((start (point))
475 (color (cdr (assq 'color (shr-parse-style (cdr (assq :style cont)))))))
476 (shr-generic cont)
477 (when color
478 (let ((overlay (make-overlay start (point))))
479 (overlay-put overlay 'face (cons 'foreground-color color))))))
480
481(defun shr-parse-style (style) 473(defun shr-parse-style (style)
482 (when style 474 (when style
483 (let ((plist nil)) 475 (let ((plist nil))
@@ -501,24 +493,43 @@ Return a string with image data."
501 (shr-urlify (or shr-start start) url))) 493 (shr-urlify (or shr-start start) url)))
502 494
503(defun shr-tag-object (cont) 495(defun shr-tag-object (cont)
504 (let ((url (cdr (assq :src (cdr (assq 'embed cont))))) 496 (let ((start (point))
505 (start (point))) 497 url)
498 (dolist (elem cont)
499 (when (eq (car elem) 'embed)
500 (setq url (or url (cdr (assq :src (cdr elem))))))
501 (when (and (eq (car elem) 'param)
502 (equal (cdr (assq :name (cdr elem))) "movie"))
503 (setq url (or url (cdr (assq :value (cdr elem)))))))
506 (when url 504 (when url
507 (shr-insert " [multimedia] ") 505 (shr-insert " [multimedia] ")
508 (shr-urlify start url)))) 506 (shr-urlify start url))
507 (shr-generic cont)))
508
509(defun shr-tag-video (cont)
510 (let ((image (cdr (assq :poster cont)))
511 (url (cdr (assq :src cont)))
512 (start (point)))
513 (shr-tag-img nil image)
514 (shr-urlify start url)))
509 515
510(defun shr-tag-img (cont) 516(defun shr-tag-img (cont &optional url)
511 (when (and cont 517 (when (or url
512 (cdr (assq :src cont))) 518 (and cont
519 (cdr (assq :src cont))))
513 (when (and (> (current-column) 0) 520 (when (and (> (current-column) 0)
514 (not (eq shr-state 'image))) 521 (not (eq shr-state 'image)))
515 (insert "\n")) 522 (insert "\n"))
516 (let ((alt (cdr (assq :alt cont))) 523 (let ((alt (cdr (assq :alt cont)))
517 (url (cdr (assq :src cont)))) 524 (url (or url (cdr (assq :src cont)))))
518 (let ((start (point-marker))) 525 (let ((start (point-marker)))
519 (when (zerop (length alt)) 526 (when (zerop (length alt))
520 (setq alt "[img]")) 527 (setq alt "[img]"))
521 (cond 528 (cond
529 ((or (member (cdr (assq :height cont)) '("0" "1"))
530 (member (cdr (assq :width cont)) '("0" "1")))
531 ;; Ignore zero-sized or single-pixel images.
532 )
522 ((and (not shr-inhibit-images) 533 ((and (not shr-inhibit-images)
523 (string-match "\\`cid:" url)) 534 (string-match "\\`cid:" url))
524 (let ((url (substring url (match-end 0))) 535 (let ((url (substring url (match-end 0)))
@@ -526,7 +537,7 @@ Return a string with image data."
526 (if (or (not shr-content-function) 537 (if (or (not shr-content-function)
527 (not (setq image (funcall shr-content-function url)))) 538 (not (setq image (funcall shr-content-function url))))
528 (insert alt) 539 (insert alt)
529 (shr-put-image image (point) alt)))) 540 (shr-put-image image alt))))
530 ((or shr-inhibit-images 541 ((or shr-inhibit-images
531 (and shr-blocked-images 542 (and shr-blocked-images
532 (string-match shr-blocked-images url))) 543 (string-match shr-blocked-images url)))
@@ -536,17 +547,17 @@ Return a string with image data."
536 (shr-insert (substring alt 0 8)) 547 (shr-insert (substring alt 0 8))
537 (shr-insert alt)))) 548 (shr-insert alt))))
538 ((url-is-cached (shr-encode-url url)) 549 ((url-is-cached (shr-encode-url url))
539 (shr-put-image (shr-get-image-data url) (point) alt)) 550 (shr-put-image (shr-get-image-data url) alt))
540 (t 551 (t
541 (insert alt) 552 (insert alt)
542 (ignore-errors 553 (ignore-errors
543 (url-retrieve (shr-encode-url url) 'shr-image-fetched 554 (url-retrieve (shr-encode-url url) 'shr-image-fetched
544 (list (current-buffer) start (point-marker)) 555 (list (current-buffer) start (point-marker))
545 t)))) 556 t))))
546 (insert " ")
547 (put-text-property start (point) 'keymap shr-map) 557 (put-text-property start (point) 'keymap shr-map)
548 (put-text-property start (point) 'shr-alt alt) 558 (put-text-property start (point) 'shr-alt alt)
549 (put-text-property start (point) 'shr-image url) 559 (put-text-property start (point) 'shr-image url)
560 (put-text-property start (point) 'help-echo alt)
550 (setq shr-state 'image))))) 561 (setq shr-state 'image)))))
551 562
552(defun shr-tag-pre (cont) 563(defun shr-tag-pre (cont)
@@ -630,6 +641,7 @@ Return a string with image data."
630 (setq cont (or (cdr (assq 'tbody cont)) 641 (setq cont (or (cdr (assq 'tbody cont))
631 cont)) 642 cont))
632 (let* ((shr-inhibit-images t) 643 (let* ((shr-inhibit-images t)
644 (shr-table-depth (1+ shr-table-depth))
633 (shr-kinsoku-shorten t) 645 (shr-kinsoku-shorten t)
634 ;; Find all suggested widths. 646 ;; Find all suggested widths.
635 (columns (shr-column-specs cont)) 647 (columns (shr-column-specs cont))
@@ -651,8 +663,9 @@ Return a string with image data."
651 ;; Finally, insert all the images after the table. The Emacs buffer 663 ;; Finally, insert all the images after the table. The Emacs buffer
652 ;; model isn't strong enough to allow us to put the images actually 664 ;; model isn't strong enough to allow us to put the images actually
653 ;; into the tables. 665 ;; into the tables.
654 (dolist (elem (shr-find-elements cont 'img)) 666 (when (zerop shr-table-depth)
655 (shr-tag-img (cdr elem)))) 667 (dolist (elem (shr-find-elements cont 'img))
668 (shr-tag-img (cdr elem)))))
656 669
657(defun shr-tag-table (cont) 670(defun shr-tag-table (cont)
658 (shr-ensure-paragraph) 671 (shr-ensure-paragraph)