Emacs 24中可变范围的新规则是什么? [英] What are the new rules for variable scoping in Emacs 24?

查看:179
本文介绍了Emacs 24中可变范围的新规则是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Emacs 24现在具有词法范围的变量。当然,它还有动态范围的变量。既然有了这两个,那么当一个变量有什么样的范围时,我感到很困惑。有一个词法绑定变量,用于控制词法绑定是否启用,我想我读了一些有关 defvar 的声明一个动态范围的变量,但一般我很迷失。 Emacs 24的新范围界定规则有什么好的解释吗?或者换个方法,当我看看为Emacs 24编写的Emacs Lisp代码中的一个变量时,我该如何判断该变量在使用什么范围?

解决方案

手册是确定的来源。从这里开始:



Ch g (elisp )变量范围 RET



我最初在这个答案中引用了手册,但是这个信息(可追溯到Emacs 24.0.90.1)稍微过时了。更好地从Emacs内部阅读手册,以便您正在使用的版本信息正确。



如果您特别想在网页上阅读,目前的版本是:

http ://www.gnu.org/software/emacs/manual/html_node/elisp/Variable-Scoping.html


Emacs 24 now has lexically-scoped variables. It also still has dynamically-scoped variables, of course. Now that it has both, I'm quite confused about when a variable will have which kind of scope. There's a lexical-binding variable that controls when lexical binding is enabled, and I think I read something about defvar now declaring a dynamically-scoped variable, but in general I'm pretty lost. Is there a good explanation somewhere of Emacs 24's new scoping rules? Or put another way, when I look at a variable in Emacs Lisp code written for Emacs 24, how do I tell what scope that variable is using?

解决方案

The manual is the definitive source. Start here:

C-hig (elisp) Variable Scoping RET

I had originally quoted the manual in this answer, but that information (dating back to Emacs 24.0.90.1) was slightly out of date. Better to read the manual from inside Emacs so that the information will be correct for the version you're using.

If you particularly want to read it on a web page, the current version is:
http://www.gnu.org/software/emacs/manual/html_node/elisp/Variable-Scoping.html

这篇关于Emacs 24中可变范围的新规则是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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