aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Magne Ingebrigtsen2010-10-07 22:26:11 +0000
committerKatsumi Yamaoka2010-10-07 22:26:11 +0000
commit3d319c8f92f639940b35c750697e82d22b7c17ba (patch)
tree85fd87e7b11ceb1f470e7af6672f461f64eadc45
parent3a3cbf0ad3973f3cf1f67cabdc01c96a8f34f586 (diff)
downloademacs-3d319c8f92f639940b35c750697e82d22b7c17ba.tar.gz
emacs-3d319c8f92f639940b35c750697e82d22b7c17ba.zip
Merge changes made in Gnus trunk.
shr.el (shr-render-td): Use a cache for the table rendering function to avoid getting an exponential rendering behaviour in nested tables. shr.el (shr-insert): Rework the line-breaking algorithm. shr.el (shr-insert): Don't leave trailing spaces. shr.el (shr-insert-table): Also insert empty TDs. shr.el (shr-tag-blockquote): Ensure paragraphs after </ul>. gnus-start.el (gnus-get-unread-articles): Require gnus-agent before bidning gnus-agent variables. mm-decode.el (mm-save-part): If given a non-directory result, expand the file name before using to avoid setting mm-default-directory to nil. gnus.el (gnus-carpal): The carpal mode has been removed, but define the variable for backwards compatability. nnimap.el (nnimap-update-info): Remove double setting of high. nnimap.el (nnimap-update-info): Don't ignore groups that have no UIDNEXT. shr.el (require): Require cl when compiling. shr.el (shr-tag-hr): New function.
-rw-r--r--lisp/gnus/ChangeLog26
-rw-r--r--lisp/gnus/gnus-group.el3
-rw-r--r--lisp/gnus/gnus-start.el1
-rw-r--r--lisp/gnus/gnus-sum.el8
-rw-r--r--lisp/gnus/gnus-util.el3
-rw-r--r--lisp/gnus/gnus.el5
-rw-r--r--lisp/gnus/mm-decode.el6
-rw-r--r--lisp/gnus/nnimap.el9
-rw-r--r--lisp/gnus/shr.el96
9 files changed, 106 insertions, 51 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 043375136b9..22378d6f372 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,29 @@
12010-10-07 Lars Magne Ingebrigtsen <larsi@gnus.org>
2
3 * shr.el (require): Require cl when compiling.
4 (shr-tag-hr): New function.
5
6 * nnimap.el (nnimap-update-info): Remove double setting of high.
7 (nnimap-update-info): Don't ignore groups that have no UIDNEXT. This
8 makes nnimap work properly on Courier again.
9
10 * gnus.el (gnus-carpal): The carpal mode has been removed, but define
11 the variable for backwards compatability.
12
13 * mm-decode.el (mm-save-part): If given a non-directory result, expand
14 the file name before using to avoid setting mm-default-directory to
15 nil.
16
17 * gnus-start.el (gnus-get-unread-articles): Require gnus-agent before
18 bidning gnus-agent variables.
19
20 * shr.el (shr-render-td): Use a cache for the table rendering function
21 to avoid getting an exponential rendering behaviour in nested tables.
22 (shr-insert): Rework the line-breaking algorithm.
23 (shr-insert): Don't leave trailing spaces.
24 (shr-insert-table): Also insert empty TDs.
25 (shr-tag-blockquote): Ensure paragraphs after </ul>.
26
12010-10-07 Stefan Monnier <monnier@iro.umontreal.ca> 272010-10-07 Stefan Monnier <monnier@iro.umontreal.ca>
2 28
3 * gnus-sum.el (gnus-number): Rename from `number'. 29 * gnus-sum.el (gnus-number): Rename from `number'.
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index c1464562208..b2285569167 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -4321,7 +4321,8 @@ and the second element is the address."
4321 (interactive 4321 (interactive
4322 (list (let ((how (gnus-completing-read 4322 (list (let ((how (gnus-completing-read
4323 "Which back end" 4323 "Which back end"
4324 (mapcar 'car (append gnus-valid-select-methods gnus-server-alist)) 4324 (mapcar 'car (append gnus-valid-select-methods
4325 gnus-server-alist))
4325 t (cons "nntp" 0) 'gnus-method-history))) 4326 t (cons "nntp" 0) 'gnus-method-history)))
4326 ;; We either got a back end name or a virtual server name. 4327 ;; We either got a back end name or a virtual server name.
4327 ;; If the first, we also need an address. 4328 ;; If the first, we also need an address.
diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el
index e5a3ec7737d..26da22e478a 100644
--- a/lisp/gnus/gnus-start.el
+++ b/lisp/gnus/gnus-start.el
@@ -1674,6 +1674,7 @@ If SCAN, request a scan of that group as well."
1674;; and compute how many unread articles there are in each group. 1674;; and compute how many unread articles there are in each group.
1675(defun gnus-get-unread-articles (&optional level) 1675(defun gnus-get-unread-articles (&optional level)
1676 (setq gnus-server-method-cache nil) 1676 (setq gnus-server-method-cache nil)
1677 (require 'gnus-agent)
1677 (let* ((newsrc (cdr gnus-newsrc-alist)) 1678 (let* ((newsrc (cdr gnus-newsrc-alist))
1678 (alevel (or level gnus-activate-level (1+ gnus-level-subscribed))) 1679 (alevel (or level gnus-activate-level (1+ gnus-level-subscribed)))
1679 (foreign-level 1680 (foreign-level
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index caad85815e2..c45536c25c0 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -8686,8 +8686,8 @@ fetch-old-headers verbiage, and so on."
8686 (apply '+ (mapcar 'gnus-summary-limit-children 8686 (apply '+ (mapcar 'gnus-summary-limit-children
8687 (cdr thread))) 8687 (cdr thread)))
8688 0)) 8688 0))
8689 (number (mail-header-number (car thread))) 8689 (number (mail-header-number (car thread)))
8690 score) 8690 score)
8691 (if (and 8691 (if (and
8692 (not (memq number gnus-newsgroup-marked)) 8692 (not (memq number gnus-newsgroup-marked))
8693 (or 8693 (or
@@ -8732,8 +8732,8 @@ fetch-old-headers verbiage, and so on."
8732 t) 8732 t)
8733 ;; Do the `display' group parameter. 8733 ;; Do the `display' group parameter.
8734 (and gnus-newsgroup-display 8734 (and gnus-newsgroup-display
8735 (let ((gnus-number number)) 8735 (let ((gnus-number number))
8736 (not (funcall gnus-newsgroup-display)))))) 8736 (not (funcall gnus-newsgroup-display))))))
8737 ;; Nope, invisible article. 8737 ;; Nope, invisible article.
8738 0 8738 0
8739 ;; Ok, this article is to be visible, so we add it to the limit 8739 ;; Ok, this article is to be visible, so we add it to the limit
diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el
index 30bc72b2348..932b0a1f1e7 100644
--- a/lisp/gnus/gnus-util.el
+++ b/lisp/gnus/gnus-util.el
@@ -1647,7 +1647,8 @@ SPEC is a predicate specifier that contains stuff like `or', `and',
1647(defun gnus-ido-completing-read (prompt collection &optional require-match 1647(defun gnus-ido-completing-read (prompt collection &optional require-match
1648 initial-input history def) 1648 initial-input history def)
1649 "Call `ido-completing-read-function'." 1649 "Call `ido-completing-read-function'."
1650 (ido-completing-read prompt collection nil require-match initial-input history def)) 1650 (ido-completing-read prompt collection nil require-match
1651 initial-input history def))
1651 1652
1652 1653
1653(autoload 'iswitchb-read-buffer "iswitchb") 1654(autoload 'iswitchb-read-buffer "iswitchb")
diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el
index 069596289eb..12215dee702 100644
--- a/lisp/gnus/gnus.el
+++ b/lisp/gnus/gnus.el
@@ -2585,6 +2585,11 @@ a string, be sure to use a valid format, see RFC 2616."
2585(defvar gnus-server-method-cache nil) 2585(defvar gnus-server-method-cache nil)
2586(defvar gnus-extended-servers nil) 2586(defvar gnus-extended-servers nil)
2587 2587
2588;; The carpal mode has been removed, but define the variable for
2589;; backwards compatability.
2590(defvar gnus-carpal nil)
2591(make-obsolete-variable 'gnus-carpal nil "Emacs 24.1")
2592
2588(defvar gnus-agent-fetching nil 2593(defvar gnus-agent-fetching nil
2589 "Whether Gnus agent is in fetching mode.") 2594 "Whether Gnus agent is in fetching mode.")
2590 2595
diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el
index 70b735a70f9..1006c850ae5 100644
--- a/lisp/gnus/mm-decode.el
+++ b/lisp/gnus/mm-decode.el
@@ -1258,8 +1258,10 @@ PROMPT overrides the default one used to ask user for a file name."
1258 (or filename ""))) 1258 (or filename "")))
1259 (or mm-default-directory default-directory) 1259 (or mm-default-directory default-directory)
1260 (or filename ""))) 1260 (or filename "")))
1261 (when (file-directory-p file) 1261 (if (file-directory-p file)
1262 (setq file (expand-file-name filename file))) 1262 (setq file (expand-file-name filename file))
1263 (setq file (expand-file-name
1264 file (or mm-default-directory default-directory))))
1263 (setq mm-default-directory (file-name-directory file)) 1265 (setq mm-default-directory (file-name-directory file))
1264 (and (or (not (file-exists-p file)) 1266 (and (or (not (file-exists-p file))
1265 (yes-or-no-p (format "File %s already exists; overwrite? " 1267 (yes-or-no-p (format "File %s already exists; overwrite? "
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el
index 2fa9d7cb143..f8eb6659ad6 100644
--- a/lisp/gnus/nnimap.el
+++ b/lisp/gnus/nnimap.el
@@ -1016,8 +1016,10 @@ textual parts.")
1016 1016
1017(defun nnimap-update-info (info marks) 1017(defun nnimap-update-info (info marks)
1018 (when (and marks 1018 (when (and marks
1019 ;; Ignore groups with no UIDNEXT values. 1019 ;; Ignore groups with no UIDNEXT/marks. This happens for
1020 (nth 4 marks)) 1020 ;; completely empty groups.
1021 (or (car marks)
1022 (nth 4 marks)))
1021 (destructuring-bind (existing flags high low uidnext start-article 1023 (destructuring-bind (existing flags high low uidnext start-article
1022 permanent-flags) marks 1024 permanent-flags) marks
1023 (let ((group (gnus-info-group info)) 1025 (let ((group (gnus-info-group info))
@@ -1044,9 +1046,6 @@ textual parts.")
1044 group 1046 group
1045 (cons (car (gnus-active group)) 1047 (cons (car (gnus-active group))
1046 (or high (1- uidnext))))) 1048 (or high (1- uidnext)))))
1047 (when (and (not high)
1048 uidnext)
1049 (setq high (1- uidnext)))
1050 ;; Then update the list of read articles. 1049 ;; Then update the list of read articles.
1051 (let* ((unread 1050 (let* ((unread
1052 (gnus-compress-sequence 1051 (gnus-compress-sequence
diff --git a/lisp/gnus/shr.el b/lisp/gnus/shr.el
index ffbb4302924..bb25a6c802d 100644
--- a/lisp/gnus/shr.el
+++ b/lisp/gnus/shr.el
@@ -30,6 +30,7 @@
30 30
31;;; Code: 31;;; Code:
32 32
33(eval-when-compile (require 'cl))
33(require 'browse-url) 34(require 'browse-url)
34 35
35(defgroup shr nil 36(defgroup shr nil
@@ -68,6 +69,7 @@ cid: URL as the argument.")
68(defvar shr-indentation 0) 69(defvar shr-indentation 0)
69(defvar shr-inhibit-images nil) 70(defvar shr-inhibit-images nil)
70(defvar shr-list-mode nil) 71(defvar shr-list-mode nil)
72(defvar shr-content-cache nil)
71 73
72(defvar shr-map 74(defvar shr-map
73 (let ((map (make-sparse-keymap))) 75 (let ((map (make-sparse-keymap)))
@@ -83,6 +85,7 @@ cid: URL as the argument.")
83 85
84;;;###autoload 86;;;###autoload
85(defun shr-insert-document (dom) 87(defun shr-insert-document (dom)
88 (setq shr-content-cache nil)
86 (let ((shr-state nil) 89 (let ((shr-state nil)
87 (shr-start nil)) 90 (shr-start nil))
88 (shr-descend (shr-transform-dom dom)))) 91 (shr-descend (shr-transform-dom dom))))
@@ -135,6 +138,17 @@ redirects somewhere else."
135 (message "Browsing %s..." url) 138 (message "Browsing %s..." url)
136 (browse-url url)))) 139 (browse-url url))))
137 140
141(defun shr-insert-image ()
142 "Insert the image under point into the buffer."
143 (interactive)
144 (let ((url (get-text-property (point) 'shr-image)))
145 (if (not url)
146 (message "No image under point")
147 (message "Inserting %s..." url)
148 (url-retrieve url 'shr-image-fetched
149 (list (current-buffer) (1- (point)) (point-marker))
150 t))))
151
138;;; Utility functions. 152;;; Utility functions.
139 153
140(defun shr-transform-dom (dom) 154(defun shr-transform-dom (dom)
@@ -175,20 +189,8 @@ redirects somewhere else."
175 column) 189 column)
176 (when (and (string-match "\\`[ \t\n]" text) 190 (when (and (string-match "\\`[ \t\n]" text)
177 (not (bolp))) 191 (not (bolp)))
178 (insert " ") 192 (insert " "))
179 (setq shr-state 'space))
180 (dolist (elem (split-string text)) 193 (dolist (elem (split-string text))
181 (setq column (current-column))
182 (when (> column 0)
183 (cond
184 ((and (or (not first)
185 (eq shr-state 'space))
186 (> (+ column (length elem) 1) shr-width))
187 (insert "\n")
188 (put-text-property (1- (point)) (point) 'shr-break t))
189 ((not first)
190 (insert " "))))
191 (setq first nil)
192 (when (and (bolp) 194 (when (and (bolp)
193 (> shr-indentation 0)) 195 (> shr-indentation 0))
194 (shr-indent)) 196 (shr-indent))
@@ -197,12 +199,19 @@ redirects somewhere else."
197 ;; starts. 199 ;; starts.
198 (unless shr-start 200 (unless shr-start
199 (setq shr-start (point))) 201 (setq shr-start (point)))
200 (insert elem)) 202 (insert elem)
201 (setq shr-state nil) 203 (when (> (current-column) shr-width)
202 (when (and (string-match "[ \t\n]\\'" text) 204 (if (not (search-backward " " (line-beginning-position) t))
203 (not (bolp))) 205 (insert "\n")
204 (insert " ") 206 (delete-char 1)
205 (setq shr-state 'space)))))) 207 (insert "\n")
208 (put-text-property (1- (point)) (point) 'shr-break t)
209 (when (> shr-indentation 0)
210 (shr-indent))
211 (end-of-line)))
212 (insert " "))
213 (unless (string-match "[ \t\n]\\'" text)
214 (delete-char -1))))))
206 215
207(defun shr-ensure-newline () 216(defun shr-ensure-newline ()
208 (unless (zerop (current-column)) 217 (unless (zerop (current-column))
@@ -396,11 +405,14 @@ Return a string with image data."
396(defun shr-tag-ul (cont) 405(defun shr-tag-ul (cont)
397 (shr-ensure-paragraph) 406 (shr-ensure-paragraph)
398 (let ((shr-list-mode 'ul)) 407 (let ((shr-list-mode 'ul))
399 (shr-generic cont))) 408 (shr-generic cont))
409 (shr-ensure-paragraph))
400 410
401(defun shr-tag-ol (cont) 411(defun shr-tag-ol (cont)
412 (shr-ensure-paragraph)
402 (let ((shr-list-mode 1)) 413 (let ((shr-list-mode 1))
403 (shr-generic cont))) 414 (shr-generic cont))
415 (shr-ensure-paragraph))
404 416
405(defun shr-tag-li (cont) 417(defun shr-tag-li (cont)
406 (shr-ensure-newline) 418 (shr-ensure-newline)
@@ -437,6 +449,10 @@ Return a string with image data."
437(defun shr-tag-h6 (cont) 449(defun shr-tag-h6 (cont)
438 (shr-heading cont)) 450 (shr-heading cont))
439 451
452(defun shr-tag-hr (cont)
453 (shr-ensure-newline)
454 (insert (make-string shr-width ?-) "\n"))
455
440;;; Table rendering algorithm. 456;;; Table rendering algorithm.
441 457
442;; Table rendering is the only complicated thing here. We do this by 458;; Table rendering is the only complicated thing here. We do this by
@@ -496,16 +512,15 @@ Return a string with image data."
496 overlay overlay-line) 512 overlay overlay-line)
497 (dolist (line lines) 513 (dolist (line lines)
498 (setq overlay-line (pop overlay-lines)) 514 (setq overlay-line (pop overlay-lines))
499 (when (> (length line) 0) 515 (end-of-line)
500 (end-of-line) 516 (insert line "|")
501 (insert line "|") 517 (dolist (overlay overlay-line)
502 (dolist (overlay overlay-line) 518 (let ((o (make-overlay (- (point) (nth 0 overlay) 1)
503 (let ((o (make-overlay (- (point) (nth 0 overlay) 1) 519 (- (point) (nth 1 overlay) 1)))
504 (- (point) (nth 1 overlay) 1))) 520 (properties (nth 2 overlay)))
505 (properties (nth 2 overlay))) 521 (while properties
506 (while properties 522 (overlay-put o (pop properties) (pop properties)))))
507 (overlay-put o (pop properties) (pop properties))))) 523 (forward-line 1))
508 (forward-line 1)))
509 ;; Add blank lines at padding at the bottom of the TD, 524 ;; Add blank lines at padding at the bottom of the TD,
510 ;; possibly. 525 ;; possibly.
511 (dotimes (i (- height (length lines))) 526 (dotimes (i (- height (length lines)))
@@ -570,13 +585,18 @@ Return a string with image data."
570 585
571(defun shr-render-td (cont width fill) 586(defun shr-render-td (cont width fill)
572 (with-temp-buffer 587 (with-temp-buffer
573 (let ((shr-width width) 588 (let ((cache (cdr (assoc (cons width cont) shr-content-cache))))
574 (shr-indentation 0)) 589 (if cache
575 (shr-generic cont)) 590 (insert cache)
576 (delete-region 591 (let ((shr-width width)
577 (point) 592 (shr-indentation 0))
578 (+ (point) 593 (shr-generic cont))
579 (skip-chars-backward " \t\n"))) 594 (delete-region
595 (point)
596 (+ (point)
597 (skip-chars-backward " \t\n")))
598 (push (cons (cons width cont) (buffer-string))
599 shr-content-cache)))
580 (goto-char (point-min)) 600 (goto-char (point-min))
581 (let ((max 0)) 601 (let ((max 0))
582 (while (not (eobp)) 602 (while (not (eobp))