commit: Add #'skip-chars-quote to subr.el

Aidan Kehoe aidan-guest at alioth.debian.org
Tue Dec 30 15:34:15 EST 2008


changeset:   4565:31344162cf9ada294e34a48c10daa1242b6e310e
parent:      4493:89406c31b12521258c83389d19f80440a3a7ce48
user:        Aidan Kehoe <kehoea at parhasard.net>
date:        Sat Aug 09 13:06:24 2008 +0200
files:       lisp/ChangeLog lisp/subr.el
description:
Add #'skip-chars-quote to subr.el

2008-08-09  Aidan Kehoe  <kehoea at 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 89406c31b12521258c83389d19f80440a3a7ce48 -r 31344162cf9ada294e34a48c10daa1242b6e310e lisp/ChangeLog
--- a/lisp/ChangeLog	Sat Aug 09 12:13:19 2008 +0200
+++ b/lisp/ChangeLog	Sat Aug 09 13:06:24 2008 +0200
@@ -1,4 +1,13 @@ 2008-08-09  Aidan Kehoe  <kehoea at parhasa
 2008-08-09  Aidan Kehoe  <kehoea at 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 at parhasard.net>
+
+	* subr.el (skip-chars-quote): New.
 
 	* mule/cyril-util.el: Remove. Use the version in packages instead.
 
diff -r 89406c31b12521258c83389d19f80440a3a7ce48 -r 31344162cf9ada294e34a48c10daa1242b6e310e lisp/subr.el
--- 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 @@ 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





More information about the XEmacs-Patches mailing list