changeset: 4501:c4fd85dd95bd72e8c7899ed48075c2fb26e365fa
tag: tip
user: Aidan Kehoe <kehoea(a)parhasard.net>
date: Wed Aug 20 17:39:56 2008 +0200
files: lisp/ChangeLog lisp/subr.el
description:
Add #'skip-chars-quote to subr.el
2008-08-09 Aidan Kehoe <kehoea(a)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.
diff -r c86a3c1b7416aa8f0faccdf02e2597c6a0320b15 -r
c4fd85dd95bd72e8c7899ed48075c2fb26e365fa lisp/ChangeLog
--- a/lisp/ChangeLog Wed Aug 20 17:36:27 2008 +0200
+++ b/lisp/ChangeLog Wed Aug 20 17:39:56 2008 +0200
@@ -1,3 +1,10 @@ 2008-08-09 Aidan Kehoe <kehoea@parhasa
+2008-08-09 Aidan Kehoe <kehoea(a)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(a)parhasard.net>
* mule/cyril-util.el: Remove. Use the version in packages instead.
diff -r c86a3c1b7416aa8f0faccdf02e2597c6a0320b15 -r
c4fd85dd95bd72e8c7899ed48075c2fb26e365fa lisp/subr.el
--- a/lisp/subr.el Wed Aug 20 17:36:27 2008 +0200
+++ b/lisp/subr.el Wed Aug 20 17:39:56 2008 +0200
@@ -1722,4 +1722,25 @@ one is kept."
;; 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
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches