Mercurial > emacs
comparison lisp/comint.el @ 42119:cfeff2859949
(comint-dynamic-list-input-ring-select): New function.
Switches back to the old window configuration.
(comint-dynamic-list-input-ring): Bind RET to that function.
(comint-dynamic-list-input-ring-window-conf): New variable.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 18 Dec 2001 04:14:20 +0000 |
parents | 59739c538815 |
children | 7308bbc423d5 |
comparison
equal
deleted
inserted
replaced
42118:b646f4a6326b | 42119:cfeff2859949 |
---|---|
904 (insert (ring-ref ring index) comint-input-ring-separator)) | 904 (insert (ring-ref ring index) comint-input-ring-separator)) |
905 (write-region (buffer-string) nil file nil 'no-message) | 905 (write-region (buffer-string) nil file nil 'no-message) |
906 (kill-buffer nil)))))) | 906 (kill-buffer nil)))))) |
907 | 907 |
908 | 908 |
909 (defvar comint-dynamic-list-input-ring-window-conf) | |
910 | |
911 (defun comint-dynamic-list-input-ring-select () | |
912 "Choose the input history entry that point is in or next to." | |
913 (interactive) | |
914 (let (beg end completion (buffer completion-reference-buffer) | |
915 (base-size completion-base-size)) | |
916 (if (and (not (eobp)) (get-text-property (point) 'mouse-face)) | |
917 (setq end (point) beg (1+ (point)))) | |
918 (if (and (not (bobp)) (get-text-property (1- (point)) 'mouse-face)) | |
919 (setq end (1- (point)) beg (point))) | |
920 (if (null beg) | |
921 (error "No history entry here")) | |
922 (setq beg (previous-single-property-change beg 'mouse-face)) | |
923 (setq end (or (next-single-property-change end 'mouse-face) (point-max))) | |
924 (setq completion (buffer-substring beg end)) | |
925 (set-window-configuration comint-dynamic-list-input-ring-window-conf) | |
926 (choose-completion-string completion buffer base-size))) | |
927 | |
909 (defun comint-dynamic-list-input-ring () | 928 (defun comint-dynamic-list-input-ring () |
910 "List in help buffer the buffer's input history." | 929 "List in help buffer the buffer's input history." |
911 (interactive) | 930 (interactive) |
912 (if (or (not (ring-p comint-input-ring)) | 931 (if (or (not (ring-p comint-input-ring)) |
913 (ring-empty-p comint-input-ring)) | 932 (ring-empty-p comint-input-ring)) |
923 ;; Change "completion" to "history reference" | 942 ;; Change "completion" to "history reference" |
924 ;; to make the display accurate. | 943 ;; to make the display accurate. |
925 (with-output-to-temp-buffer history-buffer | 944 (with-output-to-temp-buffer history-buffer |
926 (display-completion-list history) | 945 (display-completion-list history) |
927 (set-buffer history-buffer) | 946 (set-buffer history-buffer) |
947 (let ((keymap (make-sparse-keymap))) | |
948 (set-keymap-parent keymap (current-local-map)) | |
949 (define-key keymap "\C-m" 'comint-dynamic-list-input-ring-select) | |
950 (use-local-map keymap)) | |
928 (forward-line 3) | 951 (forward-line 3) |
929 (while (search-backward "completion" nil 'move) | 952 (while (search-backward "completion" nil 'move) |
930 (replace-match "history reference"))) | 953 (replace-match "history reference"))) |
931 (sit-for 0) | 954 (sit-for 0) |
932 (message "Hit space to flush") | 955 (message "Hit space to flush") |
956 (setq comint-dynamic-list-input-ring-window-conf conf) | |
933 (let ((ch (read-event))) | 957 (let ((ch (read-event))) |
934 (if (eq ch ?\ ) | 958 (if (eq ch ?\ ) |
935 (set-window-configuration conf) | 959 (set-window-configuration conf) |
936 (setq unread-command-events (list ch))))))) | 960 (setq unread-command-events (list ch))))))) |
937 | 961 |