yatex

changeset 174:ab02213f5683 dev

rindex: return nil, instead of -1, if no match found.
author yuuji@gentei.org
date Fri, 18 Feb 2011 15:33:21 +0900
parents 7dc3c2332da5
children 6e959a05ae19
files yatexlib.el
diffstat 1 files changed, 7 insertions(+), 8 deletions(-) [+]
line diff
     1.1 --- a/yatexlib.el	Fri Feb 18 14:52:12 2011 +0900
     1.2 +++ b/yatexlib.el	Fri Feb 18 15:33:21 2011 +0900
     1.3 @@ -2,7 +2,7 @@
     1.4  ;;; YaTeX and yahtml common libraries, general functions and definitions
     1.5  ;;; yatexlib.el
     1.6  ;;; (c)1994-2009 by HIROSE Yuuji.[yuuji@yatex.org]
     1.7 -;;; Last modified Wed Feb 16 19:58:33 2011 on firestorm
     1.8 +;;; Last modified Fri Feb 18 15:05:08 2011 on firestorm
     1.9  ;;; $Id$
    1.10  
    1.11  ;; General variables
    1.12 @@ -465,13 +465,12 @@
    1.13  ;;;###autoload
    1.14  (defun rindex (string char)
    1.15    (let ((pos (1- (length string)))(index -1))
    1.16 -    (while (>= pos 0)
    1.17 -      (cond
    1.18 -       ((= (aref string pos) char)
    1.19 -	(setq index pos) (setq pos -1))
    1.20 -       (t (setq pos (1- pos))))
    1.21 -      )
    1.22 -    index))
    1.23 +    (catch 'rindex
    1.24 +      (while (>= pos 0)
    1.25 +	(cond
    1.26 +	 ((= (aref string pos) char)
    1.27 +	  (throw 'rindex pos))
    1.28 +	 (t (setq pos (1- pos))))))))
    1.29  
    1.30  ;;;###autoload
    1.31  (defun point-beginning-of-line ()