mjab@THINK.COM (02/04/89)
"GNU Emacs 18.49.20 of Wed Nov 11 1987 on medusa.think.com (berkeley-unix)" The following code demonstrates a bug in GNU Emacs when searching for patterns which contain meta characters. This comes up often if a 256 character font such as APL is in use. The variable case-fold-search seems to affect searching for these non-alphabetic characters in an odd way. When case-fold-search is T, the pattern is not found correctly. When case-fold-search is nil it is found. The variable case-fold-search should have no effect on non-alphabetic characters which do not have "case". If it must have an effect, I would expect it to be the opposite of what it is. (setq case-fold-search t) should make the search more permissive, not less. (defun demonstrate-bug() "Return value of nil means search for metacharacters affected by case-fold-search" (let ((under128 "I think GNU emacs is wonderful") (over127) ;manufacture these because they can't be emailed (string) (when-nil)) (setq over127 (mapconcat (function (lambda (c) (char-to-string (logior 128 c)))) under128 "")) (setq string (concat under128 over127 "but I want it to handle APL characters")) ;(elt string 30) is character 201 "iota" (setq case-fold-search nil) (setq when-nil (string-match "[^ a-zA-z0-9]+but" string)) (setq case-fold-search t) (debug) (= when-nil (string-match "[^ a-zA-z0-9]+but" string)))) ============================================= Michael J. A. Berrry Internet: mjab@think.com uucp: {harvard, ihnp4, seismo}!think!mjab =============================================