diff options
author | Karoly Lorentey <lorentey@elte.hu> | 2006-05-10 15:04:01 +0000 |
---|---|---|
committer | Karoly Lorentey <lorentey@elte.hu> | 2006-05-10 15:04:01 +0000 |
commit | 5fc2ccaa85fce4949d1ddf2b46604e90cb703b53 (patch) | |
tree | 137a1fec4b571b565f4294b5109df3d1b0650a2b /lisp/comint.el | |
parent | ccaa691f6c297164c6206bb40691848f5c24099b (diff) | |
parent | bd014eec0fdd7d1b2b37fe06f3451dfbf635ff6e (diff) | |
download | emacs-5fc2ccaa85fce4949d1ddf2b46604e90cb703b53.tar.gz |
Merged from emacs@sv.gnu.org
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-266
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-267
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-268
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-269
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-270
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-271
Rename "field-at-point" to "field-at-pos"
* emacs@sv.gnu.org/emacs--devo--0--patch-272
(comint-insert-input): Remove redundant calls to setq and goto-char
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-556
Diffstat (limited to 'lisp/comint.el')
-rw-r--r-- | lisp/comint.el | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/lisp/comint.el b/lisp/comint.el index 946085661fc..c7e5b3bdddd 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -802,27 +802,31 @@ buffer. The hook `comint-exec-hook' is run after each exec." ;; This doesn't use "e" because it is supposed to work ;; for events without parameters. (interactive (list last-input-event)) - (let ((pos (point))) - (if event (posn-set-point (event-end event))) - (if (not (eq (get-char-property (point) 'field) 'input)) - ;; No input at POS, fall back to the global definition. - (let* ((keys (this-command-keys)) - (last-key (and (vectorp keys) (aref keys (1- (length keys))))) - (fun (and last-key (lookup-key global-map (vector last-key))))) - (goto-char pos) - (and fun (call-interactively fun))) - (setq pos (point)) - ;; There's previous input at POS, insert it at the end of the buffer. - (goto-char (point-max)) - ;; First delete any old unsent input at the end - (delete-region - (or (marker-position comint-accum-marker) - (process-mark (get-buffer-process (current-buffer)))) - (point)) - ;; Insert the input at point - (insert (buffer-substring-no-properties - (previous-single-char-property-change (1+ pos) 'field) - (next-single-char-property-change pos 'field)))))) + (when event + (posn-set-point (event-end event))) + (if comint-use-prompt-regexp + (let ((input (funcall comint-get-old-input)) + (process (get-buffer-process (current-buffer)))) + (if (not process) + (error "Current buffer has no process") + (goto-char (process-mark process)) + (insert input))) + (let ((pos (point))) + (if (not (eq (field-at-pos pos) 'input)) + ;; No input at POS, fall back to the global definition. + (let* ((keys (this-command-keys)) + (last-key (and (vectorp keys) (aref keys (1- (length keys))))) + (fun (and last-key (lookup-key global-map (vector last-key))))) + (and fun (call-interactively fun))) + ;; There's previous input at POS, insert it at the end of the buffer. + (goto-char (point-max)) + ;; First delete any old unsent input at the end + (delete-region + (or (marker-position comint-accum-marker) + (process-mark (get-buffer-process (current-buffer)))) + (point)) + ;; Insert the input at point + (insert (field-string-no-properties pos)))))) ;; Input history processing in a buffer |