diff options
| author | Richard M. Stallman | 1992-09-21 08:28:43 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1992-09-21 08:28:43 +0000 |
| commit | 35a4d1439f68f77ba05f1d3b57244ebb46c54303 (patch) | |
| tree | 503b0ce5cd44207bc0378ab21db8b562aeb96915 | |
| parent | c7784735dcc01bae7c654483d7511ea846499fe3 (diff) | |
| download | emacs-35a4d1439f68f77ba05f1d3b57244ebb46c54303.tar.gz emacs-35a4d1439f68f77ba05f1d3b57244ebb46c54303.zip | |
entered into RCS
| -rw-r--r-- | lisp/isearch.el | 102 | ||||
| -rw-r--r-- | lisp/progmodes/c-mode.el | 3 | ||||
| -rw-r--r-- | src/lisp.h | 6 |
3 files changed, 43 insertions, 68 deletions
diff --git a/lisp/isearch.el b/lisp/isearch.el index 4b694846e73..4b909d5d428 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el | |||
| @@ -301,8 +301,8 @@ Default value, nil, means edit the string instead.") | |||
| 301 | (or minibuffer-local-isearch-map | 301 | (or minibuffer-local-isearch-map |
| 302 | (let ((map (copy-keymap minibuffer-local-map))) | 302 | (let ((map (copy-keymap minibuffer-local-map))) |
| 303 | (define-key map "\r" 'isearch-nonincremental-exit-minibuffer) | 303 | (define-key map "\r" 'isearch-nonincremental-exit-minibuffer) |
| 304 | ;; (define-key map "\M-n" 'isearch-ring-advance-edit) | 304 | (define-key map "\M-n" 'isearch-ring-advance-edit) |
| 305 | ;; (define-key map "\M-p" 'isearch-ring-retreat-edit) | 305 | (define-key map "\M-p" 'isearch-ring-retreat-edit) |
| 306 | (define-key map "\M-\t" 'isearch-complete-edit) | 306 | (define-key map "\M-\t" 'isearch-complete-edit) |
| 307 | (define-key map "\C-s" 'isearch-forward-exit-minibuffer) | 307 | (define-key map "\C-s" 'isearch-forward-exit-minibuffer) |
| 308 | (define-key map "\C-r" 'isearch-reverse-exit-minibuffer) | 308 | (define-key map "\C-r" 'isearch-reverse-exit-minibuffer) |
| @@ -555,8 +555,9 @@ is treated as a regexp. See \\[isearch-forward] for more info." | |||
| 555 | ) | 555 | ) |
| 556 | 556 | ||
| 557 | 557 | ||
| 558 | (defun isearch-done () | 558 | (defun isearch-done (&optional nopush) |
| 559 | ;; Called by all commands that terminate isearch-mode. | 559 | ;; Called by all commands that terminate isearch-mode. |
| 560 | ;; If NOPUSH is non-nil, we don't push the string on the search ring. | ||
| 560 | (use-local-map isearch-old-local-map) | 561 | (use-local-map isearch-old-local-map) |
| 561 | ;; (setq pre-command-hook isearch-old-pre-command-hook) ; for lemacs | 562 | ;; (setq pre-command-hook isearch-old-pre-command-hook) ; for lemacs |
| 562 | (isearch-dehighlight t) | 563 | (isearch-dehighlight t) |
| @@ -578,7 +579,7 @@ is treated as a regexp. See \\[isearch-forward] for more info." | |||
| 578 | (setq isearch-mode nil) | 579 | (setq isearch-mode nil) |
| 579 | (set-buffer-modified-p (buffer-modified-p)) ;; update modeline | 580 | (set-buffer-modified-p (buffer-modified-p)) ;; update modeline |
| 580 | 581 | ||
| 581 | (if (> (length isearch-string) 0) | 582 | (if (and (> (length isearch-string) 0) (not nopush)) |
| 582 | ;; Update the ring data. | 583 | ;; Update the ring data. |
| 583 | (if isearch-regexp | 584 | (if isearch-regexp |
| 584 | (if (or (null regexp-search-ring) | 585 | (if (or (null regexp-search-ring) |
| @@ -684,7 +685,7 @@ If first char entered is \\[isearch-yank-word], then do word search instead." | |||
| 684 | ;; This is so that the user can do anything without failure, | 685 | ;; This is so that the user can do anything without failure, |
| 685 | ;; like switch buffers and start another isearch, and return. | 686 | ;; like switch buffers and start another isearch, and return. |
| 686 | (condition-case err | 687 | (condition-case err |
| 687 | (isearch-done) | 688 | (isearch-done t) |
| 688 | (exit nil)) ; was recursive editing | 689 | (exit nil)) ; was recursive editing |
| 689 | 690 | ||
| 690 | (isearch-message) ;; for read-char | 691 | (isearch-message) ;; for read-char |
| @@ -715,20 +716,11 @@ If first char entered is \\[isearch-yank-word], then do word search instead." | |||
| 715 | (isearch-unread e)) | 716 | (isearch-unread e)) |
| 716 | (setq cursor-in-echo-area nil) | 717 | (setq cursor-in-echo-area nil) |
| 717 | (setq isearch-new-string | 718 | (setq isearch-new-string |
| 718 | (let ((search-ring search-ring) | 719 | (let (junk-ring) |
| 719 | (regexp-search-ring regexp-search-ring)) | ||
| 720 | (read-from-minibuffer (isearch-message-prefix) | 720 | (read-from-minibuffer (isearch-message-prefix) |
| 721 | isearch-string | 721 | isearch-string |
| 722 | minibuffer-local-isearch-map nil | 722 | minibuffer-local-isearch-map nil |
| 723 | (cons | 723 | 'junk-ring)) |
| 724 | (if isearch-regexp | ||
| 725 | 'regexp-search-ring | ||
| 726 | 'search-ring) | ||
| 727 | (or | ||
| 728 | (if isearch-regexp | ||
| 729 | regexp-search-ring-yank-pointer | ||
| 730 | search-ring-yank-pointer) | ||
| 731 | 0)))) | ||
| 732 | isearch-new-message (mapconcat 'text-char-description | 724 | isearch-new-message (mapconcat 'text-char-description |
| 733 | isearch-new-string ""))) | 725 | isearch-new-string ""))) |
| 734 | ;; Always resume isearching by restarting it. | 726 | ;; Always resume isearching by restarting it. |
| @@ -793,7 +785,7 @@ Use `isearch-exit' to quit without signalling." | |||
| 793 | ;; If search is successful, move back to starting point | 785 | ;; If search is successful, move back to starting point |
| 794 | ;; and really do quit. | 786 | ;; and really do quit. |
| 795 | (progn (goto-char isearch-opoint) | 787 | (progn (goto-char isearch-opoint) |
| 796 | (isearch-done) ; exit isearch | 788 | (isearch-done t) ; exit isearch |
| 797 | (signal 'quit nil)) ; and pass on quit signal | 789 | (signal 'quit nil)) ; and pass on quit signal |
| 798 | ;; If search is failing, rub out until it is once more successful. | 790 | ;; If search is failing, rub out until it is once more successful. |
| 799 | (while (not isearch-success) (isearch-pop-state)) | 791 | (while (not isearch-success) (isearch-pop-state)) |
| @@ -981,45 +973,35 @@ If no previous match was done, just beep." | |||
| 981 | "Any other control char => unread it and exit the search normally. | 973 | "Any other control char => unread it and exit the search normally. |
| 982 | But only if `search-exit-option' is non-nil, the default. | 974 | But only if `search-exit-option' is non-nil, the default. |
| 983 | If it is the symbol `edit', the search string is edited in the minibuffer | 975 | If it is the symbol `edit', the search string is edited in the minibuffer |
| 984 | and the control char is unread so that it is applied to the editing." | 976 | and the control char is unread so that it applies to editing the string." |
| 985 | (interactive) | 977 | (interactive) |
| 986 | (cond | 978 | (cond ((eq search-exit-option 'edit) |
| 987 | ((eq search-exit-option 'edit) | 979 | (isearch-unread (isearch-last-command-char)) |
| 988 | (isearch-unread (isearch-last-command-char)) | 980 | (isearch-edit-string)) |
| 989 | (isearch-edit-string)) | 981 | (search-exit-option;; any other non-nil value |
| 990 | (search-exit-option ;; any other non-nil value | 982 | (isearch-unread (isearch-last-command-char)) |
| 991 | (isearch-unread (isearch-last-command-char)) | 983 | (isearch-done)) |
| 992 | (isearch-done)) | 984 | (t;; search-exit-option is nil |
| 993 | (t ;; search-exit-option is nil | 985 | (isearch-process-search-char (isearch-last-command-char))))) |
| 994 | (isearch-process-search-char (isearch-last-command-char))) | ||
| 995 | )) | ||
| 996 | 986 | ||
| 997 | 987 | ||
| 998 | (defun isearch-other-meta-char () | 988 | (defun isearch-other-meta-char () |
| 999 | "Any other meta char => exit the search normally and reexecute the whole key. | 989 | "Any other meta char => exit the search normally and reread the character. |
| 1000 | But only if `search-exit-option' is non-nil." | 990 | But only if `search-exit-option' is non-nil, the default. |
| 1001 | ;; This will probably work in place of isearch-other-control-char too, | 991 | If it is the symbol `edit', the search string is edited in the minibuffer |
| 1002 | ;; but here we use unwind-protect and command-execute since it is | 992 | and the meta character is unread so that it applies to editing the string." |
| 1003 | ;; a multi-char key we would want to unread. | ||
| 1004 | (interactive) | 993 | (interactive) |
| 1005 | (cond | 994 | (cond ((eq search-exit-option 'edit) |
| 1006 | (search-exit-option | 995 | (let ((key (this-command-keys))) |
| 1007 | (unwind-protect | 996 | (isearch-unread (+ 128 (aref key (1- (length key)))))) |
| 1008 | ;; Exit recursive edit and restore the outside keymap. | 997 | (isearch-edit-string)) |
| 1009 | (isearch-done) | 998 | (search-exit-option |
| 1010 | ;; Reexecute the key with the outside keymap. | 999 | (let ((key (this-command-keys))) |
| 1011 | ;; Note: this doesnt work unless the entered key is the same | 1000 | (isearch-unread (+ 128 (aref key (1- (length key)))))) |
| 1012 | ;; as some outside key since command-execute only takes whole keys. | 1001 | (isearch-done)) |
| 1013 | ;; So three character keys typically will not work! | 1002 | (t;; otherwise nil |
| 1014 | ;; Also, executing the command here may not work if isearch was | 1003 | (isearch-process-search-string (this-command-keys) |
| 1015 | ;; invoked non-interactively, since other input may be expected. | 1004 | (this-command-keys))))) |
| 1016 | ;; We also can't do isearch-edit-string as in -other-control-char. | ||
| 1017 | ;; because we need to set unread-command-key, if that existed. | ||
| 1018 | ;; So a new unread-command-key would solve all these problems. | ||
| 1019 | (command-execute (this-command-keys)))) | ||
| 1020 | (t ;; otherwise nil | ||
| 1021 | (isearch-process-search-string (this-command-keys) (this-command-keys)) | ||
| 1022 | ))) | ||
| 1023 | 1005 | ||
| 1024 | 1006 | ||
| 1025 | (defun isearch-quote-char () | 1007 | (defun isearch-quote-char () |
| @@ -1125,22 +1107,14 @@ If not in regexp mode, activate word search." | |||
| 1125 | (set yank-pointer-name | 1107 | (set yank-pointer-name |
| 1126 | (setq yank-pointer | 1108 | (setq yank-pointer |
| 1127 | (% (+ (or yank-pointer 0) | 1109 | (% (+ (or yank-pointer 0) |
| 1128 | (if advance (+ length (% n length)))) | 1110 | ;; Add LENGTH here to ensure a positive result. |
| 1111 | length | ||
| 1112 | (% (- n) length)) | ||
| 1129 | length))) | 1113 | length))) |
| 1130 | 1114 | ||
| 1131 | (if (= minibuffer-history-position narg) | ||
| 1132 | (error (if (= minibuffer-history-position 1) | ||
| 1133 | "End of history; no next item" | ||
| 1134 | "Beginning of history; no preceding item")) | ||
| 1135 | (erase-buffer) | 1115 | (erase-buffer) |
| 1136 | (setq minibuffer-history-position narg) | 1116 | (insert (nth yank-pointer ring)) |
| 1137 | (let ((elt (nth (1- minibuffer-history-position) | 1117 | (goto-char (point-max)))))) |
| 1138 | (symbol-value minibuffer-history-variable)))) | ||
| 1139 | (insert | ||
| 1140 | (if minibuffer-history-sexp-flag | ||
| 1141 | (prin1-to-string elt) | ||
| 1142 | elt))) | ||
| 1143 | (goto-char (point-min)))))) | ||
| 1144 | 1118 | ||
| 1145 | (defun isearch-ring-retreat-edit (n) | 1119 | (defun isearch-ring-retreat-edit (n) |
| 1146 | "Inserts the previous element of the search history into the minibuffer." | 1120 | "Inserts the previous element of the search history into the minibuffer." |
diff --git a/lisp/progmodes/c-mode.el b/lisp/progmodes/c-mode.el index d51e67586c0..b92fe6ec819 100644 --- a/lisp/progmodes/c-mode.el +++ b/lisp/progmodes/c-mode.el | |||
| @@ -558,7 +558,8 @@ Returns nil if line starts inside a string, t if in a comment." | |||
| 558 | ;; Recognize the DEFUN macro in Emacs. | 558 | ;; Recognize the DEFUN macro in Emacs. |
| 559 | (if (save-excursion | 559 | (if (save-excursion |
| 560 | ;; Move down to the (putative) argnames line. | 560 | ;; Move down to the (putative) argnames line. |
| 561 | (while (not (looking-at " *[({}#/]")) | 561 | (while (and (not (eobp)) |
| 562 | (not (looking-at " *[({}#/]"))) | ||
| 562 | (forward-line 1)) | 563 | (forward-line 1)) |
| 563 | ;; Go back to the DEFUN, if it is one. | 564 | ;; Go back to the DEFUN, if it is one. |
| 564 | (condition-case nil | 565 | (condition-case nil |
diff --git a/src/lisp.h b/src/lisp.h index 7c5f9dd5e0c..b8d22f60077 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -127,9 +127,9 @@ enum Lisp_Type | |||
| 127 | Lisp_Buffer_Local_Value, | 127 | Lisp_Buffer_Local_Value, |
| 128 | 128 | ||
| 129 | /* Like Lisp_Buffer_Local_Value with one difference: | 129 | /* Like Lisp_Buffer_Local_Value with one difference: |
| 130 | merely setting the variable while some buffer is current | 130 | merely setting the variable while some buffer is current |
| 131 | does not cause that buffer to have its own local value of this variable. | 131 | does not cause that buffer to have its own local value of this variable. |
| 132 | Only make-local-variable does that. */ | 132 | Only make-local-variable does that. */ |
| 133 | Lisp_Some_Buffer_Local_Value, | 133 | Lisp_Some_Buffer_Local_Value, |
| 134 | 134 | ||
| 135 | 135 | ||