diff options
Diffstat (limited to 'lisp/replace.el')
| -rw-r--r-- | lisp/replace.el | 102 |
1 files changed, 54 insertions, 48 deletions
diff --git a/lisp/replace.el b/lisp/replace.el index 924622b692d..0f8adea2aca 100644 --- a/lisp/replace.el +++ b/lisp/replace.el | |||
| @@ -757,6 +757,60 @@ a previously found match." | |||
| 757 | count))) | 757 | count))) |
| 758 | 758 | ||
| 759 | 759 | ||
| 760 | (defvar occur-mode-map | ||
| 761 | (let ((map (make-sparse-keymap))) | ||
| 762 | ;; We use this alternative name, so we can use \\[occur-mode-mouse-goto]. | ||
| 763 | (define-key map [mouse-2] 'occur-mode-mouse-goto) | ||
| 764 | (define-key map "\C-c\C-c" 'occur-mode-goto-occurrence) | ||
| 765 | (define-key map "\C-m" 'occur-mode-goto-occurrence) | ||
| 766 | (define-key map "o" 'occur-mode-goto-occurrence-other-window) | ||
| 767 | (define-key map "\C-o" 'occur-mode-display-occurrence) | ||
| 768 | (define-key map "\M-n" 'occur-next) | ||
| 769 | (define-key map "\M-p" 'occur-prev) | ||
| 770 | (define-key map "r" 'occur-rename-buffer) | ||
| 771 | (define-key map "c" 'clone-buffer) | ||
| 772 | (define-key map "\C-c\C-f" 'next-error-follow-minor-mode) | ||
| 773 | (define-key map [menu-bar] (make-sparse-keymap)) | ||
| 774 | (define-key map [menu-bar occur] | ||
| 775 | `(cons ,(purecopy "Occur") map)) | ||
| 776 | (define-key map [next-error-follow-minor-mode] | ||
| 777 | (menu-bar-make-mm-toggle next-error-follow-minor-mode | ||
| 778 | "Auto Occurrence Display" | ||
| 779 | "Display another occurrence when moving the cursor")) | ||
| 780 | (define-key map [separator-1] menu-bar-separator) | ||
| 781 | (define-key map [kill-this-buffer] | ||
| 782 | `(menu-item ,(purecopy "Kill occur buffer") kill-this-buffer | ||
| 783 | :help ,(purecopy "Kill the current *Occur* buffer"))) | ||
| 784 | (define-key map [quit-window] | ||
| 785 | `(menu-item ,(purecopy "Quit occur window") quit-window | ||
| 786 | :help ,(purecopy "Quit the current *Occur* buffer. Bury it, and maybe delete the selected frame"))) | ||
| 787 | (define-key map [revert-buffer] | ||
| 788 | `(menu-item ,(purecopy "Revert occur buffer") revert-buffer | ||
| 789 | :help ,(purecopy "Replace the text in the *Occur* buffer with the results of rerunning occur"))) | ||
| 790 | (define-key map [clone-buffer] | ||
| 791 | `(menu-item ,(purecopy "Clone occur buffer") clone-buffer | ||
| 792 | :help ,(purecopy "Create and return a twin copy of the current *Occur* buffer"))) | ||
| 793 | (define-key map [occur-rename-buffer] | ||
| 794 | `(menu-item ,(purecopy "Rename occur buffer") occur-rename-buffer | ||
| 795 | :help ,(purecopy "Rename the current *Occur* buffer to *Occur: original-buffer-name*."))) | ||
| 796 | (define-key map [separator-2] menu-bar-separator) | ||
| 797 | (define-key map [occur-mode-goto-occurrence-other-window] | ||
| 798 | `(menu-item ,(purecopy "Go To Occurrence Other Window") occur-mode-goto-occurrence-other-window | ||
| 799 | :help ,(purecopy "Go to the occurrence the current line describes, in another window"))) | ||
| 800 | (define-key map [occur-mode-goto-occurrence] | ||
| 801 | `(menu-item ,(purecopy "Go To Occurrence") occur-mode-goto-occurrence | ||
| 802 | :help ,(purecopy "Go to the occurrence the current line describes"))) | ||
| 803 | (define-key map [occur-mode-display-occurrence] | ||
| 804 | `(menu-item ,(purecopy "Display Occurrence") occur-mode-display-occurrence | ||
| 805 | :help ,(purecopy "Display in another window the occurrence the current line describes"))) | ||
| 806 | (define-key map [occur-next] | ||
| 807 | `(menu-item ,(purecopy "Move to next match") occur-next | ||
| 808 | :help ,(purecopy "Move to the Nth (default 1) next match in an Occur mode buffer"))) | ||
| 809 | (define-key map [occur-prev] | ||
| 810 | `(menu-item ,(purecopy "Move to previous match") occur-prev | ||
| 811 | :help ,(purecopy "Move to the Nth (default 1) previous match in an Occur mode buffer"))) | ||
| 812 | map) | ||
| 813 | "Keymap for `occur-mode'.") | ||
| 760 | 814 | ||
| 761 | (defvar occur-revert-arguments nil | 815 | (defvar occur-revert-arguments nil |
| 762 | "Arguments to pass to `occur-1' to revert an Occur mode buffer. | 816 | "Arguments to pass to `occur-1' to revert an Occur mode buffer. |
| @@ -792,54 +846,6 @@ Alternatively, click \\[occur-mode-mouse-goto] on an item to go to it. | |||
| 792 | (add-hook 'change-major-mode-hook 'font-lock-defontify nil t) | 846 | (add-hook 'change-major-mode-hook 'font-lock-defontify nil t) |
| 793 | (setq next-error-function 'occur-next-error)) | 847 | (setq next-error-function 'occur-next-error)) |
| 794 | 848 | ||
| 795 | (define-key occur-mode-map [mouse-2] 'occur-mode-mouse-goto) | ||
| 796 | (define-key occur-mode-map "\C-c\C-c" 'occur-mode-goto-occurrence) | ||
| 797 | (define-key occur-mode-map "\C-m" 'occur-mode-goto-occurrence) | ||
| 798 | (define-key occur-mode-map "o" 'occur-mode-goto-occurrence-other-window) | ||
| 799 | (define-key occur-mode-map "\C-o" 'occur-mode-display-occurrence) | ||
| 800 | (define-key occur-mode-map "\M-n" 'occur-next) | ||
| 801 | (define-key occur-mode-map "\M-p" 'occur-prev) | ||
| 802 | (define-key occur-mode-map "r" 'occur-rename-buffer) | ||
| 803 | (define-key occur-mode-map "c" 'clone-buffer) | ||
| 804 | (define-key occur-mode-map "\C-c\C-f" 'next-error-follow-minor-mode) | ||
| 805 | (define-key occur-mode-map [menu-bar] (make-sparse-keymap)) | ||
| 806 | (define-key occur-mode-map [menu-bar occur] `(cons ,(purecopy "Occur") map)) | ||
| 807 | (define-key occur-mode-map [next-error-follow-minor-mode] | ||
| 808 | (menu-bar-make-mm-toggle next-error-follow-minor-mode | ||
| 809 | "Auto Occurrence Display" | ||
| 810 | "Display another occurrence when moving the cursor")) | ||
| 811 | (define-key occur-mode-map [separator-1] menu-bar-separator) | ||
| 812 | (define-key occur-mode-map [kill-this-buffer] | ||
| 813 | `(menu-item ,(purecopy "Kill occur buffer") kill-this-buffer | ||
| 814 | :help ,(purecopy "Kill the current *Occur* buffer"))) | ||
| 815 | (define-key occur-mode-map [quit-window] | ||
| 816 | `(menu-item ,(purecopy "Quit occur window") quit-window | ||
| 817 | :help ,(purecopy "Quit the current *Occur* buffer. Bury it, and maybe delete the selected frame"))) | ||
| 818 | (define-key occur-mode-map [revert-buffer] | ||
| 819 | `(menu-item ,(purecopy "Revert occur buffer") revert-buffer | ||
| 820 | :help ,(purecopy "Replace the text in the *Occur* buffer with the results of rerunning occur"))) | ||
| 821 | (define-key occur-mode-map [clone-buffer] | ||
| 822 | `(menu-item ,(purecopy "Clone occur buffer") clone-buffer | ||
| 823 | :help ,(purecopy "Create and return a twin copy of the current *Occur* buffer"))) | ||
| 824 | (define-key occur-mode-map [occur-rename-buffer] | ||
| 825 | `(menu-item ,(purecopy "Rename occur buffer") occur-rename-buffer | ||
| 826 | :help ,(purecopy "Rename the current *Occur* buffer to *Occur: original-buffer-name*."))) | ||
| 827 | (define-key occur-mode-map [separator-2] menu-bar-separator) | ||
| 828 | (define-key occur-mode-map [occur-mode-goto-occurrence-other-window] | ||
| 829 | `(menu-item ,(purecopy "Go To Occurrence Other Window") occur-mode-goto-occurrence-other-window | ||
| 830 | :help ,(purecopy "Go to the occurrence the current line describes, in another window"))) | ||
| 831 | (define-key occur-mode-map [occur-mode-goto-occurrence] | ||
| 832 | `(menu-item ,(purecopy "Go To Occurrence") occur-mode-goto-occurrence | ||
| 833 | :help ,(purecopy "Go to the occurrence the current line describes"))) | ||
| 834 | (define-key occur-mode-map [occur-mode-display-occurrence] | ||
| 835 | `(menu-item ,(purecopy "Display Occurrence") occur-mode-display-occurrence | ||
| 836 | :help ,(purecopy "Display in another window the occurrence the current line describes"))) | ||
| 837 | (define-key occur-mode-map [occur-next] | ||
| 838 | `(menu-item ,(purecopy "Move to next match") occur-next | ||
| 839 | :help ,(purecopy "Move to the Nth (default 1) next match in an Occur mode buffer"))) | ||
| 840 | (define-key occur-mode-map [occur-prev] | ||
| 841 | `(menu-item ,(purecopy "Move to previous match") occur-prev | ||
| 842 | :help ,(purecopy "Move to the Nth (default 1) previous match in an Occur mode buffer"))) | ||
| 843 | (defun occur-revert-function (ignore1 ignore2) | 849 | (defun occur-revert-function (ignore1 ignore2) |
| 844 | "Handle `revert-buffer' for Occur mode buffers." | 850 | "Handle `revert-buffer' for Occur mode buffers." |
| 845 | (apply 'occur-1 (append occur-revert-arguments (list (buffer-name))))) | 851 | (apply 'occur-1 (append occur-revert-arguments (list (buffer-name))))) |