* gnus-spec.el (gnus-complex-form-to-spec): Insert Lisp to match
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Sun, 19 Aug 2001 16:30:52 +0000 (16:30 +0000)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Sun, 19 Aug 2001 16:30:52 +0000 (16:30 +0000)
the positional spec.
(gnus-parse-complex-format): React to %C.

* gnus-ems.el (gnus-char-width): Moved here.

lisp/ChangeLog
lisp/gnus-ems.el
lisp/gnus-spec.el
lisp/gnus-util.el

index f557eb4..d26f17e 100644 (file)
@@ -1,5 +1,11 @@
 2001-08-19 16:14:41  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
+       * gnus-spec.el (gnus-complex-form-to-spec): Insert Lisp to match
+       the positional spec.
+       (gnus-parse-complex-format): React to %C.
+
+       * gnus-ems.el (gnus-char-width): Moved here.
+
        * gnus-sum.el (gnus-select-newsgroup): Set
        gnus-newsgroup-articles. 
        (gnus-unseen-mark): New variable.
index f8c872a..069dc0e 100644 (file)
         (truncate-string-to-width valstr ,max-width)
        valstr)))
 
+(eval-and-compile
+  (defalias 'gnus-char-width
+    (if (fboundp 'char-width)
+       'char-width
+      (lambda (ch) 1)))) ;; A simple hack.
+
 (eval-and-compile
   (if (featurep 'xemacs)
       (gnus-xmas-define)
index 14266b0..ffdec0f 100644 (file)
 (defvar gnus-summary-mode-line-format-spec nil)
 (defvar gnus-group-mode-line-format-spec nil)
 
-;;; Phew.  All that gruft is over, fortunately.
+;;; Phew.  All that gruft is over with, fortunately.
 
 ;;;###autoload
 (defun gnus-update-format (var)
     'balloon-help
     ,(intern (format "gnus-balloon-face-%d" type))))
 
-(eval-and-compile
-  (defalias 'gnus-char-width
-    (if (fboundp 'char-width)
-       'char-width
-      (lambda (ch) 1)))) ;; A simple hack.
-
 (defun gnus-correct-length (string)
   "Return the correct width of STRING."
   (let ((length 0))
   "Return a form that cuts CUT-WIDTH off of EL."
   (let ((cut (abs cut-width)))
     (if (symbolp el)
-       `(if (> (length ,el) ,cut)
+       `(if (> (,(if gnus-use-correct-string-widths
+                     'gnus-correct-length
+                   'length) ,el) ,cut)
             ,(if (< cut-width 0)
-                 `(substring ,el 0 (- (length el) ,cut))
-               `(substring ,el ,cut))
+                 `(,(if gnus-use-correct-string-widths
+                        'gnus-correct-substring
+                      'substring) ,el 0
+                      (- (,(if gnus-use-correct-string-widths
+                               'gnus-correct-length
+                             'length) el) ,cut))
+               `(,(if gnus-use-correct-string-widths
+                      'gnus-correct-substring
+                    'substring) ,el ,cut))
           ,el)
       `(let ((val (eval ,el)))
-        (if (> (length val) ,cut)
+        (if (> (,(if gnus-use-correct-string-widths
+                     'gnus-correct-length
+                   'length) val) ,cut)
             ,(if (< cut-width 0)
-                 `(substring val 0 (- (length val) ,cut))
-               `(substring val ,cut))
+                 `(,(if gnus-use-correct-string-widths
+                        'gnus-correct-substring
+                      'substring) val 0
+                      (- (,(if gnus-use-correct-string-widths
+                               'gnus-correct-length
+                             'length) val) ,cut))
+               `(,(if gnus-use-correct-string-widths
+                      'gnus-correct-substring
+                    'substring) val ,cut))
           val)))))
 
 (defun gnus-tilde-ignore-form (el ignore-value)
       (replace-match "\\\"" nil t))
     (goto-char (point-min))
     (insert "(\"")
+    ;; Convert all font specs into font spec lists.
     (while (re-search-forward "%\\([0-9]+\\)?\\([«»{}()]\\)" nil t)
       (let ((number (if (match-beginning 1)
                        (match-string 1) "0"))
                                   (cond ((= delim ?\() "mouse")
                                         ((= delim ?\{) "face")
                                         (t "balloon"))
-                                  " " number " \""))
+                                  " " number " \"")
+                          t t)
          (replace-match "\")\""))))
     (goto-char (point-max))
     (insert "\")")
+    ;; Convert point position commands.
+    (goto-char (point-min))
+    (while (re-search-forward "%\\([-0-9]+\\)?C" nil t)
+      (replace-match "\"(point)\"" t t))
+    ;; Convert the buffer into the spec.
     (goto-char (point-min))
     (let ((form (read (current-buffer))))
       (cons 'progn (gnus-complex-form-to-spec form spec-alist)))))
   (delq nil
        (mapcar
         (lambda (sform)
-          (if (stringp sform)
-              (gnus-parse-simple-format sform spec-alist t)
+          (cond
+           ((stringp sform)
+            (gnus-parse-simple-format sform spec-alist t))
+           ((eq (car sform) 'point)
+            `(gnus-put-text-property (1- (point)) (point) 'gnus-position t))
+           (t
             (funcall (intern (format "gnus-%s-face-function" (car sform)))
                      (gnus-complex-form-to-spec (cddr sform) spec-alist)
-                     (nth 1 sform))))
+                     (nth 1 sform)))))
         form)))
 
 (defun gnus-parse-simple-format (format spec-alist &optional insert)
index cadc7af..a7aba44 100644 (file)
 
 (defun gnus-goto-colon ()
   (beginning-of-line)
-  (search-forward ":" (gnus-point-at-eol) t))
+  (let ((eol (gnus-point-at-eol)))
+    (goto-char (or (text-property-any (point) eol 'gnus-position t)
+                  (search-forward ":" eol t)
+                  (point)))))
 
 (defun gnus-remove-text-with-property (prop)
   "Delete all text in the current buffer with text property PROP."