简体   繁体   English

在 Emacs 中恢复为全局缓冲寄存器

[英]In Emacs revert to global buffer registers

I'm using Emacs 26.3 with Spacemacs 0.300 and the registers don't cross from buffer to buffer (global registers).我正在使用带有 Spacemacs 0.300 的 Emacs 26.3 并且寄存器不会在缓冲区之间交叉(全局寄存器)。 From what I read on the EmacsWiki this is supposed to be global by default.根据我在EmacsWiki上阅读的内容,默认情况下这应该是全局的。 Mine apparently is not, I can't find anywhere it's being set to local but it's behaving as such.我的显然不是,我找不到它被设置为本地的任何地方,但它的行为就是这样。 However, while this:然而,虽然这样:

(make-variable-buffer-local 'register-alist)

makes a variable local to the buffer, I can't find what to do to make it back global, there's no make-variable-global function.在缓冲区中创建一个本地变量,我找不到如何使它回到全局,没有make-variable-global function。

Hope someone has a suggestion, it's frustrating to insert a register I just saved and have it tell me there's nothing there!希望有人有建议,插入我刚刚保存的寄存器并让它告诉我那里什么都没有,这很令人沮丧!

You can't make a variable global that's been declared to always be buffer-local.不能将已声明为始终为缓冲区局部的变量设为全局变量。

This is why this hammer is used relatively infrequently - when you know that the variable should always be buffer local.这就是为什么这个锤子相对不经常使用的原因——当你知道变量应该总是缓冲区本地时。

Instead, you typically just use setq-local or set with make-local-variable , which assign a buffer-local value only for the given buffer.相反,您通常只使用setq-localset with make-local-variable ,它们仅为给定缓冲区分配缓冲区本地值。 Nothing then prevents some other buffer from not having any buffer-local value.然后没有什么可以阻止其他缓冲区没有任何缓冲区本地值。

You can of course use makunbound to, in effect, start over with your variable unbound.您当然可以使用makunbound实际上从您的变量 unbound 重新开始。 But that's hardly a great solution for a situation where a variable has already been declared to always be buffer-local and you want it to not have a buffer-local value in some buffer.但这对于变量已经被声明为始终为缓冲区本地并且您希望它在某个缓冲区中没有缓冲区本地值的情况而言,这并不是一个很好的解决方案。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM