为什么我的 emacs 会发出声音(文件末尾有噪音)?
Why is my emacs barking (noise at the end of file)?
我相当确定这是我自己造成的,但我这辈子都记不起是怎么回事了。
每次我在 emacs 中到达缓冲区的末尾并按 C-n 时,emacs 都会像狗一样狂吠。我认为树皮可能是某个地方的自定义声音文件,用于替换默认情况下的铃声。不过,我不知道声音文件或配置设置在哪里。
这是我唯一的配置文件:
init.el
;; Added by Package.el. This must come before configurations of
;; installed packages. Don't delete this line. If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(package-initialize)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(gdb-many-windows t)
'(gdb-show-main t)
'(inhibit-startup-screen t)
'(package-selected-packages '(slime nasm-mode org-roam zig-mode)))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
;; INIT.EL
;; Maximize the window on startup
(add-to-list 'default-frame-alist '(fullscreen . maximized))
;; Turn off backups
(setq make-backup-files nil)
;; Auto revert changed buffers
(global-auto-revert-mode 1)
;; source: http://steve.yegge.googlepages.com/my-dot-emacs-file
(defun rename-file-and-buffer (new-name)
"Renames both current buffer and file it's visiting to NEW-NAME."
(interactive "sNew name: ")
(let ((name (buffer-name))
(filename (buffer-file-name)))
(if (not filename)
(message "Buffer '%s' is not visiting a file!" name)
(if (get-buffer new-name)
(message "A buffer named '%s' already exists!" new-name)
(progn
(rename-file filename new-name 1)
(rename-buffer new-name)
(set-visited-file-name new-name)
(set-buffer-modified-p nil))))))
;; source:
(defun my-asm-mode-hook ()
;; you can use `comment-dwim' (M-;) for this kind of behaviour anyway
(local-unset-key (vector asm-comment-char))
;; (local-unset-key "<return>") ; doesn't work. "RET" in a terminal. http://emacs.stackexchange.com/questions/13286/how-can-i-stop-the-enter-key-from-triggering-a-completion-in-company-mode
(electric-indent-local-mode) ; toggle off
; (setq tab-width 4)
(setq indent-tabs-mode nil)
;; asm-mode sets it locally to nil, to "stay closer to the old TAB behaviour".
;; (setq tab-always-indent (default-value 'tab-always-indent))
(defun asm-calculate-indentation ()
(or
;; Flush labels to the left margin.
; (and (looking-at "\(\.\|\sw\|\s_\)+:") 0)
(and (looking-at "[.@_[:word:]]+:") 0)
;; Same thing for `;;;' comments.
(and (looking-at "\s<\s<\s<") 0)
;; %if nasm macro stuff goes to the left margin
(and (looking-at "%") 0)
(and (looking-at "c?global\|section\|default\|align\|INIT_..X") 0)
;; Simple `;' comments go to the comment-column
;(and (looking-at "\s<\(\S<\|\'\)") comment-column)
;; The rest goes at column 4
(or 4)))
)
(add-hook 'asm-mode-hook #'my-asm-mode-hook)
(setq inferior-lisp-program "sbcl")
(windmove-default-keybindings)
(add-hook 'c-mode-hook #'display-fill-column-indicator-mode)
关于这个问题我有两个疑问:
- 如何禁用此“功能”?
- 如果不在 init.el 中,emacs 在哪里存储配置?
很可能在您的 OS 某处将声音设置为默认闹钟。
这里有一个很好的资源,可用于进一步自定义警报是否触发以及如何触发:
https://www.emacswiki.org/emacs/AlarmBell
完全关闭它:(setq ring-bell-function 'ignore)
我相当确定这是我自己造成的,但我这辈子都记不起是怎么回事了。
每次我在 emacs 中到达缓冲区的末尾并按 C-n 时,emacs 都会像狗一样狂吠。我认为树皮可能是某个地方的自定义声音文件,用于替换默认情况下的铃声。不过,我不知道声音文件或配置设置在哪里。
这是我唯一的配置文件:
init.el
;; Added by Package.el. This must come before configurations of
;; installed packages. Don't delete this line. If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(package-initialize)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(gdb-many-windows t)
'(gdb-show-main t)
'(inhibit-startup-screen t)
'(package-selected-packages '(slime nasm-mode org-roam zig-mode)))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
;; INIT.EL
;; Maximize the window on startup
(add-to-list 'default-frame-alist '(fullscreen . maximized))
;; Turn off backups
(setq make-backup-files nil)
;; Auto revert changed buffers
(global-auto-revert-mode 1)
;; source: http://steve.yegge.googlepages.com/my-dot-emacs-file
(defun rename-file-and-buffer (new-name)
"Renames both current buffer and file it's visiting to NEW-NAME."
(interactive "sNew name: ")
(let ((name (buffer-name))
(filename (buffer-file-name)))
(if (not filename)
(message "Buffer '%s' is not visiting a file!" name)
(if (get-buffer new-name)
(message "A buffer named '%s' already exists!" new-name)
(progn
(rename-file filename new-name 1)
(rename-buffer new-name)
(set-visited-file-name new-name)
(set-buffer-modified-p nil))))))
;; source:
(defun my-asm-mode-hook ()
;; you can use `comment-dwim' (M-;) for this kind of behaviour anyway
(local-unset-key (vector asm-comment-char))
;; (local-unset-key "<return>") ; doesn't work. "RET" in a terminal. http://emacs.stackexchange.com/questions/13286/how-can-i-stop-the-enter-key-from-triggering-a-completion-in-company-mode
(electric-indent-local-mode) ; toggle off
; (setq tab-width 4)
(setq indent-tabs-mode nil)
;; asm-mode sets it locally to nil, to "stay closer to the old TAB behaviour".
;; (setq tab-always-indent (default-value 'tab-always-indent))
(defun asm-calculate-indentation ()
(or
;; Flush labels to the left margin.
; (and (looking-at "\(\.\|\sw\|\s_\)+:") 0)
(and (looking-at "[.@_[:word:]]+:") 0)
;; Same thing for `;;;' comments.
(and (looking-at "\s<\s<\s<") 0)
;; %if nasm macro stuff goes to the left margin
(and (looking-at "%") 0)
(and (looking-at "c?global\|section\|default\|align\|INIT_..X") 0)
;; Simple `;' comments go to the comment-column
;(and (looking-at "\s<\(\S<\|\'\)") comment-column)
;; The rest goes at column 4
(or 4)))
)
(add-hook 'asm-mode-hook #'my-asm-mode-hook)
(setq inferior-lisp-program "sbcl")
(windmove-default-keybindings)
(add-hook 'c-mode-hook #'display-fill-column-indicator-mode)
关于这个问题我有两个疑问:
- 如何禁用此“功能”?
- 如果不在 init.el 中,emacs 在哪里存储配置?
很可能在您的 OS 某处将声音设置为默认闹钟。
这里有一个很好的资源,可用于进一步自定义警报是否触发以及如何触发: https://www.emacswiki.org/emacs/AlarmBell
完全关闭它:(setq ring-bell-function 'ignore)