From 510d31023e83143dcd3b86ea249df5ed49e08918 Mon Sep 17 00:00:00 2001 From: shuhei-k Date: Sat, 22 Aug 1998 21:58:20 +0000 Subject: [PATCH] (gnus-tilde-max-form): Use `gnus-string-width' and `gnus-truncate-string'. (gnus-tilde-cut-form): Ditto. --- lisp/gnus-spec.el | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/lisp/gnus-spec.el b/lisp/gnus-spec.el index 23215fb..281cd21 100644 --- a/lisp/gnus-spec.el +++ b/lisp/gnus-spec.el @@ -245,32 +245,40 @@ "Return a form that limits EL to MAX-WIDTH." (let ((max (abs max-width))) (if (symbolp el) - `(if (> (length ,el) ,max) + `(if (> (gnus-string-width ,el) ,max) ,(if (< max-width 0) - `(substring ,el (- (length el) ,max)) - `(substring ,el 0 ,max)) + `(gnus-truncate-string + ,el (gnus-string-width ,el) + (- (gnus-string-width ,el) ,max)) + `(gnus-truncate-string ,el ,max)) ,el) `(let ((val (eval ,el))) - (if (> (length val) ,max) + (if (> (gnus-string-width val) ,max) ,(if (< max-width 0) - `(substring val (- (length val) ,max)) - `(substring val 0 ,max)) + `(gnus-truncate-string + val (gnus-string-width val) + (- (gnus-string-width val) ,max)) + `(gnus-truncate-string val ,max)) val))))) (defun gnus-tilde-cut-form (el cut-width) "Return a form that cuts CUT-WIDTH off of EL." (let ((cut (abs cut-width))) (if (symbolp el) - `(if (> (length ,el) ,cut) + `(if (> (gnus-string-width ,el) ,cut) ,(if (< cut-width 0) - `(substring ,el 0 (- (length el) ,cut)) - `(substring ,el ,cut)) + `(gnus-truncate-string + ,el (- (gnus-string-width ,el) ,cut)) + `(gnus-truncate-string + ,el (- (gnus-string-width ,el) ,cut) ,cut)) ,el) `(let ((val (eval ,el))) - (if (> (length val) ,cut) + (if (> (gnus-string-width val) ,cut) ,(if (< cut-width 0) - `(substring val 0 (- (length val) ,cut)) - `(substring val ,cut)) + `(gnus-truncate-string + val (- (gnus-string-width val) ,cut)) + `(gnus-truncate-string + val (- (gnus-string-width val) ,cut) ,cut)) val))))) (defun gnus-tilde-ignore-form (el ignore-value) -- 1.7.10.4