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.
+2010-10-07 Lars Magne Ingebrigtsen <larsi@gnus.org>
+
+ * shr.el (require): Require cl when compiling.
+ (shr-tag-hr): New function.
+
+ * nnimap.el (nnimap-update-info): Remove double setting of high.
+ (nnimap-update-info): Don't ignore groups that have no UIDNEXT. This
+ makes nnimap work properly on Courier again.
+
+ * gnus.el (gnus-carpal): The carpal mode has been removed, but define
+ the variable for backwards compatability.
+
+ * 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-start.el (gnus-get-unread-articles): Require gnus-agent before
+ bidning gnus-agent variables.
+
+ * shr.el (shr-render-td): Use a cache for the table rendering function
+ to avoid getting an exponential rendering behaviour in nested tables.
+ (shr-insert): Rework the line-breaking algorithm.
+ (shr-insert): Don't leave trailing spaces.
+ (shr-insert-table): Also insert empty TDs.
+ (shr-tag-blockquote): Ensure paragraphs after </ul>.
+
2010-10-07 Stefan Monnier <monnier@iro.umontreal.ca>
* gnus-sum.el (gnus-number): Rename from `number'.
(interactive
(list (let ((how (gnus-completing-read
"Which back end"
- (mapcar 'car (append gnus-valid-select-methods gnus-server-alist))
+ (mapcar 'car (append gnus-valid-select-methods
+ gnus-server-alist))
t (cons "nntp" 0) 'gnus-method-history)))
;; We either got a back end name or a virtual server name.
;; If the first, we also need an address.
;; and compute how many unread articles there are in each group.
(defun gnus-get-unread-articles (&optional level)
(setq gnus-server-method-cache nil)
+ (require 'gnus-agent)
(let* ((newsrc (cdr gnus-newsrc-alist))
(alevel (or level gnus-activate-level (1+ gnus-level-subscribed)))
(foreign-level
(apply '+ (mapcar 'gnus-summary-limit-children
(cdr thread)))
0))
- (number (mail-header-number (car thread)))
- score)
+ (number (mail-header-number (car thread)))
+ score)
(if (and
(not (memq number gnus-newsgroup-marked))
(or
t)
;; Do the `display' group parameter.
(and gnus-newsgroup-display
- (let ((gnus-number number))
- (not (funcall gnus-newsgroup-display))))))
+ (let ((gnus-number number))
+ (not (funcall gnus-newsgroup-display))))))
;; Nope, invisible article.
0
;; Ok, this article is to be visible, so we add it to the limit
(defun gnus-ido-completing-read (prompt collection &optional require-match
initial-input history def)
"Call `ido-completing-read-function'."
- (ido-completing-read prompt collection nil require-match initial-input history def))
+ (ido-completing-read prompt collection nil require-match
+ initial-input history def))
(autoload 'iswitchb-read-buffer "iswitchb")
(defvar gnus-server-method-cache nil)
(defvar gnus-extended-servers nil)
+;; The carpal mode has been removed, but define the variable for
+;; backwards compatability.
+(defvar gnus-carpal nil)
+(make-obsolete-variable 'gnus-carpal nil "Emacs 24.1")
+
(defvar gnus-agent-fetching nil
"Whether Gnus agent is in fetching mode.")
(or filename "")))
(or mm-default-directory default-directory)
(or filename "")))
- (when (file-directory-p file)
- (setq file (expand-file-name filename file)))
+ (if (file-directory-p file)
+ (setq file (expand-file-name filename file))
+ (setq file (expand-file-name
+ file (or mm-default-directory default-directory))))
(setq mm-default-directory (file-name-directory file))
(and (or (not (file-exists-p file))
(yes-or-no-p (format "File %s already exists; overwrite? "
(defun nnimap-update-info (info marks)
(when (and marks
- ;; Ignore groups with no UIDNEXT values.
- (nth 4 marks))
+ ;; Ignore groups with no UIDNEXT/marks. This happens for
+ ;; completely empty groups.
+ (or (car marks)
+ (nth 4 marks)))
(destructuring-bind (existing flags high low uidnext start-article
permanent-flags) marks
(let ((group (gnus-info-group info))
group
(cons (car (gnus-active group))
(or high (1- uidnext)))))
- (when (and (not high)
- uidnext)
- (setq high (1- uidnext)))
;; Then update the list of read articles.
(let* ((unread
(gnus-compress-sequence
;;; Code:
+(eval-when-compile (require 'cl))
(require 'browse-url)
(defgroup shr nil
(defvar shr-indentation 0)
(defvar shr-inhibit-images nil)
(defvar shr-list-mode nil)
+(defvar shr-content-cache nil)
(defvar shr-map
(let ((map (make-sparse-keymap)))
;;;###autoload
(defun shr-insert-document (dom)
+ (setq shr-content-cache nil)
(let ((shr-state nil)
(shr-start nil))
(shr-descend (shr-transform-dom dom))))
(message "Browsing %s..." url)
(browse-url url))))
+(defun shr-insert-image ()
+ "Insert the image under point into the buffer."
+ (interactive)
+ (let ((url (get-text-property (point) 'shr-image)))
+ (if (not url)
+ (message "No image under point")
+ (message "Inserting %s..." url)
+ (url-retrieve url 'shr-image-fetched
+ (list (current-buffer) (1- (point)) (point-marker))
+ t))))
+
;;; Utility functions.
(defun shr-transform-dom (dom)
column)
(when (and (string-match "\\`[ \t\n]" text)
(not (bolp)))
- (insert " ")
- (setq shr-state 'space))
+ (insert " "))
(dolist (elem (split-string text))
- (setq column (current-column))
- (when (> column 0)
- (cond
- ((and (or (not first)
- (eq shr-state 'space))
- (> (+ column (length elem) 1) shr-width))
- (insert "\n")
- (put-text-property (1- (point)) (point) 'shr-break t))
- ((not first)
- (insert " "))))
- (setq first nil)
(when (and (bolp)
(> shr-indentation 0))
(shr-indent))
;; starts.
(unless shr-start
(setq shr-start (point)))
- (insert elem))
- (setq shr-state nil)
- (when (and (string-match "[ \t\n]\\'" text)
- (not (bolp)))
- (insert " ")
- (setq shr-state 'space))))))
+ (insert elem)
+ (when (> (current-column) shr-width)
+ (if (not (search-backward " " (line-beginning-position) t))
+ (insert "\n")
+ (delete-char 1)
+ (insert "\n")
+ (put-text-property (1- (point)) (point) 'shr-break t)
+ (when (> shr-indentation 0)
+ (shr-indent))
+ (end-of-line)))
+ (insert " "))
+ (unless (string-match "[ \t\n]\\'" text)
+ (delete-char -1))))))
(defun shr-ensure-newline ()
(unless (zerop (current-column))
(defun shr-tag-ul (cont)
(shr-ensure-paragraph)
(let ((shr-list-mode 'ul))
- (shr-generic cont)))
+ (shr-generic cont))
+ (shr-ensure-paragraph))
(defun shr-tag-ol (cont)
+ (shr-ensure-paragraph)
(let ((shr-list-mode 1))
- (shr-generic cont)))
+ (shr-generic cont))
+ (shr-ensure-paragraph))
(defun shr-tag-li (cont)
(shr-ensure-newline)
(defun shr-tag-h6 (cont)
(shr-heading cont))
+(defun shr-tag-hr (cont)
+ (shr-ensure-newline)
+ (insert (make-string shr-width ?-) "\n"))
+
;;; Table rendering algorithm.
;; Table rendering is the only complicated thing here. We do this by
overlay overlay-line)
(dolist (line lines)
(setq overlay-line (pop overlay-lines))
- (when (> (length line) 0)
- (end-of-line)
- (insert line "|")
- (dolist (overlay overlay-line)
- (let ((o (make-overlay (- (point) (nth 0 overlay) 1)
- (- (point) (nth 1 overlay) 1)))
- (properties (nth 2 overlay)))
- (while properties
- (overlay-put o (pop properties) (pop properties)))))
- (forward-line 1)))
+ (end-of-line)
+ (insert line "|")
+ (dolist (overlay overlay-line)
+ (let ((o (make-overlay (- (point) (nth 0 overlay) 1)
+ (- (point) (nth 1 overlay) 1)))
+ (properties (nth 2 overlay)))
+ (while properties
+ (overlay-put o (pop properties) (pop properties)))))
+ (forward-line 1))
;; Add blank lines at padding at the bottom of the TD,
;; possibly.
(dotimes (i (- height (length lines)))
(defun shr-render-td (cont width fill)
(with-temp-buffer
- (let ((shr-width width)
- (shr-indentation 0))
- (shr-generic cont))
- (delete-region
- (point)
- (+ (point)
- (skip-chars-backward " \t\n")))
+ (let ((cache (cdr (assoc (cons width cont) shr-content-cache))))
+ (if cache
+ (insert cache)
+ (let ((shr-width width)
+ (shr-indentation 0))
+ (shr-generic cont))
+ (delete-region
+ (point)
+ (+ (point)
+ (skip-chars-backward " \t\n")))
+ (push (cons (cons width cont) (buffer-string))
+ shr-content-cache)))
(goto-char (point-min))
(let ((max 0))
(while (not (eobp))