* gnus-spec.el (gnus-correct-length): New function.
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Fri, 17 Aug 2001 22:38:55 +0000 (22:38 +0000)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Fri, 17 Aug 2001 22:38:55 +0000 (22:38 +0000)
(gnus-correct-substring): New function.
(gnus-tilde-max-form): Use it.

* nnmh.el: Docstring changes as below.

* nnml.el: Docstring changes as below.

* nnbabyl.el: Docstring changes as below.

* nnmbox.el: Docstring changes as below.

* nnfolder.el: Added docstrings identifying each virtual server
parameter.

lisp/ChangeLog
lisp/gnus-spec.el
lisp/gnus.el
lisp/nnbabyl.el
lisp/nnfolder.el
lisp/nnmbox.el
lisp/nnmh.el
lisp/nnml.el

index cdf1628..02df3cd 100644 (file)
@@ -1,3 +1,22 @@
+2001-08-18 00:14:45  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * gnus-spec.el (gnus-correct-length): New function.
+       (gnus-correct-substring): New function.
+       (gnus-tilde-max-form): Use it.
+
+2001-08-17  Nevin Kapur  <nevin@jhu.edu>
+
+       * nnmh.el: Docstring changes as below.
+
+       * nnml.el: Docstring changes as below.
+
+       * nnbabyl.el: Docstring changes as below.
+
+       * nnmbox.el: Docstring changes as below.
+
+       * nnfolder.el: Added docstrings identifying each virtual server
+       parameter.
+
 2001-08-18  Simon Josefsson  <jas@extundo.com>
 
        * mml.el (mml-menu): Collapse Attach, Insert and Security submenu.
index 3188ed7..60d687a 100644 (file)
 
 (require 'gnus)
 
+(defcustom gnus-use-correct-string-widths t
+  "*If non-nil, use correct functions for dealing with wide characters."
+  :group 'gnus-format
+  :type 'boolean)
+
 ;;; Internal variables.
 
 (defvar gnus-summary-mark-positions nil)
     'balloon-help
     ,(intern (format "gnus-balloon-face-%d" type))))
 
+(defun gnus-correct-length (string)
+  "Return the correct width of STRING."
+  (let ((length 0))
+    (mapcar (lambda (char) (incf length (char-width char))) string)
+    length))
+
+(defun gnus-correct-substring (string start end)
+  (let ((wstart 0)
+       (wend 0)
+       (seek 0)
+       (length (length string)))
+    ;; Find the start position.
+    (while (and (< seek length)
+               (< wstart start))
+      (incf wstart (char-width (aref string seek)))
+      (incf seek))
+    (setq wend wstart
+         wstart seek)
+    ;; Find the end position.
+    (while (and (< seek length)
+               (< wend end))
+      (incf wend (char-width (aref string seek)))
+      (incf seek))
+    (setq wend seek)
+    (substring string wstart (1- wend))))
+
 (defun gnus-tilde-max-form (el max-width)
   "Return a form that limits EL to MAX-WIDTH."
   (let ((max (abs max-width)))
     (if (symbolp el)
-       `(if (> (length ,el) ,max)
+       `(if (> (,(if gnus-use-correct-string-widths
+                     'gnus-correct-length
+                   'length) ,el)
+               ,max)
             ,(if (< max-width 0)
-                 `(substring ,el (- (length el) ,max))
-               `(substring ,el 0 ,max))
+                 `(,(if gnus-use-correct-string-widths
+                        'gnus-correct-substring
+                      'substring)
+                   ,el (- (,(if gnus-use-correct-string-widths
+                                'gnus-correct-length
+                              'length)
+                           el) ,max))
+               `(,(if gnus-use-correct-string-widths
+                      'gnus-correct-substring
+                    'substring)
+                 ,el 0 ,max))
           ,el)
       `(let ((val (eval ,el)))
-        (if (> (length val) ,max)
+        (if (> (,(if gnus-use-correct-string-widths
+                     'gnus-correct-length
+                   'length) val) ,max)
             ,(if (< max-width 0)
-                 `(substring val (- (length val) ,max))
-               `(substring val 0 ,max))
+                 `(,(if gnus-use-correct-string-widths
+                        'gnus-correct-substring
+                      'substring)
+                   val (- (,(if gnus-use-correct-string-widths
+                                'gnus-correct-length
+                              'length) val) ,max))
+               `(,(if gnus-use-correct-string-widths
+                      'gnus-correct-substring
+                    'substring)
+                 val 0 ,max))
           val)))))
 
 (defun gnus-tilde-cut-form (el cut-width)
index c4d790f..7097b9b 100644 (file)
   :group 'news
   :group 'mail)
 
+(defgroup gnus-format nil
+  "Dealing with formatting issues."
+  :group 'news
+  :group 'mail)
+
 (defgroup gnus-charset nil
   "Group character set issues."
   :link '(custom-manual "(gnus)Charsets")
index 4dd06ea..2d41d4c 100644 (file)
 (nnoo-declare nnbabyl)
 
 (defvoo nnbabyl-mbox-file (expand-file-name "~/RMAIL")
-  "The name of the rmail box file in the users home directory.")
+  "The name of the rmail box file in the users home directory.
+
+This variable is a virtual server slot.  See the Gnus manual for details.")
 
 (defvoo nnbabyl-active-file (expand-file-name "~/.rmail-active")
-  "The name of the active file for the rmail box.")
+  "The name of the active file for the rmail box.
+
+This variable is a virtual server slot.  See the Gnus manual for details.")
 
 (defvoo nnbabyl-get-new-mail t
-  "If non-nil, nnbabyl will check the incoming mail file and split the mail.")
+  "If non-nil, nnbabyl will check the incoming mail file and split the mail.
+
+This variable is a virtual server slot.  See the Gnus manual for details.")
+
 
 (defvoo nnbabyl-prepare-save-mail-hook nil
-  "Hook run narrowed to an article before saving.")
+  "Hook run narrowed to an article before saving.
+
+This variable is a virtual server slot.  See the Gnus manual for details.")
 
 \f
 
index ceedda3..52d11e2 100644 (file)
@@ -43,7 +43,9 @@
 (nnoo-declare nnfolder)
 
 (defvoo nnfolder-directory (expand-file-name message-directory)
-  "The name of the nnfolder directory.")
+  "The name of the nnfolder directory.
+
+This variable is a virtual server slot.  See the Gnus manual for details.")
 
 (defvoo nnfolder-nov-directory nil
   "The name of the nnfolder NOV directory.
@@ -51,7 +53,9 @@ If nil, `nnfolder-directory' is used.")
 
 (defvoo nnfolder-active-file
     (nnheader-concat nnfolder-directory "active")
-  "The name of the active file.")
+  "The name of the active file.
+
+This variable is a virtual server slot.  See the Gnus manual for details.")
 
 ;; I renamed this variable to something more in keeping with the general GNU
 ;; style. -SLB
@@ -73,19 +77,28 @@ message, a huge time saver for large mailboxes.")
 
 (defvoo nnfolder-newsgroups-file
     (concat (file-name-as-directory nnfolder-directory) "newsgroups")
-  "Mail newsgroups description file.")
+  "Mail newsgroups description file.
+
+This variable is a virtual server slot.  See the Gnus manual for details.")
 
 (defvoo nnfolder-get-new-mail t
-  "If non-nil, nnfolder will check the incoming mail file and split the mail.")
+  "If non-nil, nnfolder will check the incoming mail file and split the mail.
+
+This variable is a virtual server slot.  See the Gnus manual for details.")
 
 (defvoo nnfolder-prepare-save-mail-hook nil
   "Hook run narrowed to an article before saving.")
 
 (defvoo nnfolder-save-buffer-hook nil
-  "Hook run before saving the nnfolder mbox buffer.")
+  "Hook run before saving the nnfolder mbox buffer.
+
+This variable is a virtual server slot.  See the Gnus manual for details.")
+
 
 (defvoo nnfolder-inhibit-expiry nil
-  "If non-nil, inhibit expiry.")
+  "If non-nil, inhibit expiry.
+
+This variable is a virtual server slot.  See the Gnus manual for details.")
 
 \f
 
@@ -117,7 +130,9 @@ This variable shouldn't be flipped much.  If you have, for some reason,
 set this to t, and want to set it to nil again, you should always run
 the `nnfolder-generate-active-file' command.  The function will go
 through all nnfolder directories and generate nov databases for them
-all.  This may very well take some time.")
+all.  This may very well take some time.
+
+This variable is a virtual server slot.  See the Gnus manual for details.")
 
 (defvoo nnfolder-nov-file-suffix ".nov")
 
index c6cb06c..596edce 100644 (file)
 (nnoo-declare nnmbox)
 
 (defvoo nnmbox-mbox-file (expand-file-name "~/mbox")
-  "The name of the mail box file in the user's home directory.")
+  "The name of the mail box file in the user's home directory.
+
+This variable is a virtual server slot.  See the Gnus manual for details.")
 
 (defvoo nnmbox-active-file (expand-file-name "~/.mbox-active")
-  "The name of the active file for the mail box.")
+  "The name of the active file for the mail box.
+
+This variable is a virtual server slot.  See the Gnus manual for details.")
 
 (defvoo nnmbox-get-new-mail t
-  "If non-nil, nnmbox will check the incoming mail file and split the mail.")
+  "If non-nil, nnmbox will check the incoming mail file and split the mail.
+
+This variable is a virtual server slot.  See the Gnus manual for details.")
 
 (defvoo nnmbox-prepare-save-mail-hook nil
-  "Hook run narrowed to an article before saving.")
+  "Hook run narrowed to an article before saving.
+
+This variable is a virtual server slot.  See the Gnus manual for details.")
 
 \f
 
index 32359c2..6e07bbe 100644 (file)
 (nnoo-declare nnmh)
 
 (defvoo nnmh-directory message-directory
-  "*Mail spool directory.")
+  "*Mail spool directory.
+
+This variable is a virtual server slot.  See the Gnus manual for details.")
 
 (defvoo nnmh-get-new-mail t
-  "*If non-nil, nnmh will check the incoming mail file and split the mail.")
+  "*If non-nil, nnmh will check the incoming mail file and split the mail.
+
+This variable is a virtual server slot.  See the Gnus manual for details.")
 
 (defvoo nnmh-prepare-save-mail-hook nil
-  "*Hook run narrowed to an article before saving.")
+  "*Hook run narrowed to an article before saving.
+
+This variable is a virtual server slot.  See the Gnus manual for details.")
 
 (defvoo nnmh-be-safe nil
   "*If non-nil, nnmh will check all articles to make sure whether they are new or not.
 Go through the .nnmh-articles file and compare with the actual
 articles in this folder.  The articles that are \"new\" will be marked
-as unread by Gnus.")
+as unread by Gnus.
+
+This variable is a virtual server slot.  See the Gnus manual for details.")
 
 \f
 
index b1caf88..7b7969f 100644 (file)
 (nnoo-declare nnml)
 
 (defvoo nnml-directory message-directory
-  "Spool directory for the nnml mail backend.")
+  "Spool directory for the nnml mail backend.
+
+This variable is a virtual server slot.  See the Gnus manual for details.")
 
 (defvoo nnml-active-file
     (expand-file-name "active" nnml-directory)
-  "Mail active file.")
+  "Mail active file.
+
+This variable is a virtual server slot.  See the Gnus manual for details.")
 
 (defvoo nnml-newsgroups-file
     (expand-file-name "newsgroups" nnml-directory)
-  "Mail newsgroups description file.")
+  "Mail newsgroups description file.
+
+This variable is a virtual server slot.  See the Gnus manual for details.")
 
 (defvoo nnml-get-new-mail t
-  "If non-nil, nnml will check the incoming mail file and split the mail.")
+  "If non-nil, nnml will check the incoming mail file and split the mail.
+
+This variable is a virtual server slot.  See the Gnus manual for details.")
 
 (defvoo nnml-nov-is-evil nil
   "If non-nil, Gnus will never generate and use nov databases for mail groups.
@@ -59,13 +67,19 @@ This variable shouldn't be flipped much.  If you have, for some reason,
 set this to t, and want to set it to nil again, you should always run
 the `nnml-generate-nov-databases' command.  The function will go
 through all nnml directories and generate nov databases for them
-all.  This may very well take some time.")
+all.  This may very well take some time.
+
+This variable is a virtual server slot.  See the Gnus manual for details.")
 
 (defvoo nnml-prepare-save-mail-hook nil
-  "Hook run narrowed to an article before saving.")
+  "Hook run narrowed to an article before saving.
+
+This variable is a virtual server slot.  See the Gnus manual for details.")
 
 (defvoo nnml-inhibit-expiry nil
-  "If non-nil, inhibit expiry.")
+  "If non-nil, inhibit expiry.
+
+This variable is a virtual server slot.  See the Gnus manual for details.")
 
 
 \f