comparison lisp/simple.el @ 90037:0fe073a08cef

Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-65 Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-634 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-639 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-640 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-641 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-59 - miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-60 Update from CVS
author Miles Bader <miles@gnu.org>
date Wed, 27 Oct 2004 05:42:04 +0000
parents 0796fc36c2bd 4d4bfb9781e1
children e24e2e78deda
comparison
equal deleted inserted replaced
90036:af754c88f187 90037:0fe073a08cef
1877 "Execute shell command COMMAND and return its output as a string." 1877 "Execute shell command COMMAND and return its output as a string."
1878 (with-output-to-string 1878 (with-output-to-string
1879 (with-current-buffer 1879 (with-current-buffer
1880 standard-output 1880 standard-output
1881 (call-process shell-file-name nil t nil shell-command-switch command)))) 1881 (call-process shell-file-name nil t nil shell-command-switch command))))
1882
1883 (defun process-file (program &optional infile buffer display &rest args)
1884 "Process files synchronously in a separate process.
1885 Similar to `call-process', but may invoke a file handler based on
1886 `default-directory'. The current working directory of the
1887 subprocess is `default-directory'.
1888
1889 File names in INFILE and BUFFER are handled normally, but file
1890 names in ARGS should be relative to `default-directory', as they
1891 are passed to the process verbatim. \(This is a difference to
1892 `call-process' which does not support file handlers for INFILE
1893 and BUFFER.\)
1894
1895 Some file handlers might not support all variants, for example
1896 they might behave as if DISPLAY was nil, regardless of the actual
1897 value passed."
1898 (let ((fh (find-file-name-handler default-directory 'process-file))
1899 lc stderr-file)
1900 (unwind-protect
1901 (if fh (apply fh 'process-file program infile buffer display args)
1902 (when infile (setq lc (file-local-copy infile)))
1903 (setq stderr-file (when (and (consp buffer) (stringp (cadr buffer)))
1904 (make-temp-file "emacs")))
1905 (prog1
1906 (apply 'call-process program
1907 (or lc infile)
1908 (if stderr-file (list (car buffer) stderr-file) buffer)
1909 display args)
1910 (when stderr-file (copy-file stderr-file (cadr buffer)))))
1911 (when stderr-file (delete-file stderr-file))
1912 (when lc (delete-file lc)))))
1913
1914
1882 1915
1883 (defvar universal-argument-map 1916 (defvar universal-argument-map
1884 (let ((map (make-sparse-keymap))) 1917 (let ((map (make-sparse-keymap)))
1885 (define-key map [t] 'universal-argument-other-key) 1918 (define-key map [t] 'universal-argument-other-key)
1886 (define-key map (vector meta-prefix-char t) 'universal-argument-other-key) 1919 (define-key map (vector meta-prefix-char t) 'universal-argument-other-key)