在emacs中创建别名? [英] Create aliases in emacs?

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

问题描述

我有一个emacs的副本,我使用从一个拇指驱动器的几个不同的(Windows)电脑,我想知道是否可以创建一个类似于bash别名或符号链接的内容emacs的?我可以在find-file中使用的东西是我正在寻找的主要内容,所以例如: C-f< some link> 会带我去某个地方。目前我每次到新电脑时都要添加一个新的defun,这只是一种痛苦,我会发誓我已经看到这个,但是几个月的谷歌已经没有了。



我现在所做的一切就像:

 (交互式)
(查找文件c:/ cygwin / home / awesome))

但是,只要访问一个相当的黑客,只要访问一个文件,我访问半透明,经常。而且需要大量的努力来设置一个新的文件。



尽管如此,最大的问题是,它不符合我的工作流程。当我想访问一个文件时,我总是会执行 Cx Cf ,如果我意识到嘿,我正在上班,那么我必须要 Cg Mx go-awesome 。也许会更清楚,如果我说我想要能够做一些相当于一个 ln -s / some / awesome / dir 但内部emacs的东西,而不是内置到操作系统,所以 Cx Cf〜/ awesome / some / sub / dir 将在Windows或其他任何地方工作。

解决方案

我不太清楚你在问什么。我将我常用的文件存储在我的.emacs中的寄存器中:

 (set-register?c'(file。c :/data/common.txt))
(set-register?f'(file。c:/data/frequent.txt))

然后我可以跳转到一个文件, jump-to-register Cx rj ):



例如, Cx rjc 需要我到$ $ c> c:/data/common.txt (如果需要加载)



这是你要找的? / p>

I have a copy of emacs that I use on a couple of different (windows) computers from a thumb drive, and I am wondering if it is possible to create something that is sort of the equivalent of a bash alias or symlink within emacs? Something that I could use within find-file is the main thing that i'm looking for, so for example: C-f <some link> would take me somewhere. Currently I have to add a new defun every time i get to a new computer, which is just kind of a pain and I would swear i've seen this somewhere, but months of googling have turned up nothing.

What i've got right now is something like:

(defun go-awesome ()
   "Find my way to my work home"
   (interactive)
   (find-file "c:/cygwin/home/awesome"))

But that feels increadibly overdone and hacky for just visiting a fairly hacky for just visiting a file that i visit semi-regularly. And it requires a lot of effort to set up a new file.

The biggest problem with it though, in my opinion is that it doesn't fit in my workflow. When i want to visit a file i always do C-x C-f, and if i realize that "hey i'm at work" i then have to C-g M-x go-awesome. Perhaps it would be more clear if i said that i wanted to be able to do something that is the equivalent of an ln -s /some/awesome/dir but internal to emacs, instead of built into the OS, so that C-x C-f ~/awesome/some/sub/dir would work on windows or anywhere else.

解决方案

I'm not really clear on what you're asking for. I store my commonly-used files in registers in my .emacs:

(set-register ?c '(file . "c:/data/common.txt"))
(set-register ?f '(file . "c:/data/frequent.txt"))

Then I can jump to a file with jump-to-register (C-x r j):

For example, "C-x r j c" takes me to c:/data/common.txt (loading it if necessary).

Is that what you're looking for?

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

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