Mercurial > emacs
comparison lisp/shell.el @ 65573:eadf85208391
(shell-resync-dirs): Handle echoing processes more reliably. Don't
insert resync command if `comint-process-echoes' is non-nil.
author | Romain Francoise <romain@orebokech.com> |
---|---|
date | Sat, 17 Sep 2005 18:20:40 +0000 |
parents | 23741bfb23af |
children | 3bd95f4f2941 fa0da9b57058 |
comparison
equal
deleted
inserted
replaced
65572:92c9e729c767 | 65573:eadf85208391 |
---|---|
795 command again." | 795 command again." |
796 (interactive) | 796 (interactive) |
797 (let* ((proc (get-buffer-process (current-buffer))) | 797 (let* ((proc (get-buffer-process (current-buffer))) |
798 (pmark (process-mark proc))) | 798 (pmark (process-mark proc))) |
799 (goto-char pmark) | 799 (goto-char pmark) |
800 (insert shell-dirstack-query) (insert "\n") | 800 ;; If the process echoes commands, don't insert a fake command in |
801 ;; the buffer or it will appear twice. | |
802 (unless comint-process-echoes | |
803 (insert shell-dirstack-query) (insert "\n")) | |
801 (sit-for 0) ; force redisplay | 804 (sit-for 0) ; force redisplay |
802 (comint-send-string proc shell-dirstack-query) | 805 (comint-send-string proc shell-dirstack-query) |
803 (comint-send-string proc "\n") | 806 (comint-send-string proc "\n") |
804 (set-marker pmark (point)) | 807 (set-marker pmark (point)) |
805 (let ((pt (point))) ; wait for 1 line | 808 (let ((pt (point)) |
809 (regexp | |
810 (concat | |
811 (if comint-process-echoes | |
812 ;; Skip command echo if the process echoes | |
813 (concat "\\(" (regexp-quote shell-dirstack-query) "\n\\)") | |
814 "\\(\\)") | |
815 "\\(.+\n\\)"))) | |
806 ;; This extra newline prevents the user's pending input from spoofing us. | 816 ;; This extra newline prevents the user's pending input from spoofing us. |
807 (insert "\n") (backward-char 1) | 817 (insert "\n") (backward-char 1) |
808 (while (not (looking-at | 818 ;; Wait for one line. |
809 (concat "\\(" ; skip literal echo in case of stty echo | 819 (while (not (looking-at regexp)) |
810 (regexp-quote shell-dirstack-query) | |
811 "\n\\)?" ; skip if present | |
812 "\\(" ".+\n" "\\)")) ) ; what to actually look for | |
813 (accept-process-output proc) | 820 (accept-process-output proc) |
814 (goto-char pt))) | 821 (goto-char pt))) |
815 (goto-char pmark) (delete-char 1) ; remove the extra newline | 822 (goto-char pmark) (delete-char 1) ; remove the extra newline |
816 ;; That's the dirlist. grab it & parse it. | 823 ;; That's the dirlist. grab it & parse it. |
817 (let* ((dl (buffer-substring (match-beginning 2) (1- (match-end 2)))) | 824 (let* ((dl (buffer-substring (match-beginning 2) (1- (match-end 2)))) |