comparison lisp/comint.el @ 89945:59dcbfe97385

Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-17 Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-417 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-419 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-420 Tweak permissions * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-421 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-430 Update from CVS
author Miles Bader <miles@gnu.org>
date Tue, 29 Jun 2004 16:46:06 +0000
parents 4c90ffeb71c5 7cd2b62c16ce
children ff0e824afa37
comparison
equal deleted inserted replaced
89944:ecb75580442e 89945:59dcbfe97385
569 (define-key comint-mode-map "\C-c\C-u" 'comint-kill-input) 569 (define-key comint-mode-map "\C-c\C-u" 'comint-kill-input)
570 (define-key comint-mode-map "\C-c\C-w" 'backward-kill-word) 570 (define-key comint-mode-map "\C-c\C-w" 'backward-kill-word)
571 (define-key comint-mode-map "\C-c\C-c" 'comint-interrupt-subjob) 571 (define-key comint-mode-map "\C-c\C-c" 'comint-interrupt-subjob)
572 (define-key comint-mode-map "\C-c\C-z" 'comint-stop-subjob) 572 (define-key comint-mode-map "\C-c\C-z" 'comint-stop-subjob)
573 (define-key comint-mode-map "\C-c\C-\\" 'comint-quit-subjob) 573 (define-key comint-mode-map "\C-c\C-\\" 'comint-quit-subjob)
574 (define-key comint-mode-map "\C-c\C-m" 'comint-copy-old-input) 574 (define-key comint-mode-map "\C-c\C-m" 'comint-insert-input)
575 (define-key comint-mode-map "\C-c\C-o" 'comint-delete-output) 575 (define-key comint-mode-map "\C-c\C-o" 'comint-delete-output)
576 (define-key comint-mode-map "\C-c\C-r" 'comint-show-output) 576 (define-key comint-mode-map "\C-c\C-r" 'comint-show-output)
577 (define-key comint-mode-map "\C-c\C-e" 'comint-show-maximum-output) 577 (define-key comint-mode-map "\C-c\C-e" 'comint-show-maximum-output)
578 (define-key comint-mode-map "\C-c\C-l" 'comint-dynamic-list-input-ring) 578 (define-key comint-mode-map "\C-c\C-l" 'comint-dynamic-list-input-ring)
579 (define-key comint-mode-map "\C-c\C-n" 'comint-next-prompt) 579 (define-key comint-mode-map "\C-c\C-n" 'comint-next-prompt)
580 (define-key comint-mode-map "\C-c\C-p" 'comint-previous-prompt) 580 (define-key comint-mode-map "\C-c\C-p" 'comint-previous-prompt)
581 (define-key comint-mode-map "\C-c\C-d" 'comint-send-eof) 581 (define-key comint-mode-map "\C-c\C-d" 'comint-send-eof)
582 (define-key comint-mode-map "\C-c\C-s" 'comint-write-output) 582 (define-key comint-mode-map "\C-c\C-s" 'comint-write-output)
583 (define-key comint-mode-map "\C-c." 'comint-insert-previous-argument) 583 (define-key comint-mode-map "\C-c." 'comint-insert-previous-argument)
584 ;; Mouse Buttons: 584 ;; Mouse Buttons:
585 (define-key comint-mode-map [mouse-2] 'comint-insert-clicked-input) 585 (define-key comint-mode-map [mouse-2] 'comint-mouse-insert-input)
586 ;; Menu bars: 586 ;; Menu bars:
587 ;; completion: 587 ;; completion:
588 (define-key comint-mode-map [menu-bar completion] 588 (define-key comint-mode-map [menu-bar completion]
589 (cons "Complete" (make-sparse-keymap "Complete"))) 589 (cons "Complete" (make-sparse-keymap "Complete")))
590 (define-key comint-mode-map [menu-bar completion complete-expand] 590 (define-key comint-mode-map [menu-bar completion complete-expand]
613 (define-key comint-mode-map [menu-bar inout show-output] 613 (define-key comint-mode-map [menu-bar inout show-output]
614 '("Show Current Output Group" . comint-show-output)) 614 '("Show Current Output Group" . comint-show-output))
615 (define-key comint-mode-map [menu-bar inout kill-input] 615 (define-key comint-mode-map [menu-bar inout kill-input]
616 '("Kill Current Input" . comint-kill-input)) 616 '("Kill Current Input" . comint-kill-input))
617 (define-key comint-mode-map [menu-bar inout copy-input] 617 (define-key comint-mode-map [menu-bar inout copy-input]
618 '("Copy Old Input" . comint-copy-old-input)) 618 '("Copy Old Input" . comint-insert-input))
619 (define-key comint-mode-map [menu-bar inout forward-matching-history] 619 (define-key comint-mode-map [menu-bar inout forward-matching-history]
620 '("Forward Matching Input..." . comint-forward-matching-input)) 620 '("Forward Matching Input..." . comint-forward-matching-input))
621 (define-key comint-mode-map [menu-bar inout backward-matching-history] 621 (define-key comint-mode-map [menu-bar inout backward-matching-history]
622 '("Backward Matching Input..." . comint-backward-matching-input)) 622 '("Backward Matching Input..." . comint-backward-matching-input))
623 (define-key comint-mode-map [menu-bar inout next-matching-history] 623 (define-key comint-mode-map [menu-bar inout next-matching-history]
796 changed t)) 796 changed t))
797 (if changed 797 (if changed
798 (set-process-coding-system proc decoding encoding)) 798 (set-process-coding-system proc decoding encoding))
799 proc)) 799 proc))
800 800
801 801 (defun comint-insert-input ()
802 (defun comint-insert-clicked-input (event) 802 "In a Comint buffer, set the current input to the previous input at point."
803 "In a Comint buffer, set the current input to the clicked-on previous input." 803 (interactive)
804 (interactive "e") 804 (let ((pos (point)))
805 (let ((pos (posn-point (event-end event))))
806 (if (not (eq (get-char-property pos 'field) 'input)) 805 (if (not (eq (get-char-property pos 'field) 'input))
807 ;; No input at POS, fall back to the global definition. 806 ;; No input at POS, fall back to the global definition.
808 (let* ((keys (this-command-keys)) 807 (let* ((keys (this-command-keys))
809 (last-key (and (vectorp keys) (aref keys (1- (length keys))))) 808 (last-key (and (vectorp keys) (aref keys (1- (length keys)))))
810 (fun (and last-key (lookup-key global-map (vector last-key))))) 809 (fun (and last-key (lookup-key global-map (vector last-key)))))
814 ;; First delete any old unsent input at the end 813 ;; First delete any old unsent input at the end
815 (delete-region 814 (delete-region
816 (or (marker-position comint-accum-marker) 815 (or (marker-position comint-accum-marker)
817 (process-mark (get-buffer-process (current-buffer)))) 816 (process-mark (get-buffer-process (current-buffer))))
818 (point)) 817 (point))
819 ;; Insert the clicked-upon input 818 ;; Insert the input at point
820 (insert (buffer-substring-no-properties 819 (insert (buffer-substring-no-properties
821 (previous-single-char-property-change (1+ pos) 'field) 820 (previous-single-char-property-change (1+ pos) 'field)
822 (next-single-char-property-change pos 'field)))))) 821 (next-single-char-property-change pos 'field))))))
823 822
823 (defun comint-mouse-insert-input (event)
824 "In a Comint buffer, set the current input to the previous input you click on."
825 (interactive "e")
826 (mouse-set-point event)
827 (comint-insert-input))
824 828
825 829
826 ;; Input history processing in a buffer 830 ;; Input history processing in a buffer
827 ;; =========================================================================== 831 ;; ===========================================================================
828 ;; Useful input history functions, courtesy of the Ergo group. 832 ;; Useful input history functions, courtesy of the Ergo group.
1856 (if (eq (get-char-property bof 'field) 'input) 1860 (if (eq (get-char-property bof 'field) 'input)
1857 (field-string-no-properties bof) 1861 (field-string-no-properties bof)
1858 (comint-bol) 1862 (comint-bol)
1859 (buffer-substring-no-properties (point) (line-end-position))))) 1863 (buffer-substring-no-properties (point) (line-end-position)))))
1860 1864
1861 (defun comint-copy-old-input ()
1862 "Insert after prompt old input at point as new input to be edited.
1863 Calls `comint-get-old-input' to get old input."
1864 (interactive)
1865 (let ((input (funcall comint-get-old-input))
1866 (process (get-buffer-process (current-buffer))))
1867 (if (not process)
1868 (error "Current buffer has no process")
1869 (goto-char (process-mark process))
1870 (insert input))))
1871
1872 (defun comint-skip-prompt () 1865 (defun comint-skip-prompt ()
1873 "Skip past the text matching regexp `comint-prompt-regexp'. 1866 "Skip past the text matching regexp `comint-prompt-regexp'.
1874 If this takes us past the end of the current line, don't skip at all." 1867 If this takes us past the end of the current line, don't skip at all."
1875 (if (and (looking-at comint-prompt-regexp) 1868 (if (and (looking-at comint-prompt-regexp)
1876 (<= (match-end 0) (line-end-position))) 1869 (<= (match-end 0) (line-end-position)))