我有这样的~/.emacs
设置
; Package setup
(require 'package)
(add-to-list 'package-archives (cons "melpa" "https://melpa.org/packages/") t)
(package-initialize)
; Define all my packages as a list to make it easier to maintain
(setq pkg-list
(list
'evil
'gruvbox-theme
'powerline
'use-package
'flycheck
'company
'irony
'company-irony
)
)
; For all packages, install it if it's not already installed
(dolist (pkg pkg-list)
(unless (package-installed-p pkg)
(package-install pkg)))
; Enable evil-mode
(require 'evil)
(evil-mode 1)
; Gruvbox theme
(require 'gruvbox-theme)
(load-theme 'gruvbox-dark-hard t)
; Powerline theme
(require 'powerline)
(powerline-center-evil-theme)
; use-package
(require 'use-package)
(use-package company
:hook ((c-mode . company-mode)
(c++-mode . company-mode)
(c-or-c++-mode . company-mode)))
(use-package irony
:hook ((c-mode . irony-mode)
(c++-mode . irony-mode)
(c-or-c++-mode . irony-mode))
:config
(add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options))
(use-package company-irony
:hook irony-mode
:config
(require 'company)
(add-to-list 'company-backends 'company-irony)
)
; Disable menubar and toolbar and scrollbar
(menu-bar-mode 0)
(tool-bar-mode 0)
(toggle-scroll-bar -1)
; disable splash screen
(setq inhibit-startup-message t)
(setq initial-scratch-message nil)
; disable adding newline to end of file upon saving
(setq require-final-newline nil)
; send backup fils to ~/.enacs subdir
(setq backup-directory-alist
`((".*" . "~/.emacs/backups")))
; Make sure "custom" stuff goes elsewhere
(setq custom-file "~/.emacs.d/custom.el")
(load custom-file :noerror)
加载 C/C++ 文件后,我在 minibuffer 中收到以下错误File mode specification error: (wrong-number-of-arguments (1 . 2) 0)
此错误仅在打开 C/C++ 文件时发生。
通过使用内置的 emacs 调试器,我能够跟踪错误,company-irony()
但我无法弄清楚究竟是什么导致了错误
这是调试器回溯:
Debugger entered--Lisp error: (wrong-number-of-arguments (1 . 2) 0)
company-irony()
run-hooks(irony-mode-hook irony-mode-on-hook)
irony-mode()
run-hooks(change-major-mode-after-body-hook prog-mode-hook c-mode-common-hook c-mode-hook)
apply(run-hooks (change-major-mode-after-body-hook prog-mode-hook c-mode-common-hook c-mode-hook))
run-mode-hooks(c-mode-hook)
c-mode()
set-auto-mode-0(c-mode nil)
set-auto-mode()
normal-mode(t)
after-find-file(nil t)
find-file-noselect-1(#<buffer main.c> "~/Development/C/fibonacci/src/main.c" nil nil "~/Development/C/fibonacci/src/main.c" (6817014 2054))
find-file-noselect("~/Development/C/fibonacci/src/main.c" nil nil t)
find-file("~/Development/C/fibonacci/src/main.c" t)
funcall-interactively(find-file "~/Development/C/fibonacci/src/main.c" t)
call-interactively(find-file nil nil)
command-execute(find-file)
请注意:我是 Emacs 新手,对 Elisp 不是特别精通