在Linux的.tcshrc文件中,以只读模式创建emacs的别名 [英] Creating an alias for emacs in read-only mode on Linux in my .tcshrc file

查看:274
本文介绍了在Linux的.tcshrc文件中,以只读模式创建emacs的别名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



基本上,我试图在.tcshrc文件中放入一个别名(或某物),以便我可以在emacs中打开一个文件,只读(不必每次都输入blurb)。我发现这个 - https://superuser.com/questions/204236/how-can-i-open-a-file-read-only-from-command-line-with-emacs-vi-vim - 但是tcsh不支持函数(我想)我不能使用这个方法。



以只读格式打开emacs的命令行文本是:



emacs FILE_NAME --eval'(setq buffer-read-only t)'



任何想法?



谢谢
P。

解决方案

tcsh别名中的引号和括号可能会有问题,所以在Satish的答案中,--funcall toggle-read-only 可能比 - eval 更容易使用。要在文件名后插入一个参数,可以使用第一个参数的 \!:1 表达式:

 别名emacs-ro emacs \!:1 --funcall toggle-read-only 


Just so you know this is my first ever post.

Basically, I am trying to put in an alias (or something) in my .tcshrc file so that I can open a file in emacs read-only (without having to type the blurb below everytime). I found this - https://superuser.com/questions/204236/how-can-i-open-a-file-read-only-from-command-line-with-emacs-vi-vim - but since tcsh does not support functions (I think) I cannot use this method.

The command line text for opening emacs in read-only format is this:

emacs FILE_NAME --eval '(setq buffer-read-only t)'

Any ideas?

Thanks P.

解决方案

Quotes and parens in tcsh aliases can be problematic, so --funcall toggle-read-only in Satish's answer is probably easier to use than --eval. To insert an argument after the filename, you can use the \!:1 expression for the first argument:

alias emacs-ro emacs \!:1 --funcall toggle-read-only

这篇关于在Linux的.tcshrc文件中,以只读模式创建emacs的别名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆