* gnus-art.el (gnus-article-treat-body-boundary): Fix boundary width on
[gnus] / lisp / gnus-art.el
index 0155afe..20ffa8e 100644 (file)
@@ -683,7 +683,7 @@ beginning of a line."
   :type 'regexp
   :group 'gnus-article-various)
 
-(defcustom gnus-article-mode-line-format "Gnus: %g [%w] %S%m"
+(defcustom gnus-article-mode-line-format "Gnus: %g %S%m"
   "*The format specification for the article mode line.
 See `gnus-summary-mode-line-format' for a closer description.
 
@@ -691,6 +691,7 @@ The following additional specs are available:
 
 %w  The article washing status.
 %m  The number of MIME parts in the article."
+  :version "24.1"
   :type 'string
   :group 'gnus-article-various)
 
@@ -1039,7 +1040,7 @@ Some of these headers are updated automatically.  See
          (item :tag "User-defined" :value 'user-defined)))
 
 (defcustom gnus-article-update-date-headers 1
-  "How often to update the date header.
+  "A number that says how often to update the date header (in seconds).
 If nil, don't update it at all."
   :version "24.1"
   :group 'gnus-article-headers
@@ -1252,6 +1253,24 @@ predicate.  See Info node `(gnus)Customizing Articles'."
   :link '(custom-manual "(gnus)Customizing Articles")
   :type gnus-article-treat-custom)
 
+(gnus-define-group-parameter
+ list-identifier
+ :variable-document
+ "Alist of regexps and correspondent identifiers."
+ :variable-group gnus-article-washing
+ :parameter-type
+ '(choice :tag "Identifier"
+         :value nil
+         (symbol :tag "Item in `gnus-list-identifiers'" none)
+         regexp
+         (const :tag "None" nil))
+ :parameter-document
+ "If non-nil, specify how to remove `identifiers' from articles' subject.
+
+Any symbol is used to look up a regular expression to match the
+banner in `gnus-list-identifiers'.  A string is used as a regular
+expression to match the identifier directly.")
+
 (make-obsolete-variable 'gnus-treat-strip-pgp nil
                        "Gnus 5.10 (Emacs 22.1)")
 
@@ -1724,9 +1743,10 @@ Initialized from `text-mode-syntax-table.")
 (put 'gnus-with-article-headers 'edebug-form-spec '(body))
 
 (defmacro gnus-with-article-buffer (&rest forms)
-  `(with-current-buffer gnus-article-buffer
-     (let ((inhibit-read-only t))
-       ,@forms)))
+  `(when (buffer-live-p (get-buffer gnus-article-buffer))
+     (with-current-buffer gnus-article-buffer
+       (let ((inhibit-read-only t))
+         ,@forms))))
 
 (put 'gnus-with-article-buffer 'lisp-indent-function 0)
 (put 'gnus-with-article-buffer 'edebug-form-spec '(body))
@@ -2317,10 +2337,12 @@ long lines if and only if arg is positive."
       (let ((start (point)))
        (insert "X-Boundary: ")
        (gnus-add-text-properties start (point) '(invisible t intangible t))
-       (insert (let (str)
-                 (while (>= (window-width) (length str))
+       (insert (let (str (max (window-width)))
+                 (if (featurep 'xemacs)
+                     (setq max (1- max)))
+                 (while (>= max (length str))
                    (setq str (concat str gnus-body-boundary-delimiter)))
-                 (substring str 0 (window-width)))
+                 (substring str 0 max))
                "\n")
        (gnus-put-text-property start (point) 'gnus-decoration 'header)))))
 
@@ -3054,10 +3076,11 @@ images if any to the browser, and deletes them when exiting the group
 The `gnus-list-identifiers' variable specifies what to do."
   (interactive)
   (let ((inhibit-point-motion-hooks t)
-       (regexp (if (consp gnus-list-identifiers)
-                   (mapconcat 'identity gnus-list-identifiers " *\\|")
-                 gnus-list-identifiers))
-       (inhibit-read-only t))
+        (regexp (or (gnus-parameter-list-identifier gnus-newsgroup-name)
+                    (if (consp gnus-list-identifiers)
+                        (mapconcat 'identity gnus-list-identifiers " *\\|")
+                      gnus-list-identifiers)))
+        (inhibit-read-only t))
     (when regexp
       (save-excursion
        (save-restriction
@@ -3403,6 +3426,7 @@ possible values."
         (inhibit-read-only t)
         (inhibit-point-motion-hooks t)
         (first t)
+        (visible-date (mail-fetch-field "Date"))
         pos date bface eface)
     (save-excursion
       (save-restriction
@@ -3426,6 +3450,9 @@ possible values."
            (delete-region (point-at-bol) (progn
                                            (gnus-article-forward-header)
                                            (point))))
+         (when (and (not date)
+                    visible-date)
+           (setq date visible-date))
          (when date
            (article-transform-date date type bface eface)))))))
 
@@ -3458,7 +3485,7 @@ possible values."
                             combined-lapsed))
     (error "Unknown conversion type: %s" type))
   (condition-case ()
-      (let ((time (date-to-time date)))
+      (let ((time (ignore-errors (date-to-time date))))
        (cond
         ;; Convert to the local timezone.
         ((eq type 'local)
@@ -3510,6 +3537,7 @@ possible values."
                (segments 3)
                lapsed-string)
            (while (and
+                    time
                    (setq lapsed-string
                          (concat " (" (article-lapsed-string time segments) ")"))
                    (> (+ (length date-string)
@@ -3628,15 +3656,26 @@ function and want to see what the date was before converting."
           (set-buffer (window-buffer w))
           (when (eq major-mode 'gnus-article-mode)
             (let ((old-line (count-lines (point-min) (point)))
-                  (old-column (- (point) (line-beginning-position))))
+                  (old-column (- (point) (line-beginning-position)))
+                  (window-start
+                   (window-start (get-buffer-window (current-buffer)))))
               (goto-char (point-min))
               (while (re-search-forward "^Date:" nil t)
                 (let ((type (get-text-property (match-beginning 0)
                                                'gnus-date-type)))
                   (when (memq type '(lapsed combined-lapsed user-format))
+                    (when (and window-start
+                               (not (= window-start
+                                       (save-excursion
+                                         (forward-line 1)
+                                         (point)))))
+                      (setq window-start nil))
                     (save-excursion
                       (article-date-ut type t (match-beginning 0)))
-                    (forward-line 1))))
+                    (forward-line 1)
+                    (when window-start
+                      (set-window-start (get-buffer-window (current-buffer))
+                                        (point))))))
               (goto-char (point-min))
               (when (> old-column 0)
                 (setq old-line (1- old-line)))
@@ -4489,13 +4528,10 @@ commands:
        (setq gnus-summary-buffer
              (gnus-summary-buffer-name gnus-newsgroup-name))
        (gnus-summary-set-local-parameters gnus-newsgroup-name)
-       (cond
-        ((and gnus-article-update-date-headers
-              (not article-lapsed-timer))
+       (when article-lapsed-timer
+         (gnus-stop-date-timer))
+       (when gnus-article-update-date-headers
          (gnus-start-date-timer gnus-article-update-date-headers))
-        ((and (not gnus-article-update-date-headers)
-              article-lapsed-timer)
-         (gnus-stop-date-timer)))
        (current-buffer)))))
 
 ;; Set article window start at LINE, where LINE is the number of lines
@@ -4621,6 +4657,7 @@ If ALL-HEADERS is non-nil, no headers are hidden."
              (forward-line -1))
            (set-window-point (get-buffer-window (current-buffer)) (point))
            (gnus-configure-windows 'article)
+           (gnus-run-hooks 'gnus-article-prepare-hook)
            t))))))
 
 ;;;###autoload
@@ -4638,8 +4675,7 @@ If ALL-HEADERS is non-nil, no headers are hidden."
          gnus-article-image-alist nil)
     (gnus-run-hooks 'gnus-tmp-internal-hook)
     (when gnus-display-mime-function
-      (funcall gnus-display-mime-function))
-    (gnus-run-hooks 'gnus-article-prepare-hook)))
+      (funcall gnus-display-mime-function))))
 
 ;;;
 ;;; Gnus Sticky Article Mode
@@ -4864,8 +4900,6 @@ General format specifiers can also be used.  See Info node
     (when (zerop parts)
       (error "No such part"))
     (pop-to-buffer gnus-article-buffer)
-    ;; FIXME: why is it necessary?
-    (sit-for 0)
     (or n
        (setq n (if (= parts 1)
                    1
@@ -6308,7 +6342,8 @@ specifies."
 
 (defun gnus-article-next-page-1 (lines)
   (condition-case ()
-      (let ((scroll-in-place nil))
+      (let ((scroll-in-place nil)
+           (auto-window-vscroll nil))
        (scroll-up lines))
     (end-of-buffer
      ;; Long lines may cause an end-of-buffer error.
@@ -7328,9 +7363,6 @@ as a symbol to FUN."
 
 (defvar gnus-button-handle-describe-prefix "^\\(C-h\\|<?[Ff]1>?\\)")
 
-;; FIXME: Maybe we should merge some of the functions that do quite similar
-;; stuff?
-
 (defun gnus-button-handle-describe-function (url)
   "Call `describe-function' when pushing the corresponding URL button."
   (describe-function