# HG changeset patch # User yuuji@gentei.org # Date 1298010801 -32400 # Node ID ab02213f568359055513b01c4d85e49dedb1d565 # Parent 7dc3c2332da594c8f88959fb53b8ea7bd3f061d2 rindex: return nil, instead of -1, if no match found. diff -r 7dc3c2332da5 -r ab02213f5683 yatexlib.el --- a/yatexlib.el Fri Feb 18 14:52:12 2011 +0900 +++ b/yatexlib.el Fri Feb 18 15:33:21 2011 +0900 @@ -2,7 +2,7 @@ ;;; YaTeX and yahtml common libraries, general functions and definitions ;;; yatexlib.el ;;; (c)1994-2009 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Wed Feb 16 19:58:33 2011 on firestorm +;;; Last modified Fri Feb 18 15:05:08 2011 on firestorm ;;; $Id$ ;; General variables @@ -465,13 +465,12 @@ ;;;###autoload (defun rindex (string char) (let ((pos (1- (length string)))(index -1)) - (while (>= pos 0) - (cond - ((= (aref string pos) char) - (setq index pos) (setq pos -1)) - (t (setq pos (1- pos)))) - ) - index)) + (catch 'rindex + (while (>= pos 0) + (cond + ((= (aref string pos) char) + (throw 'rindex pos)) + (t (setq pos (1- pos)))))))) ;;;###autoload (defun point-beginning-of-line ()