diff options
| author | Glenn Morris | 2018-12-30 17:02:40 -0800 |
|---|---|---|
| committer | Glenn Morris | 2018-12-30 17:02:40 -0800 |
| commit | 433b6a74ec73608ff06106daee4f53c5175d5297 (patch) | |
| tree | 1be58fb0808c683eb4b488a95555e2e24206ea61 | |
| parent | f23b1db37a816ab88a5970e67d1aaeb7f68ca47c (diff) | |
| parent | 82c82b1c773f441fe424b7ed1757c8eda31814c0 (diff) | |
| download | emacs-433b6a74ec73608ff06106daee4f53c5175d5297.tar.gz emacs-433b6a74ec73608ff06106daee4f53c5175d5297.zip | |
Merge from origin/emacs-26
82c82b1 (origin/emacs-26) In user manual fix value of default frame h...
2e8825d Improve documentation of 'file-local-name' and related APIs
11f0635 ; Remove comment in esh-proc.el
# Conflicts:
# lisp/simple.el
| -rw-r--r-- | doc/emacs/cmdargs.texi | 2 | ||||
| -rw-r--r-- | doc/lispref/files.texi | 31 | ||||
| -rw-r--r-- | doc/lispref/processes.texi | 11 | ||||
| -rw-r--r-- | lisp/eshell/esh-proc.el | 1 | ||||
| -rw-r--r-- | lisp/files.el | 5 | ||||
| -rw-r--r-- | lisp/simple.el | 16 |
6 files changed, 47 insertions, 19 deletions
diff --git a/doc/emacs/cmdargs.texi b/doc/emacs/cmdargs.texi index 960398df081..61ca827b00d 100644 --- a/doc/emacs/cmdargs.texi +++ b/doc/emacs/cmdargs.texi | |||
| @@ -1034,7 +1034,7 @@ specifies a window 164 columns wide, enough for two ordinary width | |||
| 1034 | windows side by side, and 55 lines tall. | 1034 | windows side by side, and 55 lines tall. |
| 1035 | 1035 | ||
| 1036 | The default frame width is 80 characters and the default height is | 1036 | The default frame width is 80 characters and the default height is |
| 1037 | 40 lines. You can omit either the width or the height or both. If | 1037 | 36 lines. You can omit either the width or the height or both. If |
| 1038 | you start the geometry with an integer, Emacs interprets it as the | 1038 | you start the geometry with an integer, Emacs interprets it as the |
| 1039 | width. If you start with an @samp{x} followed by an integer, Emacs | 1039 | width. If you start with an @samp{x} followed by an integer, Emacs |
| 1040 | interprets it as the height. Thus, @samp{81} specifies just the | 1040 | interprets it as the height. Thus, @samp{81} specifies just the |
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi index d929978b6ea..21823c95694 100644 --- a/doc/lispref/files.texi +++ b/doc/lispref/files.texi | |||
| @@ -2512,9 +2512,9 @@ with @samp{/:}. | |||
| 2512 | @defmac file-name-quote name | 2512 | @defmac file-name-quote name |
| 2513 | This macro adds the quotation prefix @samp{/:} to the file @var{name}. | 2513 | This macro adds the quotation prefix @samp{/:} to the file @var{name}. |
| 2514 | For a local file @var{name}, it prefixes @var{name} with @samp{/:}. | 2514 | For a local file @var{name}, it prefixes @var{name} with @samp{/:}. |
| 2515 | If @var{name} is a remote file name, the local part of @var{name} is | 2515 | If @var{name} is a remote file name, the local part of @var{name} |
| 2516 | quoted. If @var{name} is already a quoted file name, @var{name} is | 2516 | (@pxref{Magic File Names}) is quoted. If @var{name} is already a |
| 2517 | returned unchanged. | 2517 | quoted file name, @var{name} is returned unchanged. |
| 2518 | 2518 | ||
| 2519 | @example | 2519 | @example |
| 2520 | @group | 2520 | @group |
| @@ -2693,8 +2693,8 @@ that remote host. If such a directory does not exist, or | |||
| 2693 | @code{temporary-file-directory} is returned. | 2693 | @code{temporary-file-directory} is returned. |
| 2694 | @end defun | 2694 | @end defun |
| 2695 | 2695 | ||
| 2696 | In order to extract the local part of the path name from a temporary | 2696 | In order to extract the local part of the file's name of a temporary |
| 2697 | file, @code{file-local-name} could be used. | 2697 | file, use @code{file-local-name} (@pxref{Magic File Names}). |
| 2698 | 2698 | ||
| 2699 | @node File Name Completion | 2699 | @node File Name Completion |
| 2700 | @subsection File Name Completion | 2700 | @subsection File Name Completion |
| @@ -3385,11 +3385,24 @@ non-magic directory to serve as its current directory, and this function | |||
| 3385 | is a good way to come up with one. | 3385 | is a good way to come up with one. |
| 3386 | @end defun | 3386 | @end defun |
| 3387 | 3387 | ||
| 3388 | @cindex local part of remote file name | ||
| 3388 | @defun file-local-name filename | 3389 | @defun file-local-name filename |
| 3389 | This function returns the local part of file @var{filename}. For a | 3390 | This function returns the @dfn{local part} of @var{filename}. This is |
| 3390 | remote @var{filename}, it returns a file name which could be used | 3391 | the part of the file's name that identifies it on the remote host, and |
| 3391 | directly as argument of a remote process. If @var{filename} is local, | 3392 | is typically obtained by removing from the remote file name the parts |
| 3392 | this function returns the file name. | 3393 | that specify the remote host and the method of accessing it. For |
| 3394 | example: | ||
| 3395 | |||
| 3396 | @smallexample | ||
| 3397 | (file-local-name "/ssh:@var{user}@@@var{host}:/foo/bar") | ||
| 3398 | @result{} "/foo/bar" | ||
| 3399 | @end smallexample | ||
| 3400 | |||
| 3401 | For a remote @var{filename}, this function returns a file name which | ||
| 3402 | could be used directly as an argument of a remote process | ||
| 3403 | (@pxref{Asynchronous Processes}, and @pxref{Synchronous Processes}), | ||
| 3404 | and as the program to run on the remote host. If @var{filename} is | ||
| 3405 | local, this function returns it unchanged. | ||
| 3393 | @end defun | 3406 | @end defun |
| 3394 | 3407 | ||
| 3395 | @defopt remote-file-name-inhibit-cache | 3408 | @defopt remote-file-name-inhibit-cache |
diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi index 88b0382b7d1..13544298b6e 100644 --- a/doc/lispref/processes.texi +++ b/doc/lispref/processes.texi | |||
| @@ -459,7 +459,9 @@ present in @var{args}. To avoid confusion, it may be best to avoid | |||
| 459 | absolute file names in @var{args}, but rather to specify all file | 459 | absolute file names in @var{args}, but rather to specify all file |
| 460 | names as relative to @code{default-directory}. The function | 460 | names as relative to @code{default-directory}. The function |
| 461 | @code{file-relative-name} is useful for constructing such relative | 461 | @code{file-relative-name} is useful for constructing such relative |
| 462 | file names. | 462 | file names. Alternatively, you can use @code{file-local-name} |
| 463 | (@pxref{Magic File Names}) to obtain an absolute file name as seen | ||
| 464 | from the remote host's perspective. | ||
| 463 | @end defun | 465 | @end defun |
| 464 | 466 | ||
| 465 | @defvar process-file-side-effects | 467 | @defvar process-file-side-effects |
| @@ -842,7 +844,12 @@ In the latter case, the local part of @code{default-directory} becomes | |||
| 842 | the working directory of the process. | 844 | the working directory of the process. |
| 843 | 845 | ||
| 844 | This function does not try to invoke file name handlers for | 846 | This function does not try to invoke file name handlers for |
| 845 | @var{program} or for the rest of @var{args}. | 847 | @var{program} or for the rest of @var{args}. For that reason, if |
| 848 | @var{program} or any of @var{args} use the remote-file syntax | ||
| 849 | (@pxref{Magic File Names}), they must be converted either to file | ||
| 850 | names relative to @code{default-directory}, or to names that identify | ||
| 851 | the files locally on the remote host, by running them through | ||
| 852 | @code{file-local-name}. | ||
| 846 | 853 | ||
| 847 | Depending on the implementation of the file name handler, it might not be | 854 | Depending on the implementation of the file name handler, it might not be |
| 848 | possible to apply @code{process-filter} or @code{process-sentinel} to | 855 | possible to apply @code{process-filter} or @code{process-sentinel} to |
diff --git a/lisp/eshell/esh-proc.el b/lisp/eshell/esh-proc.el index 3735f30c304..384846c7a3c 100644 --- a/lisp/eshell/esh-proc.el +++ b/lisp/eshell/esh-proc.el | |||
| @@ -282,7 +282,6 @@ See `eshell-needs-pipe'." | |||
| 282 | (let ((process-connection-type | 282 | (let ((process-connection-type |
| 283 | (unless (eshell-needs-pipe-p command) | 283 | (unless (eshell-needs-pipe-p command) |
| 284 | process-connection-type)) | 284 | process-connection-type)) |
| 285 | ;; `start-process' can't deal with relative filenames. | ||
| 286 | (command (file-local-name (expand-file-name command)))) | 285 | (command (file-local-name (expand-file-name command)))) |
| 287 | (apply 'start-file-process | 286 | (apply 'start-file-process |
| 288 | (file-name-nondirectory command) nil command args))) | 287 | (file-name-nondirectory command) nil command args))) |
diff --git a/lisp/files.el b/lisp/files.el index fb09c96c47e..0dd597efe11 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -1173,7 +1173,10 @@ consecutive checks. For example: | |||
| 1173 | 1173 | ||
| 1174 | (defun file-local-name (file) | 1174 | (defun file-local-name (file) |
| 1175 | "Return the local name component of FILE. | 1175 | "Return the local name component of FILE. |
| 1176 | It returns a file name which can be used directly as argument of | 1176 | This function removes from FILE the specification of the remote host |
| 1177 | and the method of accessing the host, leaving only the part that | ||
| 1178 | identifies FILE locally on the remote system. | ||
| 1179 | The returned file name can be used directly as argument of | ||
| 1177 | `process-file', `start-file-process', or `shell-command'." | 1180 | `process-file', `start-file-process', or `shell-command'." |
| 1178 | (or (file-remote-p file 'localname) file)) | 1181 | (or (file-remote-p file 'localname) file)) |
| 1179 | 1182 | ||
diff --git a/lisp/simple.el b/lisp/simple.el index 0281464c61f..241f5ece3d0 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -3892,11 +3892,14 @@ interactively, this is t." | |||
| 3892 | (shell-command command t)))) | 3892 | (shell-command command t)))) |
| 3893 | 3893 | ||
| 3894 | (defun process-file (program &optional infile buffer display &rest args) | 3894 | (defun process-file (program &optional infile buffer display &rest args) |
| 3895 | "Process files synchronously in a separate process. | 3895 | "Process files synchronously in a separate process that runs PROGRAM. |
| 3896 | Similar to `call-process', but may invoke a file name handler based on | 3896 | Similar to `call-process', but may invoke a file name handler based on |
| 3897 | `default-directory'. The current working directory of the | 3897 | `default-directory'. The current working directory of the |
| 3898 | subprocess is `default-directory'. | 3898 | subprocess is `default-directory'. |
| 3899 | 3899 | ||
| 3900 | If PROGRAM is a remote file name, it should be processed | ||
| 3901 | by `file-local-name' before passing it to this function. | ||
| 3902 | |||
| 3900 | File names in INFILE and BUFFER are handled normally, but file | 3903 | File names in INFILE and BUFFER are handled normally, but file |
| 3901 | names in ARGS should be relative to `default-directory', as they | 3904 | names in ARGS should be relative to `default-directory', as they |
| 3902 | are passed to the process verbatim. (This is a difference to | 3905 | are passed to the process verbatim. (This is a difference to |
| @@ -3941,12 +3944,15 @@ Similar to `start-process', but may invoke a file name handler based on | |||
| 3941 | 3944 | ||
| 3942 | This handler ought to run PROGRAM, perhaps on the local host, | 3945 | This handler ought to run PROGRAM, perhaps on the local host, |
| 3943 | perhaps on a remote host that corresponds to `default-directory'. | 3946 | perhaps on a remote host that corresponds to `default-directory'. |
| 3944 | In the latter case, the local part of `default-directory' becomes | 3947 | In the latter case, the local part of `default-directory', the one |
| 3945 | the working directory of the process. | 3948 | produced from it by `file-local-name', becomes the working directory |
| 3949 | of the process on the remote host. | ||
| 3946 | 3950 | ||
| 3947 | PROGRAM and PROGRAM-ARGS might be file names. They are not | 3951 | PROGRAM and PROGRAM-ARGS might be file names. They are not |
| 3948 | objects of file name handler invocation. File name handlers might not | 3952 | objects of file name handler invocation, so they need to be obtained |
| 3949 | support pty association, if PROGRAM is nil." | 3953 | by calling `file-local-name', in case they are remote file names. |
| 3954 | |||
| 3955 | File name handlers might not support pty association, if PROGRAM is nil." | ||
| 3950 | (let ((fh (find-file-name-handler default-directory 'start-file-process))) | 3956 | (let ((fh (find-file-name-handler default-directory 'start-file-process))) |
| 3951 | (if fh (apply fh 'start-file-process name buffer program program-args) | 3957 | (if fh (apply fh 'start-file-process name buffer program program-args) |
| 3952 | (apply 'start-process name buffer program program-args)))) | 3958 | (apply 'start-process name buffer program program-args)))) |