aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1995-04-25 03:24:37 +0000
committerRichard M. Stallman1995-04-25 03:24:37 +0000
commitdc84b03da7d8059078e373b33d444b44a0dc7b73 (patch)
treedf94eb25a6328cb9789dab192618f8ca55191cba
parente20008859b2c05206cf964be4c239697ac15e806 (diff)
downloademacs-dc84b03da7d8059078e373b33d444b44a0dc7b73.tar.gz
emacs-dc84b03da7d8059078e373b33d444b44a0dc7b73.zip
(tpu-search-internal): Case-sensitive search if search
string contains upper-case. tpu-check-search-case): New function.
-rw-r--r--lisp/emulation/tpu-edt.el61
1 files changed, 39 insertions, 22 deletions
diff --git a/lisp/emulation/tpu-edt.el b/lisp/emulation/tpu-edt.el
index 74cb0501765..a28a312e621 100644
--- a/lisp/emulation/tpu-edt.el
+++ b/lisp/emulation/tpu-edt.el
@@ -1,6 +1,6 @@
1;;; tpu-edt.el --- Emacs emulating TPU emulating EDT 1;;; tpu-edt.el --- Emacs emulating TPU emulating EDT
2 2
3;; Copyright (C) 1993, 1994 Free Software Foundation, Inc. 3;; Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
4 4
5;; Author: Rob Riepel <riepel@networking.stanford.edu> 5;; Author: Rob Riepel <riepel@networking.stanford.edu>
6;; Maintainer: Rob Riepel <riepel@networking.stanford.edu> 6;; Maintainer: Rob Riepel <riepel@networking.stanford.edu>
@@ -911,33 +911,50 @@ direction. If an argument is specified, don't set the search direction."
911 (tpu-unset-match) 911 (tpu-unset-match)
912 (tpu-adjust-search) 912 (tpu-adjust-search)
913 913
914 (cond ((tpu-emacs-search tpu-search-last-string nil t) 914 (let ((case-fold-search
915 (tpu-set-match) (goto-char (tpu-match-beginning))) 915 (and case-fold-search (tpu-check-search-case tpu-search-last-string))))
916 916
917 (t 917 (cond ((tpu-emacs-search tpu-search-last-string nil t)
918 (tpu-adjust-search t) 918 (tpu-set-match) (goto-char (tpu-match-beginning)))
919 (let ((found nil) (pos nil))
920 (save-excursion
921 (let ((tpu-searching-forward (not tpu-searching-forward)))
922 (tpu-adjust-search)
923 (setq found (tpu-emacs-rev-search tpu-search-last-string nil t))
924 (setq pos (match-beginning 0))))
925 919
926 (cond (found 920 (t
927 (cond ((tpu-y-or-n-p 921 (tpu-adjust-search t)
928 (format "Found in %s direction. Go there? " 922 (let ((found nil) (pos nil))
929 (if tpu-searching-forward "reverse" "forward"))) 923 (save-excursion
930 (goto-char pos) (tpu-set-match) 924 (let ((tpu-searching-forward (not tpu-searching-forward)))
931 (tpu-toggle-search-direction)))) 925 (tpu-adjust-search)
926 (setq found (tpu-emacs-rev-search tpu-search-last-string nil t))
927 (setq pos (match-beginning 0))))
928
929 (cond
930 (found
931 (cond ((tpu-y-or-n-p
932 (format "Found in %s direction. Go there? "
933 (if tpu-searching-forward "reverse" "forward")))
934 (goto-char pos) (tpu-set-match)
935 (tpu-toggle-search-direction))))
932 936
933 (t 937 (t
934 (if (not quiet) 938 (if (not quiet)
935 (message 939 (message
936 "%sSearch failed: \"%s\"" 940 "%sSearch failed: \"%s\""
937 (if tpu-regexp-p "RE " "") tpu-search-last-string)))))))) 941 (if tpu-regexp-p "RE " "") tpu-search-last-string)))))))))
938 942
939(fset 'tpu-search-internal-core (symbol-function 'tpu-search-internal)) 943(fset 'tpu-search-internal-core (symbol-function 'tpu-search-internal))
940 944
945(defun tpu-check-search-case (string)
946 "Returns t if string contains upper case."
947 ;; if using regexp, elimiate upper case forms (\B \W \S.)
948 (if tpu-regexp-p
949 (let ((pat (copy-sequence string)) (case-fold-search nil) (pos 0))
950 (while (setq pos (string-match "\\\\\\\\" pat)) (aset pat (+ 1 pos) ?.))
951 (while (setq pos (string-match "\\\\B" pat)) (aset pat (+ 1 pos) ?.))
952 (while (setq pos (string-match "\\\\W" pat)) (aset pat (+ 1 pos) ?.))
953 (while (setq pos (string-match "\\\\S." pat))
954 (aset pat (+ 1 pos) ?.) (aset pat (+ 2 pos) ?.))
955 (string-equal pat (downcase pat)))
956 (string-equal string (downcase string))))
957
941(defun tpu-adjust-search (&optional arg) 958(defun tpu-adjust-search (&optional arg)
942 "For forward searches, move forward a character before searching, 959 "For forward searches, move forward a character before searching,
943and backward a character after a failed search. Arg means end of search." 960and backward a character after a failed search. Arg means end of search."