Mercurial > hg > xemacs-beta
changeset 4565:31344162cf9a
Add #'skip-chars-quote to subr.el
2008-08-09 Aidan Kehoe <kehoea@parhasard.net>
* subr.el (skip-chars-quote): New.
Given STRING, return a string that means that all characters in
STRING will be skipped when passed to #'skip-chars-forward,
#'skip-chars-backward.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sat, 09 Aug 2008 13:06:24 +0200 |
parents | 89406c31b125 |
children | 26aae3bacf99 |
files | lisp/ChangeLog lisp/subr.el |
diffstat | 2 files changed, 30 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Sat Aug 09 12:13:19 2008 +0200 +++ b/lisp/ChangeLog Sat Aug 09 13:06:24 2008 +0200 @@ -1,5 +1,14 @@ 2008-08-09 Aidan Kehoe <kehoea@parhasard.net> + * subr.el (skip-chars-quote): New. + Given STRING, return a string that means that all characters in + STRING will be skipped when passed to #'skip-chars-forward, + #'skip-chars-backward. + +2008-08-09 Aidan Kehoe <kehoea@parhasard.net> + + * subr.el (skip-chars-quote): New. + * mule/cyril-util.el: Remove. Use the version in packages instead. 2008-08-08 Aidan Kehoe <kehoea@parhasard.net>
--- a/lisp/subr.el Sat Aug 09 12:13:19 2008 +0200 +++ b/lisp/subr.el Sat Aug 09 13:06:24 2008 +0200 @@ -1722,4 +1722,25 @@ ;; define-mail-user-agent is in simple.el. +;; XEmacs; added. +(defun skip-chars-quote (string) + "Return a string that means all characters in STRING will be skipped, +if passed to `skip-chars-forward' or `skip-chars-backward'. + +Ranges and carets are not treated specially. This implementation is +in Lisp; do not use it in performance-critical code." + (let ((list (delete-duplicates (string-to-list string) :test #'=))) + (when (equal list '((?- ?\[) (?\[ ?\-))) + (error 'invalid-argument + "Cannot create `skip-chars-forward' arg from string" + string)) + (when (memq ?\] list) + (setq list (cons ?\] (delq ?\] list)))) + (when (eq ?^ (car list)) + (setq list (nconc (cdr list) '(?^)))) + (when (memq ?- list) + (setq list (delq ?- list) + list (nconc list (list (second list) ?- (second list) ?-)))) + (apply #'string list))) + ;;; subr.el ends here