comparison lisp/net/tramp.el @ 70020:2578326defd6

* net/tramp.el (tramp-display-shell-command-buffer): New defvar. (tramp-handle-shell-command): Display output buffer only when `tramp-display-shell-command-buffer' is true. (tramp-handle-process-file): Set `tramp-display-shell-command-buffer'.
author Michael Albinus <michael.albinus@gmx.de>
date Thu, 13 Apr 2006 19:51:04 +0000
parents 3a5ea93ff8b4
children def3f4aee280 c156f6a9e7b5
comparison
equal deleted inserted replaced
70019:a186cf26482b 70020:2578326defd6
3582 3582
3583 (defvar tramp-async-proc nil 3583 (defvar tramp-async-proc nil
3584 "Global variable keeping asynchronous process object. 3584 "Global variable keeping asynchronous process object.
3585 Used in `tramp-handle-shell-command'") 3585 Used in `tramp-handle-shell-command'")
3586 3586
3587 (defvar tramp-display-shell-command-buffer t
3588 "Whether to display output buffer of `shell-command'.
3589 This is necessary for handling DISPLAY of `process-file'.")
3590
3587 (defun tramp-handle-shell-command (command &optional output-buffer error-buffer) 3591 (defun tramp-handle-shell-command (command &optional output-buffer error-buffer)
3588 "Like `shell-command' for tramp files. 3592 "Like `shell-command' for tramp files.
3589 This will break if COMMAND prints a newline, followed by the value of 3593 This will break if COMMAND prints a newline, followed by the value of
3590 `tramp-end-of-output', followed by another newline." 3594 `tramp-end-of-output', followed by another newline."
3591 ;; Asynchronous processes are far from being perfect. But it works at least 3595 ;; Asynchronous processes are far from being perfect. But it works at least
3690 (unless (search-backward "tramp_exit_status " nil t) 3694 (unless (search-backward "tramp_exit_status " nil t)
3691 (error "Couldn't find exit status of `%s'" command)) 3695 (error "Couldn't find exit status of `%s'" command))
3692 (skip-chars-forward "^ ") 3696 (skip-chars-forward "^ ")
3693 (setq status (read (current-buffer))))) 3697 (setq status (read (current-buffer)))))
3694 (unless (zerop (buffer-size)) 3698 (unless (zerop (buffer-size))
3695 (display-buffer output-buffer)) 3699 (when tramp-display-shell-command-buffer
3700 (display-buffer output-buffer)))
3696 status)) 3701 status))
3697 ;; The following is only executed if something strange was 3702 ;; The following is only executed if something strange was
3698 ;; happening. Emit a helpful message and do it anyway. 3703 ;; happening. Emit a helpful message and do it anyway.
3699 (message "tramp-handle-shell-command called with non-tramp directory: `%s'" 3704 (message "tramp-handle-shell-command called with non-tramp directory: `%s'"
3700 default-directory) 3705 default-directory)
3705 "Like `process-file' for Tramp files." 3710 "Like `process-file' for Tramp files."
3706 (when infile (error "Implementation does not handle input from file")) 3711 (when infile (error "Implementation does not handle input from file"))
3707 (when (and (numberp buffer) (zerop buffer)) 3712 (when (and (numberp buffer) (zerop buffer))
3708 (error "Implementation does not handle immediate return")) 3713 (error "Implementation does not handle immediate return"))
3709 (when (consp buffer) (error "Implementation does not handle error files")) 3714 (when (consp buffer) (error "Implementation does not handle error files"))
3710 (shell-command 3715 (let ((tramp-display-shell-command-buffer display))
3711 (mapconcat 'tramp-shell-quote-argument 3716 (shell-command
3712 (cons program args) 3717 (mapconcat 'tramp-shell-quote-argument (cons program args) " ")
3713 " ") 3718 buffer)))
3714 buffer))
3715 3719
3716 ;; File Editing. 3720 ;; File Editing.
3717 3721
3718 (defsubst tramp-make-temp-file () 3722 (defsubst tramp-make-temp-file ()
3719 (funcall (if (fboundp 'make-temp-file) 'make-temp-file 'make-temp-name) 3723 (funcall (if (fboundp 'make-temp-file) 'make-temp-file 'make-temp-name)