Commit 160ae063 authored by Lars Magne Ingebrigtsen's avatar Lars Magne Ingebrigtsen Committed by Katsumi Yamaoka
Browse files

Merge changes made in No Gnus

parent cc2ab732
2012-03-14 Lars Magne Ingebrigtsen <>
* gnus-sum.el (gnus-update-marks): Don't propagate marks unless
requested (bug#10961).
* shr.el (shr-table-widths): Divide the extra width more fairly over
the TDs (bug#10973).
(shr-render-td): Don't delete too much padding.
(shr-natural-width): Compute the natural width more correctly.
(shr-insert): Allow the natural width to be computed for tables again.
(shr-tag-table-1): Rework how the natural widths are computed by
rendering the table a third time.
(shr-natural-width): Removed.
(shr-buffer-width): New function.
(shr-expand-newlines): Use it.
* gnus-msg.el (gnus-bug): Don't delete the other windows. We may be
using a `gnus-use-full-window' setup (bug#11013).
2012-03-12 Lars Magne Ingebrigtsen <>
* gnus-int.el (gnus-backend-trace): Flip default to nil before Emacs
......@@ -1453,7 +1453,6 @@ If YANK is non-nil, include the original article."
(error "Gnus has been shut down"))
(gnus-setup-message (if (message-mail-user-agent) 'message 'bug)
(unless (message-mail-user-agent)
(when gnus-bug-create-help-buffer
(switch-to-buffer "*Gnus Help Bug*")
......@@ -6074,6 +6074,10 @@ If SELECT-ARTICLES, only select those articles from GROUP."
(when (and (gnus-check-backend-function
'request-set-mark gnus-newsgroup-name)
(or gnus-propagate-marks
(gnus-find-method-for-group gnus-newsgroup-name)
(not (gnus-article-unpropagatable-p (cdr type))))
(let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
;; Don't do anything about marks for articles we
......@@ -341,7 +341,6 @@ the URL of the image to the kill buffer instead."
(delete-char -1))
(insert "\n")
(unless found
(put-text-property (1- (point)) (point) 'shr-break t)
;; No space is needed at the beginning of a line.
(when (eq (following-char) ? )
(delete-char 1)))
......@@ -711,7 +710,7 @@ ones, in case fg and bg are nil."
(forward-line 1)
(setq end (point))
(narrow-to-region start end)
(let ((width (shr-natural-width))
(let ((width (shr-buffer-width))
(goto-char (point-min))
(while (not (eobp))
......@@ -1048,7 +1047,10 @@ ones, in case fg and bg are nil."
;; be smaller (if there's little text) or bigger (if there's
;; unbreakable text).
(sketch (shr-make-table cont suggested-widths))
(sketch-widths (shr-table-widths sketch suggested-widths)))
;; Compute the "natural" width by setting each column to 500
;; characters and see how wide they really render.
(natural (shr-make-table cont (make-vector (length columns) 500)))
(sketch-widths (shr-table-widths sketch natural suggested-widths)))
;; This probably won't work very well.
(when (> (+ (loop for width across sketch-widths
summing (1+ width))
......@@ -1186,31 +1188,35 @@ ones, in case fg and bg are nil."
(insert "\n"))
(defun shr-table-widths (table suggested-widths)
(defun shr-table-widths (table natural-table suggested-widths)
(let* ((length (length suggested-widths))
(widths (make-vector length 0))
(natural-widths (make-vector length 0)))
(dolist (row table)
(let ((i 0))
(dolist (column row)
(aset widths i (max (aref widths i)
(car column)))
(aset natural-widths i (max (aref natural-widths i)
(cadr column)))
(aset widths i (max (aref widths i) column))
(setq i (1+ i)))))
(dolist (row natural-table)
(let ((i 0))
(dolist (column row)
(aset natural-widths i (max (aref natural-widths i) column))
(setq i (1+ i)))))
(let ((extra (- (apply '+ (append suggested-widths nil))
(apply '+ (append widths nil))))
(expanded-columns 0))
;; We have extra, unused space, so divide this space amongst the
;; columns.
(when (> extra 0)
;; If the natural width is wider than the rendered width, we
;; want to allow the column to expand.
(dotimes (i length)
;; If the natural width is wider than the rendered width, we
;; want to allow the column to expand.
(when (> (aref natural-widths i) (aref widths i))
(setq expanded-columns (1+ expanded-columns))))
(dotimes (i length)
(when (> (aref natural-widths i) (aref widths i))
(aset widths i (min
(1+ (aref natural-widths i))
(aref natural-widths i)
(+ (/ extra expanded-columns)
(aref widths i))))))))
......@@ -1265,10 +1271,13 @@ ones, in case fg and bg are nil."
(let ((shr-width width)
(shr-indentation 0))
(shr-descend (cons 'td cont)))
;; Delete padding at the bottom of the TDs.
(+ (point)
(skip-chars-backward " \t\n")))
(skip-chars-backward " \t\n")
(push (list (cons width cont) (buffer-string)
(shr-overlays-in-region (point-min) (point-max)))
......@@ -1302,19 +1311,14 @@ ones, in case fg and bg are nil."
(split-string (buffer-string) "\n")
(car actual-colors))
(list max
(defun shr-natural-width ()
(defun shr-buffer-width ()
(goto-char (point-min))
(let ((current 0)
(max 0))
(let ((max 0))
(while (not (eobp))
(setq current (+ current (current-column)))
(unless (get-text-property (point) 'shr-break)
(setq max (max max current)
current 0))
(setq max (max max (current-column)))
(forward-line 1))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment