如何在Windows上禁用emacs中的哔声 [英] How to disable the beep in emacs on Windows

查看:207
本文介绍了如何在Windows上禁用emacs中的哔声的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Emacs的新手,我在我的Windows机器上下载了GNU emacs。我刚刚完成了简短的教程,但是当我打开文件的开始/结尾,并且在许多其他情况下,我发现有一个哔声,这对我来说有点令人不安。



<我在线搜索,我发现有人说这个

 (setq visible-bell 1)

,但我不知道该怎么做。首先,我的.emacs文件在哪里?还是有另一种方法呢?我的意思是在emacs窗口菜单中有选项 - >自定义Emacs ,但我找不到设置的位置。我觉得很难找到东西,除非你已经知道它在哪里了。

解决方案

你有几个选项,其中一个不需要你知道文件在哪里;然而,在适当的时候,你几乎肯定要修改文件,所以让我们从那里开始。


首先,在哪里我的.emacs文件是什么?


您还可以选择该文件的名称。 〜/ .emacs 是默认值,但也可以是〜/ .emacs.el 〜/ .emacs.d / init.el 。 (个人而言,我更喜欢后者,以便将所有Emacs相关的文件保存在相同的 .emacs.d 目录下,但我们将默认使用,您可以随时重新命名该文件。)



首先,检查一下现有文件。



< kbd> Ch v user-init-file RET



默认情况下,它将显示一条以 /。emacs 结尾的文件路径(即使该文件不存在),但是(不太可能,在你的情况下,它的结束在 /。emacs.el /。emacs.d / init.el 那么这将意味着您在该位置有一个现有的init文件。



使用适当的以下选项加载该文件:




  • Cx Cf 〜/ .emacs RET

  • Cx Cf 〜/ .emacs.el RET

  • Cx Cf 〜/ .emacs.d / init。 EL RET



或者你可以加载它,不管它在哪里:

M - : (find-file user-init-file) RET



然后你可以简单地将这行代码添加到文件中:

 (setq visible-bell 1)

保存文件:



Cx Cs



下次启动Emacs时,会使用



您也可以使用光标在右括号后键入 Cx Ce 来立即评估设置。



现在你知道如何做,另一种方法是:




  • Mx customize-variable RET visible-bell kbd> RET

  • 点击切换按钮打开设置。

  • 点击保存以后的会话按钮保存它到你的init文件。



如果你看看你的init文件,你会看到它被添加到(custom-set-variables ...)部分。



至于你的.emacs文件 / em>,它是一个Emacs Lisp(elisp)代码的个人库,当您启动Emacs时,它将自动加载和评估。所有Emacs的配置和定制都是用这种语言编写的(确实是编辑器本身的大部分)。



您可以阅读更多关于init文件和自定义Emacs通过键入以下内容:



M - : (info(emacs)Customization code> RET


Ch g code>(emacs)定制
RET



您可能需要学习如何使用信息阅读器第一。从 * info * 缓冲区,您可以键入 h 开始其教程,并且 d 返回到顶层页面(在顶部有一些有用的注释)。


还有另一种方法吗?我的意思是在emacs窗口菜单中有选项 - >自定义Emacs,但我找不到设置的位置。


具体选项 - >可见铃是该方法的答案。但请注意,并不是所有的菜单都可以使用,所以这并不总是答案,很多人完全禁用菜单栏,因为没有它可以访问所有的东西。 (我更倾向于建议浏览菜单,作为发现人们认为有用的一些选项,以确保您不依赖于他们的方式。)


我觉得很难找到东西,除非你已经知道它在哪里。


这是肯定的,但Emacs的自我文档方面意味着即使你不知道 要在哪里看,你几乎可以随时找到如果你知道 来看看。



诚然,即使是这样做,也有一个明确的学习曲线,但是我建议尽可能多地学习Emacs的这个方面尽快。这将让您开始:



http:// emacswiki。 org / emacs / SelfDocumentation


Hi I'm new to Emacs and I downloaded GNU emacs on my windows machine. I just finished the short tutorial but I found there's a beep sound whenever I hit the beginning/end of a file and in many other cases, which is a little disturbing to me.

I searched online and I found people saying putting this

(setq visible-bell 1)

in my .emacs file, but I don't know how to do that. First, where is my .emacs file and what is it? Or is there another way to do it? I mean in the emacs window menu there is Options -> Customize Emacs but I couldn't find where the setting is. I feel like it's kind of hard to find things in there unless you already know where it is.

解决方案

You have a couple of options, one of which doesn't require you to know where the file is; however in due course you're almost certainly going to want to make changes to the file, so let's start there.

First, where is my .emacs file and what is it?

You also have some options for the name of that file. ~/.emacs is the default, but it could also be ~/.emacs.el or ~/.emacs.d/init.el. (Personally I prefer the latter, so as to keep all Emacs related files under that same .emacs.d directory, but we'll go with the default, and you can always rename the file later.)

So first, check to see if you have an existing file.

C-hv user-init-file RET

By default it will show you a file path ending in /.emacs (even if that file doesn't exist), but on the (unlikely, in your case) offchance that it ends in /.emacs.el or /.emacs.d/init.el then it would mean that you have an existing init file at that location.

Load that file with the appropriate one of the following:

  • C-xC-f ~/.emacs RET
  • C-xC-f ~/.emacs.el RET
  • C-xC-f ~/.emacs.d/init.el RET

Or you could load it regardless of where it was with:
M-: (find-file user-init-file) RET

Then you can simply add that line of code to the file:

(setq visible-bell 1)

Save the file:

C-xC-s

And the next time you start Emacs, it will use that setting.

You can also evaluate the setting immediately by typing C-xC-e with the cursor after the closing parenthesis.

Now that you know how to do that, the other approach is:

  • M-x customize-variable RET visible-bell RET
  • Click the "Toggle" button to turn the setting on.
  • Click the "Save for future sessions" button to save it to your init file.

If you then look at your init file, you will see that it has been added to the (custom-set-variables ...) section.

As for what your .emacs file is, it's a personal library of Emacs Lisp (elisp) code which is automatically loaded and evaluated when you start Emacs. All Emacs configuration and customization is written in this language (as indeed is the majority of the editor itself).

You can read more about the init file and customizing Emacs in the built-in manual, by typing:

M-: (info "(emacs) Customization") RET
or C-hig (emacs) Customization RET

You may need to learn how to use the info reader first. From the *info* buffer you can type h to start its tutorial, and d to return to the top level page (which has some useful notes at the top).

Or is there another way to do it? I mean in the emacs window menu there is Options -> Customize Emacs but I couldn't find where the setting is.

"Specific Option" -> "visible-bell" was the answer for that approach. But do take note that not everything is available through those menus, so that won't always be the answer, and lots of people disable the menu bar entirely, because everything can be accessed without it. (I'm more inclined to suggest browsing through the menus as a way of discovering some of the options which people thought were useful enough to put in there, but make sure you're not reliant on them.)

I feel like it's kind of hard to find things in there unless you already know where it is.

That's certainly true to an extent, but the self-documentation aspect of Emacs means that even if you don't know where to look, you can almost always find out if you know how to look.

Admittedly there's a definite learning curve even on doing that, but I recommend learning as much as you can about this aspect of Emacs as soon as possible. This will get you started:

http://emacswiki.org/emacs/SelfDocumentation

这篇关于如何在Windows上禁用emacs中的哔声的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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