Windowsを使っていると、RDPでコピー&ペーストしたいことがある。
Emacs引きこもり生活をしているとこれがちょっと、こまる。Emacsのcopy-fileだと、バッファにファイルがコピーされるわけではないからだ。本当にただのcopy-file。テキストのコピー&ペーストをできるのだけれど。
なんとなくw32-shell-executeのドキュメントをながめてみたらいつの間にか、できるようになっていた。
(w32-shell-execute "copy" ファイル名)
w32-shell-execute is a built-in function in ‘C source code’. (w32-shell-execute OPERATION DOCUMENT &optional PARAMETERS SHOW-FLAG) Get Windows to perform OPERATION on DOCUMENT. This is a wrapper around the ShellExecute system function, which invokes the application registered to handle OPERATION for DOCUMENT. OPERATION is either nil or a sw32-shell-execute is a built-in function in ‘C source code’. (w32-shell-execute OPERATION DOCUMENT &optional PARAMETERS SHOW-FLAG) Get Windows to perform OPERATION on DOCUMENT. This is a wrapper around the ShellExecute system function, which invokes the application registered to handle OPERATION for DOCUMENT. OPERATION is either nil or a string that names a supported operation. What operations can be used depends on the particular DOCUMENT and its handler application, but typically it is one of the following common operations: "open" - open DOCUMENT, which could be a file, a directory, or an executable program (application). If it is an application, that application is launched in the current buffer’s default directory. Otherwise, the application associated with DOCUMENT is launched in the buffer’s default directory. "opennew" - like "open", but instruct the application to open DOCUMENT in a new window. "openas" - open the "Open With" dialog for DOCUMENT. "print" - print DOCUMENT, which must be a file. "printto" - print DOCUMENT, which must be a file, to a specified printer. The printer should be provided in PARAMETERS, see below. "explore" - start the Windows Explorer on DOCUMENT. "edit" - launch an editor and open DOCUMENT for editing; which editor is launched depends on the association for the specified DOCUMENT. "find" - initiate search starting from DOCUMENT, which must specify a directory. "delete" - move DOCUMENT, a file or a directory, to Recycle Bin. "copy" - copy DOCUMENT, which must be a file or a directory, into the clipboard. "cut" - move DOCUMENT, a file or a directory, into the clipboard. "paste" - paste the file whose name is in the clipboard into DOCUMENT, which must be a directory. "pastelink" - create a shortcut in DOCUMENT (which must be a directory) the file or directory whose name is in the clipboard. "runas" - run DOCUMENT, which must be an excutable file, with elevated privileges (a.k.a. "as Administrator"). "properties" - open the property sheet dialog for DOCUMENT. nil - invoke the default OPERATION, or "open" if default is not defined or unavailable. DOCUMENT is typically the name of a document file or a URL, but can also be an executable program to run, or a directory to open in the Windows Explorer. If it is a file or a directory, it must be a local one; this function does not support remote file names. If DOCUMENT is an executable program, the optional third arg PARAMETERS can be a string containing command line parameters, separated by blanks, that will be passed to the program. Some values of OPERATION also require parameters (e.g., "printto" requires the printer address). Otherwise, PARAMETERS should be nil or unspecified. Note that double quote characters in PARAMETERS must each be enclosed in 2 additional quotes, as in """. Optional fourth argument SHOW-FLAG can be used to control how the application will be displayed when it is invoked. If SHOW-FLAG is nil or unspecified, the application is displayed as if SHOW-FLAG of 10 was specified, otherwise it is an integer between 0 and 11 representing a ShowWindow flag: 0 - start hidden 1 - start as normal-size window 3 - start in a maximized window 6 - start in a minimized window 10 - start as the application itself specifies; this is the default. tring that names a supported operation. What operations can be used depends on the particular DOCUMENT and its handler application, but typically it is one of the following common operations: "open" - open DOCUMENT, which could be a file, a directory, or an executable program (application). If it is an application, that application is launched in the current buffer’s default directory. Otherwise, the application associated with DOCUMENT is launched in the buffer’s default directory. "opennew" - like "open", but instruct the application to open DOCUMENT in a new window. "openas" - open the "Open With" dialog for DOCUMENT. "print" - print DOCUMENT, which must be a file. "printto" - print DOCUMENT, which must be a file, to a specified printer. The printer should be provided in PARAMETERS, see below. "explore" - start the Windows Explorer on DOCUMENT. "edit" - launch an editor and open DOCUMENT for editing; which editor is launched depends on the association for the specified DOCUMENT. "find" - initiate search starting from DOCUMENT, which must specify a directory. "delete" - move DOCUMENT, a file or a directory, to Recycle Bin. "copy" - copy DOCUMENT, which must be a file or a directory, into the clipboard. "cut" - move DOCUMENT, a file or a directory, into the clipboard. "paste" - paste the file whose name is in the clipboard into DOCUMENT, which must be a directory. "pastelink" - create a shortcut in DOCUMENT (which must be a directory) the file or directory whose name is in the clipboard. "runas" - run DOCUMENT, which must be an excutable file, with elevated privileges (a.k.a. "as Administrator"). "properties" - open the property sheet dialog for DOCUMENT. nil - invoke the default OPERATION, or "open" if default is not defined or unavailable. DOCUMENT is typically the name of a document file or a URL, but can also be an executable program to run, or a directory to open in the Windows Explorer. If it is a file or a directory, it must be a local one; this function does not support remote file names. If DOCUMENT is an executable program, the optional third arg PARAMETERS can be a string containing command line parameters, separated by blanks, that will be passed to the program. Some values of OPERATION also require parameters (e.g., "printto" requires the printer address). Otherwise, PARAMETERS should be nil or unspecified. Note that double quote characters in PARAMETERS must each be enclosed in 2 additional quotes, as in """. Optional fourth argument SHOW-FLAG can be used to control how the application will be displayed when it is invoked. If SHOW-FLAG is nil or unspecified, the application is displayed as if SHOW-FLAG of 10 was specified, otherwise it is an integer between 0 and 11 representing a ShowWindow flag: 0 - start hidden 1 - start as normal-size window 3 - start in a maximized window 6 - start in a minimized window 10 - start as the application itself specifies; this is the default.
以前はできなかったのに。