aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2011-01-27 04:04:58 +0000
committerKatsumi Yamaoka2011-01-27 04:04:58 +0000
commit647559c2993ca4fb3fdbdf340945f5e1afbe84d9 (patch)
tree93836ecd33069a0d712fe12e5647947913a29289
parente7f7fbaa11828658bfa7a47e07446d050dc0ad92 (diff)
downloademacs-647559c2993ca4fb3fdbdf340945f5e1afbe84d9.tar.gz
emacs-647559c2993ca4fb3fdbdf340945f5e1afbe84d9.zip
Merge changes made in Gnus trunk.
gnus-art.el (gnus-article-next-page): Change last-line-displayed behaviour. (article-lapsed-string): Refactor out and allow specifying how many segments you want. (gnus-article-setup-buffer): Start updating the lapsed header directly. (gnus-article-update-lapsed-header): New variable. shr.el (shr-put-color): Don't do the box padding in tables, since they're already padded. gnus-util.el (float-time): If float-time is bound, always use it on all Emacsen. It's unclear why the subrp check was there. (time-date): Require to make some autoload issues on XEmacs go away. gnus-draft.el (gnus-draft-clear-marks): New function to be run as an exit hook to nix out all data on readedness on group exit. gnus-sum.el (gnus-auto-select-subject): Doc typo.
-rw-r--r--lisp/gnus/ChangeLog20
-rw-r--r--lisp/gnus/gnus-art.el133
-rw-r--r--lisp/gnus/gnus-draft.el9
-rw-r--r--lisp/gnus/gnus-sum.el2
-rw-r--r--lisp/gnus/gnus-util.el6
-rw-r--r--lisp/gnus/shr.el3
6 files changed, 121 insertions, 52 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 27ffd6dba39..341351ef7f8 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,5 +1,25 @@
12011-01-27 Lars Ingebrigtsen <larsi@gnus.org>
2
3 * gnus-draft.el (gnus-draft-clear-marks): New function to be run as an
4 exit hook to nix out all data on readedness on group exit.
5
6 * gnus-util.el (float-time): If float-time is bound, always use it on
7 all Emacsen. It's unclear why the subrp check was there.
8 (time-date): Require to make some autoload issues on XEmacs go away.
9
10 * shr.el (shr-put-color): Don't do the box padding in tables, since
11 they're already padded.
12
12011-01-26 Lars Ingebrigtsen <larsi@gnus.org> 132011-01-26 Lars Ingebrigtsen <larsi@gnus.org>
2 14
15 * gnus-art.el (gnus-article-next-page): When the last line of the
16 article is displayed, scroll down once more instead of going to the
17 next article at once.
18 (article-lapsed-string): Refactor out and allow specifying how many
19 segments you want.
20 (gnus-article-setup-buffer): Start updating the lapsed header directly.
21 (gnus-article-update-lapsed-header): New variable.
22
3 * shr.el: Revert change that made headings use different-sized faces. 23 * shr.el: Revert change that made headings use different-sized faces.
4 The Emacs display engine isn't advanced enough that, for instance, 24 The Emacs display engine isn't advanced enough that, for instance,
5 tables can comfortably use differntly-sized faces. 25 tables can comfortably use differntly-sized faces.
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index 0cf2d2f0d95..327250e327b 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -1023,6 +1023,15 @@ be added below it (otherwise)."
1023 :group 'gnus-article-headers 1023 :group 'gnus-article-headers
1024 :type 'boolean) 1024 :type 'boolean)
1025 1025
1026(defcustom gnus-article-update-lapsed-header 1
1027 "How often to update the lapsed date header.
1028If nil, don't update it at all."
1029 :version "24.1"
1030 :group 'gnus-article-headers
1031 :type '(choice
1032 (item :tag "Don't update" :value nil)
1033 integer))
1034
1026(defcustom gnus-article-mime-match-handle-function 'undisplayed-alternative 1035(defcustom gnus-article-mime-match-handle-function 'undisplayed-alternative
1027 "Function called with a MIME handle as the argument. 1036 "Function called with a MIME handle as the argument.
1028This is meant for people who want to view first matched part. 1037This is meant for people who want to view first matched part.
@@ -1290,6 +1299,14 @@ predicate. See Info node `(gnus)Customizing Articles'."
1290 :link '(custom-manual "(gnus)Customizing Articles") 1299 :link '(custom-manual "(gnus)Customizing Articles")
1291 :type gnus-article-treat-head-custom) 1300 :type gnus-article-treat-head-custom)
1292 1301
1302(defcustom gnus-treat-date-combined-lapsed 'head
1303 "Display the Date header in a way that says how much time has elapsed.
1304Valid values are nil, t, `head', `first', `last', an integer or a
1305predicate. See Info node `(gnus)Customizing Articles'."
1306 :group 'gnus-article-treat
1307 :link '(custom-manual "(gnus)Customizing Articles")
1308 :type gnus-article-treat-head-custom)
1309
1293(defcustom gnus-treat-date-original nil 1310(defcustom gnus-treat-date-original nil
1294 "Display the date in the original timezone. 1311 "Display the date in the original timezone.
1295Valid values are nil, t, `head', `first', `last', an integer or a 1312Valid values are nil, t, `head', `first', `last', an integer or a
@@ -1680,6 +1697,7 @@ regexp."
1680 (gnus-treat-date-user-defined gnus-article-date-user) 1697 (gnus-treat-date-user-defined gnus-article-date-user)
1681 (gnus-treat-date-iso8601 gnus-article-date-iso8601) 1698 (gnus-treat-date-iso8601 gnus-article-date-iso8601)
1682 (gnus-treat-date-lapsed gnus-article-date-lapsed) 1699 (gnus-treat-date-lapsed gnus-article-date-lapsed)
1700 (gnus-treat-date-combined-lapsed gnus-article-date-combined-lapsed)
1683 (gnus-treat-display-x-face gnus-article-display-x-face) 1701 (gnus-treat-display-x-face gnus-article-display-x-face)
1684 (gnus-treat-display-face gnus-article-display-face) 1702 (gnus-treat-display-face gnus-article-display-face)
1685 (gnus-treat-hide-headers gnus-article-maybe-hide-headers) 1703 (gnus-treat-hide-headers gnus-article-maybe-hide-headers)
@@ -3500,7 +3518,8 @@ should replace the \"Date:\" one, or should be added below it."
3500 3518
3501(defun article-make-date-line (date type) 3519(defun article-make-date-line (date type)
3502 "Return a DATE line of TYPE." 3520 "Return a DATE line of TYPE."
3503 (unless (memq type '(local ut original user iso8601 lapsed english)) 3521 (unless (memq type '(local ut original user iso8601 lapsed english
3522 combined-lapsed))
3504 (error "Unknown conversion type: %s" type)) 3523 (error "Unknown conversion type: %s" type))
3505 (condition-case () 3524 (condition-case ()
3506 (let ((time (date-to-time date))) 3525 (let ((time (date-to-time date)))
@@ -3548,47 +3567,11 @@ should replace the \"Date:\" one, or should be added below it."
3548 (/ (% (abs tz) 3600) 60))))) 3567 (/ (% (abs tz) 3600) 60)))))
3549 ;; Do an X-Sent lapsed format. 3568 ;; Do an X-Sent lapsed format.
3550 ((eq type 'lapsed) 3569 ((eq type 'lapsed)
3551 ;; If the date is seriously mangled, the timezone functions are 3570 (concat "X-Sent: " (article-lapsed-string time)))
3552 ;; liable to bug out, so we ignore all errors. 3571 ;; A combined date/lapsed format.
3553 (let* ((now (current-time)) 3572 ((eq type 'combined-lapsed)
3554 (real-time (subtract-time now time)) 3573 (concat (article-make-date-line date 'original)
3555 (real-sec (and real-time 3574 " (" (article-lapsed-string time 3) ")"))
3556 (+ (* (float (car real-time)) 65536)
3557 (cadr real-time))))
3558 (sec (and real-time (abs real-sec)))
3559 num prev)
3560 (cond
3561 ((null real-time)
3562 "X-Sent: Unknown")
3563 ((zerop sec)
3564 "X-Sent: Now")
3565 (t
3566 (concat
3567 "X-Sent: "
3568 ;; This is a bit convoluted, but basically we go
3569 ;; through the time units for years, weeks, etc,
3570 ;; and divide things to see whether that results
3571 ;; in positive answers.
3572 (mapconcat
3573 (lambda (unit)
3574 (if (zerop (setq num (ffloor (/ sec (cdr unit)))))
3575 ;; The (remaining) seconds are too few to
3576 ;; be divided into this time unit.
3577 ""
3578 ;; It's big enough, so we output it.
3579 (setq sec (- sec (* num (cdr unit))))
3580 (prog1
3581 (concat (if prev ", " "") (int-to-string
3582 (floor num))
3583 " " (symbol-name (car unit))
3584 (if (> num 1) "s" ""))
3585 (setq prev t))))
3586 article-time-units "")
3587 ;; If dates are odd, then it might appear like the
3588 ;; article was sent in the future.
3589 (if (> real-sec 0)
3590 " ago"
3591 " in the future"))))))
3592 ;; Display the date in proper English 3575 ;; Display the date in proper English
3593 ((eq type 'english) 3576 ((eq type 'english)
3594 (let ((dtime (decode-time time))) 3577 (let ((dtime (decode-time time)))
@@ -3610,9 +3593,56 @@ should replace the \"Date:\" one, or should be added below it."
3610 (format "%02d" (nth 2 dtime)) 3593 (format "%02d" (nth 2 dtime))
3611 ":" 3594 ":"
3612 (format "%02d" (nth 1 dtime))))))) 3595 (format "%02d" (nth 1 dtime)))))))
3613 (error 3596 (foo
3614 (format "Date: %s (from Gnus)" date)))) 3597 (format "Date: %s (from Gnus)" date))))
3615 3598
3599(defun article-lapsed-string (time &optional max-segments)
3600 ;; If the date is seriously mangled, the timezone functions are
3601 ;; liable to bug out, so we ignore all errors.
3602 (let* ((now (current-time))
3603 (real-time (subtract-time now time))
3604 (real-sec (and real-time
3605 (+ (* (float (car real-time)) 65536)
3606 (cadr real-time))))
3607 (sec (and real-time (abs real-sec)))
3608 (segments 0)
3609 num prev)
3610 (unless max-segments
3611 (setq max-segments (length article-time-units)))
3612 (cond
3613 ((null real-time)
3614 "Unknown")
3615 ((zerop sec)
3616 "Now")
3617 (t
3618 (concat
3619 ;; This is a bit convoluted, but basically we go
3620 ;; through the time units for years, weeks, etc,
3621 ;; and divide things to see whether that results
3622 ;; in positive answers.
3623 (mapconcat
3624 (lambda (unit)
3625 (if (or (zerop (setq num (ffloor (/ sec (cdr unit)))))
3626 (>= segments max-segments))
3627 ;; The (remaining) seconds are too few to
3628 ;; be divided into this time unit.
3629 ""
3630 ;; It's big enough, so we output it.
3631 (setq sec (- sec (* num (cdr unit))))
3632 (prog1
3633 (concat (if prev ", " "") (int-to-string
3634 (floor num))
3635 " " (symbol-name (car unit))
3636 (if (> num 1) "s" ""))
3637 (setq prev t
3638 segments (1+ segments)))))
3639 article-time-units "")
3640 ;; If dates are odd, then it might appear like the
3641 ;; article was sent in the future.
3642 (if (> real-sec 0)
3643 " ago"
3644 " in the future"))))))
3645
3616(defun article-date-local (&optional highlight) 3646(defun article-date-local (&optional highlight)
3617 "Convert the current article date to the local timezone." 3647 "Convert the current article date to the local timezone."
3618 (interactive (list t)) 3648 (interactive (list t))
@@ -3635,6 +3665,11 @@ function and want to see what the date was before converting."
3635 (interactive (list t)) 3665 (interactive (list t))
3636 (article-date-ut 'lapsed highlight)) 3666 (article-date-ut 'lapsed highlight))
3637 3667
3668(defun article-date-combined-lapsed (&optional highlight)
3669 "Convert the current article date to time lapsed since it was sent."
3670 (interactive (list t))
3671 (article-date-ut 'combined-lapsed highlight))
3672
3638(defun article-update-date-lapsed () 3673(defun article-update-date-lapsed ()
3639 "Function to be run from a timer to update the lapsed time line." 3674 "Function to be run from a timer to update the lapsed time line."
3640 (save-match-data 3675 (save-match-data
@@ -3647,8 +3682,10 @@ function and want to see what the date was before converting."
3647 (when (eq major-mode 'gnus-article-mode) 3682 (when (eq major-mode 'gnus-article-mode)
3648 (let ((mark (point-marker))) 3683 (let ((mark (point-marker)))
3649 (goto-char (point-min)) 3684 (goto-char (point-min))
3650 (when (re-search-forward "^X-Sent:" nil t) 3685 (when (re-search-forward "^X-Sent:\\|^Date:" nil t)
3651 (article-date-lapsed t)) 3686 (if gnus-treat-date-combined-lapsed
3687 (article-date-combined-lapsed t)
3688 (article-date-lapsed t)))
3652 (goto-char (marker-position mark)) 3689 (goto-char (marker-position mark))
3653 (move-marker mark nil)))) 3690 (move-marker mark nil))))
3654 nil 'visible)))))) 3691 nil 'visible))))))
@@ -4296,6 +4333,7 @@ If variable `gnus-use-long-file-name' is non-nil, it is
4296 article-decode-encoded-words 4333 article-decode-encoded-words
4297 article-date-user 4334 article-date-user
4298 article-date-lapsed 4335 article-date-lapsed
4336 article-date-combined-lapsed
4299 article-emphasize 4337 article-emphasize
4300 article-treat-dumbquotes 4338 article-treat-dumbquotes
4301 article-treat-non-ascii 4339 article-treat-non-ascii
@@ -4492,6 +4530,9 @@ commands:
4492 (setq gnus-summary-buffer 4530 (setq gnus-summary-buffer
4493 (gnus-summary-buffer-name gnus-newsgroup-name)) 4531 (gnus-summary-buffer-name gnus-newsgroup-name))
4494 (gnus-summary-set-local-parameters gnus-newsgroup-name) 4532 (gnus-summary-set-local-parameters gnus-newsgroup-name)
4533 (when (and gnus-article-update-lapsed-header
4534 (not article-lapsed-timer))
4535 (gnus-start-date-timer gnus-article-update-lapsed-header))
4495 (current-buffer))))) 4536 (current-buffer)))))
4496 4537
4497;; Set article window start at LINE, where LINE is the number of lines 4538;; Set article window start at LINE, where LINE is the number of lines
@@ -6267,7 +6308,7 @@ Argument LINES specifies lines to be scrolled up."
6267 (save-excursion 6308 (save-excursion
6268 (end-of-line) 6309 (end-of-line)
6269 (and (pos-visible-in-window-p) ;Not continuation line. 6310 (and (pos-visible-in-window-p) ;Not continuation line.
6270 (>= (1+ (point)) (point-max))))) ;Allow for trailing newline. 6311 (>= (point) (point-max)))))
6271 ;; Nothing in this page. 6312 ;; Nothing in this page.
6272 (if (or (not gnus-page-broken) 6313 (if (or (not gnus-page-broken)
6273 (save-excursion 6314 (save-excursion
diff --git a/lisp/gnus/gnus-draft.el b/lisp/gnus/gnus-draft.el
index e1a90fc0de5..78ef713c404 100644
--- a/lisp/gnus/gnus-draft.el
+++ b/lisp/gnus/gnus-draft.el
@@ -68,7 +68,8 @@
68 (gnus-draft-mode 68 (gnus-draft-mode
69 ;; Set up the menu. 69 ;; Set up the menu.
70 (when (gnus-visual-p 'draft-menu 'menu) 70 (when (gnus-visual-p 'draft-menu 'menu)
71 (gnus-draft-make-menu-bar))))) 71 (gnus-draft-make-menu-bar))
72 (add-hook 'gnus-summary-prepare-exit-hook 'gnus-draft-clear-marks t t))))
72 73
73;;; Commands 74;;; Commands
74 75
@@ -325,6 +326,12 @@ Obeys the standard process/prefix convention."
325 (pop-to-buffer buff t))) 326 (pop-to-buffer buff t)))
326 (error "The draft %s is under edit" file))))) 327 (error "The draft %s is under edit" file)))))
327 328
329(defun gnus-draft-clear-marks ()
330 (setq gnus-newsgroup-reads nil
331 gnus-newsgroup-marked nil
332 gnus-newsgroup-unreads
333 (gnus-uncompress-range (gnus-active gnus-newsgroup-name))))
334
328(provide 'gnus-draft) 335(provide 'gnus-draft)
329 336
330;;; gnus-draft.el ends here 337;;; gnus-draft.el ends here
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index 87316683226..e709b71a5b0 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -359,7 +359,7 @@ first subject), `unread' (place point on the subject line of the first
359unread article), `best' (place point on the subject line of the 359unread article), `best' (place point on the subject line of the
360higest-scored article), `unseen' (place point on the subject line of 360higest-scored article), `unseen' (place point on the subject line of
361the first unseen article), `unseen-or-unread' (place point on the subject 361the first unseen article), `unseen-or-unread' (place point on the subject
362line of the first unseen article or, if all article have been seen, on the 362line of the first unseen article or, if all articles have been seen, on the
363subject line of the first unread article), or a function to be called to 363subject line of the first unread article), or a function to be called to
364place point on some subject line." 364place point on some subject line."
365 :version "24.1" 365 :version "24.1"
diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el
index fc3c0b4a6ba..f1d0ce952e4 100644
--- a/lisp/gnus/gnus-util.el
+++ b/lisp/gnus/gnus-util.el
@@ -38,6 +38,8 @@
38(eval-when-compile 38(eval-when-compile
39 (require 'cl)) 39 (require 'cl))
40 40
41(require 'time-date)
42
41(defcustom gnus-completing-read-function 'gnus-emacs-completing-read 43(defcustom gnus-completing-read-function 'gnus-emacs-completing-read
42 "Function use to do completing read." 44 "Function use to do completing read."
43 :version "24.1" 45 :version "24.1"
@@ -332,9 +334,7 @@ Symbols are also allowed; their print names are used instead."
332 (> (nth 1 fdate) (nth 1 date)))))) 334 (> (nth 1 fdate) (nth 1 date))))))
333 335
334(eval-and-compile 336(eval-and-compile
335 (if (or (featurep 'emacs) 337 (if (fboundp 'float-time)
336 (and (fboundp 'float-time)
337 (subrp (symbol-function 'float-time))))
338 (defalias 'gnus-float-time 'float-time) 338 (defalias 'gnus-float-time 'float-time)
339 (defun gnus-float-time (&optional time) 339 (defun gnus-float-time (&optional time)
340 "Convert time value TIME to a floating point number. 340 "Convert time value TIME to a floating point number.
diff --git a/lisp/gnus/shr.el b/lisp/gnus/shr.el
index 2f475857b3f..899a5defaeb 100644
--- a/lisp/gnus/shr.el
+++ b/lisp/gnus/shr.el
@@ -619,7 +619,8 @@ ones, in case fg and bg are nil."
619 (if (< (line-end-position) end) 619 (if (< (line-end-position) end)
620 (forward-line 1) 620 (forward-line 1)
621 (goto-char end))) 621 (goto-char end)))
622 (when (eq type :background) 622 (when (and (eq type :background)
623 (= shr-table-depth 0))
623 (shr-expand-newlines start end color)))) 624 (shr-expand-newlines start end color))))
624 625
625(defun shr-expand-newlines (start end color) 626(defun shr-expand-newlines (start end color)