aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/replace.el
diff options
context:
space:
mode:
authorKaroly Lorentey2005-12-03 14:25:50 +0000
committerKaroly Lorentey2005-12-03 14:25:50 +0000
commit9ef706664e98e37e9633712126bae99869904677 (patch)
tree193bce7424700e4c7d70f54b04f7f81d64525554 /lisp/replace.el
parent950bed4bb96d2a580818bdaab64a164c7c9a1c1e (diff)
parent9f6efa0c78099f2f028c4db1db5a58567a1cfb4e (diff)
downloademacs-9ef706664e98e37e9633712126bae99869904677.tar.gz
emacs-9ef706664e98e37e9633712126bae99869904677.zip
Merged from miles@gnu.org--gnu-2005 (patch 659-663)
Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-659 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-660 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-661 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-662 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-663 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-445
Diffstat (limited to 'lisp/replace.el')
-rw-r--r--lisp/replace.el100
1 files changed, 51 insertions, 49 deletions
diff --git a/lisp/replace.el b/lisp/replace.el
index e74b8690c28..fbfa1be09c2 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -693,6 +693,7 @@ a previously found match."
693 693
694(defvar occur-mode-map 694(defvar occur-mode-map
695 (let ((map (make-sparse-keymap))) 695 (let ((map (make-sparse-keymap)))
696 ;; We use this alternative name, so we can use \\[occur-mode-mouse-goto].
696 (define-key map [mouse-2] 'occur-mode-mouse-goto) 697 (define-key map [mouse-2] 'occur-mode-mouse-goto)
697 (define-key map "\C-c\C-c" 'occur-mode-goto-occurrence) 698 (define-key map "\C-c\C-c" 'occur-mode-goto-occurrence)
698 (define-key map "\C-m" 'occur-mode-goto-occurrence) 699 (define-key map "\C-m" 'occur-mode-goto-occurrence)
@@ -746,18 +747,6 @@ Alternatively, click \\[occur-mode-mouse-goto] on an item to go to it.
746 "Handle `revert-buffer' for Occur mode buffers." 747 "Handle `revert-buffer' for Occur mode buffers."
747 (apply 'occur-1 (append occur-revert-arguments (list (buffer-name))))) 748 (apply 'occur-1 (append occur-revert-arguments (list (buffer-name)))))
748 749
749(defun occur-mode-mouse-goto (event)
750 "In Occur mode, go to the occurrence whose line you click on."
751 (interactive "e")
752 (let (pos)
753 (save-excursion
754 (set-buffer (window-buffer (posn-window (event-end event))))
755 (save-excursion
756 (goto-char (posn-point (event-end event)))
757 (setq pos (occur-mode-find-occurrence))))
758 (switch-to-buffer-other-window (marker-buffer pos))
759 (goto-char pos)))
760
761(defun occur-mode-find-occurrence () 750(defun occur-mode-find-occurrence ()
762 (let ((pos (get-text-property (point) 'occur-target))) 751 (let ((pos (get-text-property (point) 'occur-target)))
763 (unless pos 752 (unless pos
@@ -766,11 +755,23 @@ Alternatively, click \\[occur-mode-mouse-goto] on an item to go to it.
766 (error "Buffer for this occurrence was killed")) 755 (error "Buffer for this occurrence was killed"))
767 pos)) 756 pos))
768 757
769(defun occur-mode-goto-occurrence () 758(defalias 'occur-mode-mouse-goto 'occur-mode-goto-occurrence)
759(defun occur-mode-goto-occurrence (&optional event)
770 "Go to the occurrence the current line describes." 760 "Go to the occurrence the current line describes."
771 (interactive) 761 (interactive (list last-nonmenu-event))
772 (let ((pos (occur-mode-find-occurrence))) 762 (let ((pos
773 (switch-to-buffer (marker-buffer pos)) 763 (if (null event)
764 ;; Actually `event-end' works correctly with a nil argument as
765 ;; well, so we could dispense with this test, but let's not
766 ;; rely on this undocumented behavior.
767 (occur-mode-find-occurrence)
768 (with-current-buffer (window-buffer (posn-window (event-end event)))
769 (save-excursion
770 (goto-char (posn-point (event-end event)))
771 (occur-mode-find-occurrence)))))
772 same-window-buffer-names
773 same-window-regexps)
774 (pop-to-buffer (marker-buffer pos))
774 (goto-char pos))) 775 (goto-char pos)))
775 776
776(defun occur-mode-goto-occurrence-other-window () 777(defun occur-mode-goto-occurrence-other-window ()
@@ -832,7 +833,8 @@ Compatibility function for \\[next-error] invocations."
832 833
833 (goto-char (cond (reset (point-min)) 834 (goto-char (cond (reset (point-min))
834 ((< argp 0) (line-beginning-position)) 835 ((< argp 0) (line-beginning-position))
835 ((line-end-position)))) 836 ((> argp 0) (line-end-position))
837 ((point))))
836 (occur-find-match 838 (occur-find-match
837 (abs argp) 839 (abs argp)
838 (if (> 0 argp) 840 (if (> 0 argp)
@@ -1089,8 +1091,7 @@ See also `multi-occur'."
1089 (marker nil) 1091 (marker nil)
1090 (curstring "") 1092 (curstring "")
1091 (headerpt (with-current-buffer out-buf (point)))) 1093 (headerpt (with-current-buffer out-buf (point))))
1092 (save-excursion 1094 (with-current-buffer buf
1093 (set-buffer buf)
1094 (or coding 1095 (or coding
1095 ;; Set CODING only if the current buffer locally 1096 ;; Set CODING only if the current buffer locally
1096 ;; binds buffer-file-coding-system. 1097 ;; binds buffer-file-coding-system.
@@ -1223,42 +1224,43 @@ C-l to clear the screen, redisplay, and offer same replacement again,
1223E to edit the replacement string" 1224E to edit the replacement string"
1224 "Help message while in `query-replace'.") 1225 "Help message while in `query-replace'.")
1225 1226
1226(defvar query-replace-map (make-sparse-keymap) 1227(defvar query-replace-map
1228 (let ((map (make-sparse-keymap)))
1229 (define-key map " " 'act)
1230 (define-key map "\d" 'skip)
1231 (define-key map [delete] 'skip)
1232 (define-key map [backspace] 'skip)
1233 (define-key map "y" 'act)
1234 (define-key map "n" 'skip)
1235 (define-key map "Y" 'act)
1236 (define-key map "N" 'skip)
1237 (define-key map "e" 'edit-replacement)
1238 (define-key map "E" 'edit-replacement)
1239 (define-key map "," 'act-and-show)
1240 (define-key map "q" 'exit)
1241 (define-key map "\r" 'exit)
1242 (define-key map [return] 'exit)
1243 (define-key map "." 'act-and-exit)
1244 (define-key map "\C-r" 'edit)
1245 (define-key map "\C-w" 'delete-and-edit)
1246 (define-key map "\C-l" 'recenter)
1247 (define-key map "!" 'automatic)
1248 (define-key map "^" 'backup)
1249 (define-key map "\C-h" 'help)
1250 (define-key map [f1] 'help)
1251 (define-key map [help] 'help)
1252 (define-key map "?" 'help)
1253 (define-key map "\C-g" 'quit)
1254 (define-key map "\C-]" 'quit)
1255 (define-key map "\e" 'exit-prefix)
1256 (define-key map [escape] 'exit-prefix)
1257 map)
1227 "Keymap that defines the responses to questions in `query-replace'. 1258 "Keymap that defines the responses to questions in `query-replace'.
1228The \"bindings\" in this map are not commands; they are answers. 1259The \"bindings\" in this map are not commands; they are answers.
1229The valid answers include `act', `skip', `act-and-show', 1260The valid answers include `act', `skip', `act-and-show',
1230`exit', `act-and-exit', `edit', `delete-and-edit', `recenter', 1261`exit', `act-and-exit', `edit', `delete-and-edit', `recenter',
1231`automatic', `backup', `exit-prefix', and `help'.") 1262`automatic', `backup', `exit-prefix', and `help'.")
1232 1263
1233(define-key query-replace-map " " 'act)
1234(define-key query-replace-map "\d" 'skip)
1235(define-key query-replace-map [delete] 'skip)
1236(define-key query-replace-map [backspace] 'skip)
1237(define-key query-replace-map "y" 'act)
1238(define-key query-replace-map "n" 'skip)
1239(define-key query-replace-map "Y" 'act)
1240(define-key query-replace-map "N" 'skip)
1241(define-key query-replace-map "e" 'edit-replacement)
1242(define-key query-replace-map "E" 'edit-replacement)
1243(define-key query-replace-map "," 'act-and-show)
1244(define-key query-replace-map "q" 'exit)
1245(define-key query-replace-map "\r" 'exit)
1246(define-key query-replace-map [return] 'exit)
1247(define-key query-replace-map "." 'act-and-exit)
1248(define-key query-replace-map "\C-r" 'edit)
1249(define-key query-replace-map "\C-w" 'delete-and-edit)
1250(define-key query-replace-map "\C-l" 'recenter)
1251(define-key query-replace-map "!" 'automatic)
1252(define-key query-replace-map "^" 'backup)
1253(define-key query-replace-map "\C-h" 'help)
1254(define-key query-replace-map [f1] 'help)
1255(define-key query-replace-map [help] 'help)
1256(define-key query-replace-map "?" 'help)
1257(define-key query-replace-map "\C-g" 'quit)
1258(define-key query-replace-map "\C-]" 'quit)
1259(define-key query-replace-map "\e" 'exit-prefix)
1260(define-key query-replace-map [escape] 'exit-prefix)
1261
1262(defun replace-match-string-symbols (n) 1264(defun replace-match-string-symbols (n)
1263 "Process a list (and any sub-lists), expanding certain symbols. 1265 "Process a list (and any sub-lists), expanding certain symbols.
1264Symbol Expands To 1266Symbol Expands To