* gnus-spec.el (gnus-compile): Don't compile gnus-version.
[gnus] / lisp / gnus-spec.el
index ffdec0f..340801c 100644 (file)
 
 (defvar gnus-format-specs
   `((version . ,emacs-version)
+    (gnus-version . ,(gnus-continuum-version))
     (group "%M\%S\%p\%P\%5y: %(%g%)%l\n" ,gnus-group-line-format-spec)
     (summary-dummy "*  %(:                          :%) %S\n"
                   ,gnus-summary-dummy-line-format-spec)
   ;; Make the indentation array.
   ;; See whether all the stored info needs to be flushed.
   (when (or force
+           (not (equal (gnus-continuum-version)
+                       (cdr (assq 'gnus-version gnus-format-specs))))
            (not (equal emacs-version
                        (cdr (assq 'version gnus-format-specs)))))
     (setq gnus-format-specs nil))
   ;; Go through all the formats and see whether they need updating.
   (let (new-format entry type val)
     (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.)
       (save-excursion
        (let ((buffer (intern (format "gnus-%s-buffer" type)))
              val)
     'balloon-help
     ,(intern (format "gnus-balloon-face-%d" type))))
 
+(defun gnus-spec-tab (column)
+  (if (> column 0)
+      `(insert (make-string (max (- ,column (current-column)) 0) ? ))
+    `(progn
+       (if (> (current-column) ,(abs column))
+          (delete-region (point)
+                         (- (point) (- (current-column) ,(abs column))))
+        (insert (make-string (max (- ,(abs column) (current-column)) 0)
+                             ? ))))))
+
 (defun gnus-correct-length (string)
   "Return the correct width of STRING."
   (let ((length 0))
     (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)
          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)
     (goto-char (point-min))
     (while (re-search-forward "%\\([-0-9]+\\)?C" nil t)
       (replace-match "\"(point)\"" t t))
+    ;; Convert TAB commands.
+    (goto-char (point-min))
+    (while (re-search-forward "%\\([-0-9]+\\)=" nil t)
+      (replace-match (format "\"(tab %s)\"" (match-string 1)) t t))
     ;; 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)
             (gnus-parse-simple-format sform spec-alist t))
            ((eq (car sform) 'point)
             `(gnus-put-text-property (1- (point)) (point) 'gnus-position t))
+           ((eq (car sform) 'tab)
+            (gnus-spec-tab (cadr sform)))
            (t
             (funcall (intern (format "gnus-%s-face-function" (car sform)))
                      (gnus-complex-form-to-spec (cddr sform) spec-alist)
@@ -604,7 +627,7 @@ If PROPS, insert the result."
 
       (while entries
        (setq entry (pop entries))
-       (if (eq (car entry) 'version)
+       (if (memq (car entry) '(gnus-version version))
            (setq gnus-format-specs (delq entry gnus-format-specs))
          (let ((form (caddr entry)))
            (when (and (listp form)