简体   繁体   English

在emacs中使用任意文件名运行程序

[英]Run program with arbitrary filename in emacs

I want to launch an arbitrary program that takes selected filename argument from a buffer that lists files in a directory. 我想启动一个任意程序,该程序从列出目录中文件的缓冲区中获取选定的文件名参数。

I tried to use F3 key to insert the filename but the following records a new macro instead which is rather confusing. 我试图使用F3键插入文件名,但是下面记录了一个新的宏,这很令人困惑。

(define-key minibuffer-local-map [f3] (lambda () (interactive (find-file-at-point))))

You're problem is not completely clear to me, but maybe this helps. 您的问题对我来说还不是很清楚,但这也许会有所帮助。

Please see the following screenshot of my Emacs in the scratch buffer. 请在暂存缓冲区中查看我的Emacs的以下屏幕截图。 It contains a function and the keybinding, the echo area at the bottom is showing the results from the call to message 它包含一个函数和键盘绑定,底部的回显区域显示了调用message的结果

在此处输入图片说明

For your convenience, here is the function and the keybinding repeated for better copying: 为了您的方便起见,以下是为了更好地复制而重复的功能和键绑定:

(defun command-on-file-at-point ()
  (interactive)
  (let ((f (ffap-file-at-point)))
    (message "File is %s" f)))

(global-set-key [f3] 'command-on-file-at-point)

Hope, that helps. 希望有帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 检查任意字符串是否为有效文件名的最简单方法 - Easiest way to check if an arbitrary String is a valid filename 访问传递给其程序中Fortran可执行文件的文件名 - Accesing filename passed to Fortran executable within its program 使用Python程序创建并运行Python程序 - Create and run Python program with a Python program 如何运行另一个python程序 - How to run another python program 有没有办法从另一个java程序中运行java程序? - Is there a way to run a java program from within another java program? 如何在每次执行PHP程序时为输出文件(.xml文件)生成新的文件名 - How to generate new filename for the output file (.xml file) while executing a PHP program each time 拒绝访问路径'C:\\ Program Files(x86)\\ Common Files \\ Microsoft Shared \\ DevServer \\ 10.0 \\ fileName' - Access to the path 'C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\10.0\fileName' is denied 我正在尝试制作一个小程序,其中用户输入文件名,并将文件名写入txt文件 - I'm trying to make a small program where the user enters a filename, and the name of the file is written into the txt file 用户提供文件名时无法读取文件(使用 nasm 的 x86 汇编程序) - unable to read from file when user provides filename (x86 assembly program using nasm) 如何在没有以root身份运行的程序中以root身份写入文件? - How to write a file as root in a program that is not run as root?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM