如何更改Emacs自动恢复文件的名称? [英] How do I change the name of Emacs auto-recovery file?
问题描述
目前,它以格式保存文件:
。#main.c - > sara@sara.home.com.27017:1231918415
这使它成为问题,因为它结束。 c。
我需要它。#main.c#
更新:我有emacs 22.1
这不是自动恢复文件,这是用作该文件的锁定令牌的链接。
更新
如果我告诉你,你能介绍一下Summer Glau吗?
这可能不是容易改变的;我只是挖了一下,看起来像是在C代码中设置的。但是让我们问下一个问题:你为什么要这样?我猜你正在使用 .c
正则表达式,您不想与之匹配。如果是这样,请注意,所有这些锁定文件链接以开始。#
- 总是硬编码 - 所以你可以总是排除名称匹配^。#的文件取决于你使用哪个正则表达式语法。)
如果你真的想破解它,它在filelock.c在EMACS 22中的第320行。这是代码:
/ *将FN的锁定文件的名称写入LFNAME。长度将为
,FN加上另外两个为领先的`。#'加1为
的结尾期加上一个为数字后加上一个为
null。 * /
#define MAKE_LOCK_NAME(lock,file)\
(lock =(char *)alloca(SBYTES(file)+ 2 + 1 + 1 + 1),\
fill_in_lock_file_name (lock,(file)))
static void
fill_in_lock_file_name(lockfile,fn)
register char * lockfile;
注册Lisp_Object fn;
{
注册char * p;
struct stat st;
int count = 0;
strcpy(lockfile,SDATA(fn));
/ *将文件名的非目录部分(包括null)
右移两个字符。这里是我们必须
做一些支持14个字符的最大文件名的地方之一。 * /
for(p = lockfile + strlen(lockfile); p!= lockfile& * p!='/'; p--)
p [2] = * p;
/ *插入`。#'。 * /
p [1] ='。'
p [2] ='#';
p = p + strlen(p);
while(lstat(lockfile,& st)== 0&!S_ISLNK(st.st_mode))
{
if(count> 9)
{
* p ='\0';
return;
}
sprintf(p,。%d,count ++);
}
}
At the moment it saves the file with format:
.#main.c -> sara@sara.home.com.27017:1231918415
This makes it problematic since it ends with ".c".
I need it to be .#main.c#
Update: I have emacs 22.1
That's not the auto-recovery file, that's the link used as a locking token for the file.
update
If I tell you, will you introduce me to Summer Glau?
It's probably not going to be easy to change that; I just dug a bit and it looks like it's set in the C code. But let's ask the next question: why do you want to? I'm guessing you're hitting a regular expression for .c
files that you don't want to match these. If so, note that all these lockfile links start with .#
-- invariably, that's hardcoded -- so you could always exclude files with names that match "^.#" (depending on which regex syntax you use.)
If you really want to hack at it, it's in filelock.c at about line 320 in EMACS 22. Here's the code:
/* Write the name of the lock file for FN into LFNAME. Length will be
that of FN plus two more for the leading `.#' plus 1 for the
trailing period plus one for the digit after it plus one for the
null. */
#define MAKE_LOCK_NAME(lock, file) \
(lock = (char *) alloca (SBYTES (file) + 2 + 1 + 1 + 1), \
fill_in_lock_file_name (lock, (file)))
static void
fill_in_lock_file_name (lockfile, fn)
register char *lockfile;
register Lisp_Object fn;
{
register char *p;
struct stat st;
int count = 0;
strcpy (lockfile, SDATA (fn));
/* Shift the nondirectory part of the file name (including the null)
right two characters. Here is one of the places where we'd have to
do something to support 14-character-max file names. */
for (p = lockfile + strlen (lockfile); p != lockfile && *p != '/'; p--)
p[2] = *p;
/* Insert the `.#'. */
p[1] = '.';
p[2] = '#';
p = p + strlen (p);
while (lstat (lockfile, &st) == 0 && !S_ISLNK (st.st_mode))
{
if (count > 9)
{
*p = '\0';
return;
}
sprintf (p, ".%d", count++);
}
}
这篇关于如何更改Emacs自动恢复文件的名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!