+ '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 &optional end)
+ (let ((wstart 0)
+ (wend 0)
+ (wseek 0)
+ (seek 0)
+ (length (length string))
+ (string (concat string "\0")))
+ ;; Find the start position.
+ (while (and (< seek length)
+ (< wseek start))
+ (incf wseek (gnus-char-width (aref string seek)))
+ (incf seek))
+ (setq wstart seek)
+ ;; Find the end position.
+ (while (and (<= seek length)
+ (or (not end)
+ (<= wseek end)))
+ (incf wseek (gnus-char-width (aref string seek)))
+ (incf seek))
+ (setq wend seek)
+ (substring string wstart (1- wend))))