diff lisp/syntax.el @ 4806:fd36a980d701

Use uninterned symbols in various information-hiding contexts. lisp/ChangeLog addition: 2010-01-01 Aidan Kehoe <kehoea@parhasard.net> * syntax.el (map-syntax-table): * subr.el (map-plist): * startup.el (load-init-file): * minibuf.el (read-from-minbuffer): * cus-edit.el (custom-load-custom-defines-1): * cmdloop.el (execute-extended-command): Replace symbol names using underscore, whether to avoid dynamic scope problems or to ensure helpful arguments to #'call-with-condition-handler, with uninterned symbols. src/ChangeLog addition: 2010-01-01 Aidan Kehoe <kehoea@parhasard.net> * mule-charset.c (Fmake_charset): Don't intern the symbols used to refer to temporary character sets, that doesn't bring us anything.
author Aidan Kehoe <kehoea@parhasard.net>
date Fri, 01 Jan 2010 19:45:39 +0000
parents a78d697ccd2c
children 99e465e2da2e
line wrap: on
line diff
--- a/lisp/syntax.el	Sat Dec 05 01:04:17 2009 +0900
+++ b/lisp/syntax.el	Fri Jan 01 19:45:39 2010 +0000
@@ -205,21 +205,35 @@
 	  (wrong-type-argument 'syntax-table-p syntax-table))))
   nil)
 
-(defun map-syntax-table (__function __syntax_table &optional __range)
-  "Map FUNCTION over entries in SYNTAX-TABLE, collapsing inheritance.
+((macro
+  . (lambda (map-syntax-definition)
+      "Replace the variable names in MAP-SYNTAX-DEFINITION with uninterned
+symbols, at byte-compile time.  This avoids the risk of variable names
+within the functions called from MAP-SYNTAX-DEFINITION being shared with
+MAP-SYNTAX-DEFINITION, and as such subject to modification, one of the
+common downsides of dynamic scope."
+      (nsublis
+       '((syntax-table . #:syntax-table)
+	 (m-s-function . #:function)
+	 (range . #:range)
+	 (key . #:key)
+	 (value . #:value))
+       map-syntax-definition)))
+ (defun map-syntax-table (m-s-function syntax-table &optional range)
+   "Map FUNCTION over entries in SYNTAX-TABLE, collapsing inheritance.
 This is similar to `map-char-table', but works only on syntax tables, and
  collapses any entries that call for inheritance by invisibly substituting
  the inherited values from the standard syntax table."
-  (check-argument-type 'syntax-table-p __syntax_table)
-  (map-char-table #'(lambda (__key __value)
-		      (if (eq ?@ (char-syntax-from-code __value))
-			  (map-char-table #'(lambda (__key __value)
-					      (funcall __function
-						       __key __value))
-					  (standard-syntax-table)
-					  __key)
-			(funcall __function __key __value)))
-		  __syntax_table __range))
+   (check-argument-type 'syntax-table-p syntax-table)
+   (map-char-table #'(lambda (key value)
+		       (if (eq ?@ (char-syntax-from-code value))
+			   (map-char-table
+			    #'(lambda (key value)
+				(funcall m-s-function key value))
+			    (standard-syntax-table)
+			    key)
+			 (funcall m-s-function key value)))
+		   syntax-table range)))
 
 ;(defun test-xm ()
 ;  (let ((o (copy-syntax-table))