changeset 924:1b114504fa80

[xemacs-hg @ 2002-07-16 08:18:35 by didierv] fix case problem in replace-in-string
author didierv
date Tue, 16 Jul 2002 08:18:36 +0000
parents 3b122a8e1d51
children c4937d1216b6
files lisp/ChangeLog lisp/subr.el
diffstat 2 files changed, 110 insertions(+), 101 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Jul 14 23:20:36 2002 +0000
+++ b/lisp/ChangeLog	Tue Jul 16 08:18:36 2002 +0000
@@ -1,3 +1,9 @@
+2002-07-16  Didier Verna  <didier@xemacs.org>
+
+	* subr.el (replace-in-string): fix case fold bug introduced by
+	"2000-07-30  Ben Wing  <ben@xemacs.org>": honor the value of
+	case-fold-search in temporary buffers.
+
 2002-07-01  Mike Alexander  <mta@arbortext.com>
 
 	* code-process.el (call-process-region): Don't delete the process
@@ -118,7 +124,7 @@
 
 	* mule/mule-msw-init-late.el:
 	Specify charset->windows-registry conversion.
-	
+
 	* mule/mule-x-init.el:
 	* mule/mule-x-init.el (x-use-halfwidth-roman-font):
 	* mule/mule-x-init.el (init-mule-x-win):
@@ -130,7 +136,7 @@
 	* cl-macs.el (defmacro*):
 	* cl-macs.el (destructuring-bind):
 	Document better.
-	
+
 	* font-lock.el (lisp-font-lock-keywords-1):
 	Move Lisp function regexp to lisp-mode.el.
 
@@ -140,12 +146,12 @@
 	* lisp-mode.el (lisp-indent-function):
 	* lisp-mode.el (lisp-indent-quoteform): New.
 	Various indentation fixes:
-	
+
 	Handle flet functions better.
 	Handle argument lists in defuns and flets.
 	Handle quoted lists, e.g. property lists -- don't indent like
 	function calls.  Distinguish between lambdas and other lists.
-	
+
 	* lisp-mode.el (save-selected-device): Handle this form.
 
 	* faces.el:
@@ -235,12 +241,12 @@
 	written code).  This also means that we need to work with font
 	names at all times and not font instances, because a font instance
 	is essentially a truenamed font.
-	
+
 	-- Total rewrite of extremely junky code in msw-faces.el.  Work
 	with names as well as font instances, and return names; stop
 	truenaming when canonicalizing and frobbing; fix handling of the
 	combined style field, i.e. weight/slant (also fixed in font.el).
-	
+
 	-- Totally rewrite the frobbing functions in faces.el.  This time,
 	we frob all the instantiators rather than just computing a single
 	instance value and working backwards.  That way, e.g., `bold' will
@@ -272,10 +278,10 @@
 	-- Correct weight names in font.el.
 
 	-- Lots more font fixups in objects*.c.
-	
+
 	* Printer.el (generic-print-region):
 	Warning fix.
-	
+
 	* specifier.el:
 	* specifier.el (map-specifier):
 	* specifier.el (modify-specifier-instances):
@@ -297,7 +303,7 @@
 	* subr.el (argument-in-range-p): New.
 	* subr.el (check-argument-range): New.
 	New functions.
-	
+
 
 2002-06-04  Andy Piper  <andy@xemacs.org>
 
@@ -366,7 +372,7 @@
 2001-11-30  Jan Vroonhof  <jan@xemacs.org>
 
 	* font.el (font-window-system-mappings): Add mapping for Gtk
-	(assume identical to X)	
+	(assume identical to X)
 
 2001-11-30  Jan Vroonhof  <jan@xemacs.org>
 
@@ -448,7 +454,7 @@
 	misunderstood the basic point of this function, which is work in
 	*columns* not chars.  i dumped ours and copied the version from
 	FSF 21.1.  Also added truncate-string-with-continuation-dots,
-	since this idiom is used often.  
+	since this idiom is used often.
 
 2002-04-07  William M. Perry  <wmperry@gnu.org>
 
@@ -493,7 +499,7 @@
 	* code-init.el (coding-system-variable-default-value):
 	Don't use CRLF conversion by default on process output.  CMD.EXE and
 	friends work both ways but Cygwin programs don't like the CRs.
-	
+
 	* code-process.el:
 	* code-process.el (process-coding-system-alist):
 	* code-process.el (call-process):
@@ -526,7 +532,7 @@
 
 	open-multicast-group now does similar coding-system frobbing to
 	open-network-stream.
-	
+
 	* dumped-lisp.el (preloaded-file-list):
 	* faces.el (init-global-faces):
 	* msw-faces.el (mswindows-init-global-faces): New.
@@ -546,7 +552,7 @@
 	* files.el (Recover-session-files-from-auto-save-list-file): New.
 	Recover-session improvements: Only show session files where some
 	files can actually be recovered, and show in chronological order.
-	
+
 	* subr.el:
 	* subr.el (truncate-string-to-width):
 	* subr.el (BUG): New.
@@ -556,7 +562,7 @@
 	As promised to rms, the functionality in
 	truncate-string-with-continuation-dots has been merged into
 	truncate-string-to-width.  Change callers in menubar-items.el.
-	
+
 	* select.el:
 	* select.el (copy-primary-selection):
 	* select.el (kill-primary-selection):
@@ -580,7 +586,7 @@
 	Save customized values MUCH faster by keeping often used lambdas
 	in cache `custom-save-resets-mapper-alist' instead of building them
 	on the fly in `custom-save-resets'.
-	
+
 	* cus-edit.el (custom-save-pretty-print): New variable
 	(custom-save-variable-p): New function
 	(custom-save-variable-internal): New function
@@ -598,7 +604,7 @@
 	multiple-choice question, automatically choosing a dialog box or
 	minibuffer representation as necessary.  Generalized version of
 	yes-or-no-p, y-or-n-p.
-	
+
 	* files.el:
 	* files.el (recover-file-diff-program): New.
 	* files.el (recover-file-diff-arguments): New.
@@ -608,7 +614,7 @@
 	autosave. (Converts/deconverts escape-quoted as necessary.  No more
 	complaints from you, Mr. Turnbull!) One known problem: when a dialog
 	is used, it's modal, so you can't scroll the diff.  Will fix soon.
-	
+
 	* lisp-mode.el (lisp-fill-paragraph):
 	If we're filling a string, don't treat semicolon as a comment,
 	which would give very unfriendly results.
@@ -630,7 +636,7 @@
 
 	* menubar-items.el (default-menubar):
 	Add option corresponding to kill-word-into-kill-ring.
-	
+
 2002-05-09  Stephen J. Turnbull  <stephen@xemacs.org>
 
 	This patch is based on Jerry James's patch and analysis.
@@ -650,7 +656,7 @@
 
 	* files.el (revert-buffer):
 	Andy's patch from 21.4.  Fix evil nasty problems with revert-buffer.
-	
+
 	* menubar-items.el (default-menubar):
 	Add Append to Register to Rectangles/Register menu.
 
@@ -810,7 +816,7 @@
 
 	* lisp-mode.el (construct-lisp-mode-menu):
 	Rearrange and add items for macro expanding.
-	
+
 	* menubar-items.el (menu-split-long-menu):
 	* menubar-items.el (menu-sort-menu):
 	Document connection between these two functions.
@@ -830,7 +836,7 @@
 	* mule/english.el (ascii-right-to-left):
 	Define this charset now, since a bug was fixed that formerly
 	prevented it.
-	
+
 	* mule/ethio-util.el (ethio-fidel-to-java-buffer):
 	* mule/ethio-util.el (ethio-java-to-fidel-buffer):
 	Fix compile errors involving Unicode `characters', which should be
@@ -867,7 +873,7 @@
 	down.  Extend mouse-track{,adjust,insert,delete-and-insert} this
 	way.  Move mouse-track-do-rectangle to meta-button2; not nearly so
 	useful (and doesn't really work correctly currently).
-	
+
 	* auto-save.el:
 	* auto-save.el (make-auto-save-file-name):
 	* auto-save.el (recover-all-files):
@@ -908,7 +914,7 @@
 	catching all errors and displaying a warning, including a
 	backtrace showing where the error occurred.  Modify various files
 	to use this.
-	
+
 	Show all warnings in the echo area (in a format convenient for
 	this) as well as the Warnings buffer.  Change the interpretation
 	of display-warning-minimum-level so that warnings below this level
@@ -922,13 +928,13 @@
 	various files consistent with the new definitions.
 
 	Mark all warnings with extents.
- 	
+
 	* startup.el (load-init-file):
 	Modify so that a backtrace is seen when an error occurs.
-	
+
 	* help.el (view-warnings): New.
 	New function for viewing warnings buffer.
-	
+
 	* help.el:
 	* help.el (print-recent-messages):
 	* simple.el:
@@ -936,12 +942,12 @@
 	Integrate show-message-log with view-lossage.  Add option to
 	view-lossage to view only the messages.  Clear message first so
 	latest message is seen.
-	
+
 	* menubar-items.el:
 	* menubar-items.el (default-menubar):
 	* menubar-items.el (bookmark-menu-filter): Removed.
 	Various rearrangements and fixes.
-	
+
 	* msw-faces.el:
 	* msw-faces.el (gui-element):
 	* msw-faces.el (mswindows-init-device-faces):
@@ -971,7 +977,7 @@
 	* mule\mule-category.el (with-category-table): New.
 	Start implementing a category API compatible with FSF.  Not there yet.
 	We need improvements to char-tables.
-	
+
 	* mule\mule-charset.el:
 	* mule\mule-charset.el ((translation-table): New.
 	* mule\mule-charset.el (make-translation-table): New.
@@ -1035,7 +1041,7 @@
 	* mule\lao.el (?):
 	* mule\lao.el (lao):
 	Convert stuff to XEmacs-style.
-	
+
 	* mule\thai-xtis.el:
 	* mule\thai-xtis.el (thai-xtis):
 	* mule\thai-xtis.el (?x): New.
@@ -1056,7 +1062,7 @@
 	* dumped-lisp.el (preloaded-file-list):
 	Load the remaining languages -- lao, indian, devanagari, tibetan.
 	Load new file mule-msw-init-late.
-	
+
 	* unicode.el (load-unicode-tables):
 	* unicode.el (init-unicode-at-startup):
 	Load the new tables for Ethiopic, Vietnamese, and other languages
@@ -1126,14 +1132,14 @@
 	* autoload.el (generate-autoload-cookie):
 	* autoload.el (defun*):
 	Support defun*, defmacro*.
-	
+
 	* mule/mule-composite.el: New file, from FSF.
 	* mule/mule-composite-stub.el: New file, stubs for nonexistent
 	composition funs/vars.
 	* mule/viet-chars.el: Deleted, moved into vietnamese.el.
 	* dumped-lisp.el (preloaded-file-list):
 	Account for these changes.
-	
+
 	* font.el (mswindows-font-create-object):
 	* mouse.el (mouse-begin-drag-n-drop):
 	* msw-font-menu.el (mswindows-font-regexp):
@@ -1187,7 +1193,7 @@
 	* behavior-defs.el (func-menu):
 	* behavior-defs.el (filladapt):
 	fix errors with require.
-	
+
 	* bytecomp-runtime.el:
 	* bytecomp-runtime.el (with-boundp):
 	* bytecomp-runtime.el (if-boundp):
@@ -1206,7 +1212,7 @@
 
 	* cus-edit.el (custom-save-variables):
 	pretty-print values.
-	
+
 	* dump-paths.el:
 	* dump-paths.el (startup-setup-paths): New.
 	* find-paths.el:
@@ -1228,7 +1234,7 @@
 	* lisp-mode.el (while):
 	indent macrolet and labels correctly.  update comments about
 	lisp-indent-function.  flet already handled in cl.
-	
+
 	* apropos.el (apropos-safe-documentation):
 	* auto-save.el (make-auto-save-file-name):
 	* buff-menu.el (default-list-buffers-identification):
@@ -1298,7 +1304,7 @@
 	* toolbar.el (default-toolbar-position): but I tested it! typo fix.
 
 2002-03-05  Mats Lidell  <matsl@contactor.se>
- 
+
  	* help-nomule.el (tutorial-supported-languages): Added Swedish
  	tutorial. Sorted languages.
 
@@ -1392,15 +1398,15 @@
 
 2001-12-27  David A. Panariti  <davep@who.net>
 
-	* hyper-apropos.el (hyper-apropos-find-variable): 
+	* hyper-apropos.el (hyper-apropos-find-variable):
 	Added this function based on hyper-apropos-find-function.
 
-	* hyper-apropos.el (hyper-apropos-help-map): 
+	* hyper-apropos.el (hyper-apropos-help-map):
 	Added binding of "v" to hyper-apropos-find-variable.
 
 2001-12-27  John Paul Wallington  <jpw@shootybangbang.com>
 
-	* obsolete.el (interactive-form): new compatibility alias for 
+	* obsolete.el (interactive-form): new compatibility alias for
 	function-interactive.
 
 2001-12-26  Adrian Aichner  <adrian@xemacs.org>
@@ -1416,11 +1422,11 @@
 
 2001-12-18  John Paul Wallington  <jpw@shootybangbang.com>
 
-	* gnuserv.el: 
+	* gnuserv.el:
 	(gnuserv-mode-line-string): new customizable variable
 	(gnuserv-minor-mode): make variable buffer-local
 	* isearch-mode.el:
-	(isearch-mode-line-string): new customizable variable	
+	(isearch-mode-line-string): new customizable variable
 
 2001-12-16  Andy Piper  <andy@xemacs.org>
 
@@ -1438,13 +1444,13 @@
 
 	* gui.el (gui-button-face): Ditto.
 
-	* faces.el (text-cursor): 
-	(highlight): 
-	(zmacs-region): 
-	(list-mode-item-selected): 
-	(primary-selection): 
-	(secondary-selection): 
-	(isearch): 
+	* faces.el (text-cursor):
+	(highlight):
+	(zmacs-region):
+	(list-mode-item-selected):
+	(primary-selection):
+	(secondary-selection):
+	(isearch):
 	(isearch-secondary): Condense old window-system specific settings
 	into one specifier using the 'win default' tags.
 
@@ -1469,7 +1475,7 @@
 2001-11-30  Jan Vroonhof  <jan@xemacs.org>
 
 	* font.el (font-window-system-mappings): Add mapping for Gtk
-	(assume identical to X)	
+	(assume identical to X)
 
 2001-11-30  Jan Vroonhof  <jan@xemacs.org>
 
@@ -1506,7 +1512,7 @@
 
 2002-03-26  John Paul Wallington  <jpw@xemacs.org>
 
-	* obsolete.el (assq-delete-all): New compatibility alias for 
+	* obsolete.el (assq-delete-all): New compatibility alias for
 	remassq.
 
 2002-01-09  Simon Josefsson  <jas@extundo.com>
@@ -1529,7 +1535,7 @@
 	"system default" Xdefaults and friends get xrdb-mode.
 
 2002-03-05  Mats Lidell  <matsl@contactor.se>
- 
+
  	* help-nomule.el (tutorial-supported-languages): Added Swedish
  	tutorial. Sorted languages.
 
@@ -1553,7 +1559,7 @@
 
 2001-12-27  John Paul Wallington  <jpw@shootybangbang.com>
 
-	* obsolete.el (interactive-form): new compatibility alias for 
+	* obsolete.el (interactive-form): new compatibility alias for
 	function-interactive.
 
 2001-11-29  Adrian Aichner  <adrian@xemacs.org>
@@ -1599,7 +1605,7 @@
 
 	* dialog-gtk.el (popup-builtin-question-dialog):
 	Conform to API in gui.c.
-	
+
 2001-11-12  Andy Piper  <andy@xemacs.org>
 
 	* cus-edit.el (custom-save-face-internal): make sure we save
@@ -1641,8 +1647,8 @@
 
 2001-11-29  John Paul Wallington <jpw@shootybangbang.com>
 
-	* gtk-faces.el (gtk-init-device-faces): Replaced device locale 
-	argument in set-face-background/foreground forms with 
+	* gtk-faces.el (gtk-init-device-faces): Replaced device locale
+	argument in set-face-background/foreground forms with
 	'(default gtk) tag set to make the faces customizable, as
 	suggested by Jan Vroonhof.
 
@@ -1680,7 +1686,7 @@
 
 2001-12-04  John Paul Wallington  <jpw@shootybangbang.com>
 
-	* paragraphs.el (mark-paragraph): synched with FSF; 
+	* paragraphs.el (mark-paragraph): synched with FSF;
         added optional argument.
 
 2001-12-03  Didier Verna  <didier@xemacs.org>
--- a/lisp/subr.el	Sun Jul 14 23:20:36 2002 +0000
+++ b/lisp/subr.el	Tue Jul 16 08:18:36 2002 +0000
@@ -193,27 +193,27 @@
 	  (null function))		;function is nil, then
       nil				;Do nothing.
     (flet ((hook-remove
-	    (function hook-value)
-	    (flet ((hook-test
-		    (fn hel)
-		    (or (equal fn hel)
-			(and (symbolp hel)
-			     (equal fn
-				    (get hel 'one-shot-hook-fun))))))
-	      (if (and (consp hook-value)
-		       (not (functionp hook-value)))
-		  (if (member* function hook-value :test 'hook-test)
-		      (setq hook-value
-			    (delete* function (copy-sequence hook-value)
-				     :test 'hook-test)))
-		(if (equal hook-value function)
-		    (setq hook-value nil)))
-	      hook-value)))
+	     (function hook-value)
+	     (flet ((hook-test
+		      (fn hel)
+		      (or (equal fn hel)
+			  (and (symbolp hel)
+			       (equal fn
+				      (get hel 'one-shot-hook-fun))))))
+	       (if (and (consp hook-value)
+		     (not (functionp hook-value)))
+		   (if (member* function hook-value :test 'hook-test)
+		     (setq hook-value
+			   (delete* function (copy-sequence hook-value)
+				    :test 'hook-test)))
+		 (if (equal hook-value function)
+		   (setq hook-value nil)))
+	       hook-value)))
       (if (or local
-	      ;; Detect the case where make-local-variable was used on a hook
-	      ;; and do what we used to do.
-	      (and (local-variable-p hook (current-buffer))
-		   (not (memq t (symbol-value hook)))))
+	    ;; Detect the case where make-local-variable was used on a hook
+	    ;; and do what we used to do.
+	    (and (local-variable-p hook (current-buffer))
+		 (not (memq t (symbol-value hook)))))
 	  (set hook (hook-remove function (symbol-value hook)))
 	(set-default hook (hook-remove function (default-value hook)))))))
 
@@ -401,18 +401,20 @@
   (check-argument-type 'stringp str)
   (check-argument-type 'stringp newtext)
   (if (> (length str) 50)
-      (with-temp-buffer
-	(insert str)
-	(goto-char 1)
+      (let ((cfs case-fold-search))
+	(with-temp-buffer
+	  (setq case-fold-search cfs)
+	  (insert str)
+	  (goto-char 1)
 	  (while (re-search-forward regexp nil t)
 	    (replace-match newtext t literal))
-	  (buffer-string))
-  (let ((start 0) newstr)
-    (while (string-match regexp str start)
-      (setq newstr (replace-match newtext t literal str)
-	    start (+ (match-end 0) (- (length newstr) (length str)))
-	    str newstr))
-    str)))
+	  (buffer-string)))
+    (let ((start 0) newstr)
+      (while (string-match regexp str start)
+	(setq newstr (replace-match newtext t literal str)
+	      start (+ (match-end 0) (- (length newstr) (length str)))
+	      str newstr))
+      str)))
 
 (defun split-string (string &optional pattern)
   "Return a list of substrings of STRING which are separated by PATTERN.
@@ -464,8 +466,8 @@
 The value returned is the value of the last form in BODY.
 See also `with-temp-buffer'."
   `(save-current-buffer
-    (set-buffer ,buffer)
-    ,@body))
+     (set-buffer ,buffer)
+     ,@body))
 
 (defmacro with-temp-file (filename &rest forms)
   "Create a new buffer, evaluate FORMS there, and write the buffer to FILENAME.
@@ -672,7 +674,7 @@
 	       ;; width.  the padding computed will get us exactly up to
 	       ;; the shorted width, which is right -- it just gets added
 	       ;; to the right of the ellipses.
-	     (setq end-column (- end-column (string-width ellipses)))))
+	       (setq end-column (- end-column (string-width ellipses)))))
 
 	;; find the index of END-COLUMN; bail out if end of string reached.
 	(condition-case nil
@@ -967,12 +969,12 @@
 `args-out-of-range' error if the returned value is out of range."
   (if (symbolp argument)
       `(if (not (argument-in-range-p ,argument ,min ,max))
-	(setq ,argument
-	      (args-out-of-range ,argument ,min ,max)))
+	   (setq ,argument
+		 (args-out-of-range ,argument ,min ,max)))
     (let ((newsym (gensym)))
       `(let ((,newsym ,argument))
-	(if (not (argument-in-range-p ,newsym ,min ,max))
-	    (signal-error 'args-out-of-range ,newsym ,min ,max))))))
+	 (if (not (argument-in-range-p ,newsym ,min ,max))
+	     (signal-error 'args-out-of-range ,newsym ,min ,max))))))
 
 (defun signal-error (error-symbol data)
   "Signal a non-continuable error.  Args are ERROR-SYMBOL, and associated DATA.
@@ -1158,11 +1160,12 @@
 (if (not (fboundp 'define-abbrev-table))
     (progn
       (setq abbrev-table-name-list '())
-      (fset 'define-abbrev-table (function (lambda (name defs)
-                                   ;; These are fixed-up when abbrev.el loads.
-                                   (setq abbrev-table-name-list
-                                         (cons (cons name defs)
-                                               abbrev-table-name-list)))))))
+      (fset 'define-abbrev-table
+	    (function (lambda (name defs)
+			;; These are fixed-up when abbrev.el loads.
+			(setq abbrev-table-name-list
+			      (cons (cons name defs)
+				    abbrev-table-name-list)))))))
 
 ;;; `functionp' has been moved into C.
 
@@ -1270,7 +1273,7 @@
 ; alternate names (not obsolete)
 (if (not (fboundp 'mod)) (define-function 'mod '%))
 (define-function 'move-marker 'set-marker)
-(define-function 'beep 'ding)  ; preserve lingual purity
+(define-function 'beep 'ding)		; preserve lingual purity
 (define-function 'indent-to-column 'indent-to)
 (define-function 'backward-delete-char 'delete-backward-char)
 (define-function 'search-forward-regexp (symbol-function 're-search-forward))