Synch with Oort Gnus.
[elisp/gnus.git-] / lisp / gnus-spec.el
index 1c87a0a..0171a91 100644 (file)
   (let (type val)
     (save-excursion
       (while (setq type (pop types))
-       ;; Jump to the proper buffer to find out the value of
-       ;; the variable, if possible.  (It may be buffer-local.)
+       ;; Jump to the proper buffer to find out the value of the
+       ;; variable, if possible.  (It may be buffer-local.)
        (let* ((new-format
                (let ((buffer (intern (format "gnus-%s-buffer" type))))
                  (when (and (boundp buffer)
@@ -309,7 +309,7 @@ by `gnus-xmas-redefine'."
     (mapcar (lambda (char) (incf length (gnus-char-width char))) string)
     length))
 
-(defun gnus-correct-substring (string start end)
+(defun gnus-correct-substring (string start &optional end)
   (let ((wstart 0)
        (wend 0)
        (seek 0)
@@ -323,7 +323,8 @@ by `gnus-xmas-redefine'."
          wstart seek)
     ;; Find the end position.
     (while (and (< seek length)
-               (<= wend end))
+               (or (not end)
+                   (<= wend end)))
       (incf wend (gnus-char-width (aref string seek)))
       (incf seek))
     (setq wend seek)
@@ -461,6 +462,9 @@ by `gnus-xmas-redefine'."
     ;; Convert the buffer into the spec.
     (goto-char (point-min))
     (let ((form (read (current-buffer))))
+      ;; If the first element is '(point), we just remove it.
+      (when (equal (car form) '(point))
+       (pop form))
       (cons 'progn (gnus-complex-form-to-spec form spec-alist)))))
 
 (defun gnus-complex-form-to-spec (form spec-alist)
@@ -667,7 +671,7 @@ If PROPS, insert the result."
       (while entries
        (setq entry (pop entries)
              type (car entry))
-       (if (memq type '(version gnus-version))
+       (if (memq type '(gnus-version version))
            (setq gnus-format-specs (delq entry gnus-format-specs))
          (let ((form (caddr entry)))
            (when (and (listp form)