初始化时出现Emacs Lisp错误(文件错误“无法打开加载文件”“/ home / user / a-m”)

时间:2016-06-20 10:41:15

标签: emacs init

我最近在我的init emacs文件中做了一些更改,我注意到--debug-init有些加载文件似乎丢失了。这是调试器的输出

Debugger entered--Lisp error: (file-error "Cannot open load file" "/home/andre/a-m")

load("/home/andre/a-m" nil nil t)

load-file("a-m")

eval-buffer(#<buffer  *load*> nil "/usr/local/share/emacs/site-lisp/default.el" nil t)  ; Reading at buffer position 269

load-with-code-conversion("/usr/local/share/emacs/site-lisp/default.el" "/usr/local/share/emacs/site-lisp/default.el" t t)
load("default" t t)

#[0 "\205\262

command-line()

normal-top-level()

我已经搜索了a-m文件代表什么在线,以及如何纠正这些错误但没有成功。谢谢你的帮助!

最佳

安德烈

编辑:这是init文件。我刚刚更改了jabber(电子邮件)的一些信息,但除此之外文件没有改变

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; File name: ` ~/.emacs '
;; ---------------------

;; If you need your own personal ~/.emacs
;; please make a copy of this file
;; an placein your changes and/or extension.

;; Copyright (c) 1997-2002 SuSE Gmbh Nuernberg, Germany.

;; Author: Werner Fink, <feedback@suse.de> 1997,98,99,2002

;; Test of Emacs derivates
;; -----------------------
(load-library "url-handlers")

;; Always use PDFLaTeX
(setq TeX-PDF-mode t)

;; TeXcount setup for AUCTeX
(require 'tex)
(add-to-list 'TeX-command-list
(list "TeXcount" "texcount %s.tex" 'TeX-run-command nil t))
(load "auctex.el" nil t t)`
(add-hook 'LaTeX-mode-hook 'flyspell-mode)

;; MELPA
(when (>= emacs-major-version 24)
  (require 'package)
  (add-to-list
   'package-archives
   '("melpa" . "http://melpa.org/packages/")
   t)
  (package-initialize))

;; YASNIPPETS
(add-to-list 'load-path
              "~/.emacs.d/plugins/yasnippet")
(require 'yasnippet)
(yas-global-mode 1)
(setq yas-snippet-dirs
      '("~/.emacs.d/snippets"               ;; personal snippets
    "~/.emacs.d/plugins/yasnippet/snippets/"    ;; the default collection
        ))
(yas-global-mode 1) ;; or M-x yas-reload-all if you've started YASnippet already.

;; Timestamp controls
(add-hook 'before-save-hook 'time-stamp)
(setq time-stamp-pattern nil)

;; Controls for calendar
(setq european-calendar-style t)
(set-default 'truncate-lines t)

;; Controls for jabber
(require 'jabber)

;;;;;;;;;;;;;;;
;; TRAMP mode
;;;;;;;;;;;;;;;

(setq tramp-default-method "ssh")

;;;;;;;;;;;
;;ORG mode
;;;;;;;;;;;

(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)
(setq org-log-done t)
(setq org-agenda-files (list "~/org/NOTES.org"))
(setq browse-url-browser-function 'browse-url-generic
      browse-url-generic-program "firefox")
(setq org-support-shift-select 't)
(setq org-agenda-include-diary t)
(setq org-src-fontify-natively t)

;;;;;;;;;;;
;;G-CODE
;;;;;;;;;;;

(require 'generic-x)
(define-generic-mode gcode-generic-mode
  '(("(" . ")"))
  (apply 'append 
         (mapcar #'(lambda (s) (list (upcase s) (downcase s) (capitalize s)))
                 '("sub" "endsub" "if" "do" "while" "endwhile" "call" "endif" 
                   "sqrt" "return" "mod" "eq" "ne" "gt" "ge" "lt" "le" "and" 
                   "or" "xor" "atan" "abs" "acos" "asin" "cos" "exp" 
                   "fix" "fup" "round" "ln" "sin" "tan" "repeat" "endrepeat")))
  '(("\\(#<_?[A-Za-z0-9_]+>\\)" (1 font-lock-type-face))
    ("\\([NnGgMmFfSsTtOo]\\)" (1 font-lock-function-name-face))
    ("\\([XxYyZzAaBbCcUuVvWwIiJjKkPpQqRr]\\)" (1 font-lock-string-face))
    ("\\([\-+]?[0-9]*\\.[0-9]+\\)" (1 font-lock-constant-face))
    ("\\(#[0-9]+\\)" (1 font-lock-type-face))
    ("\\([0-9]+\\)" (1 font-lock-constant-face)))
  '("\\.gcode\\'")
  nil
  "Generic mode for g-code files.")

;;;;;;;;;;;
;;OpenSCAD
;;;;;;;;;;;
(add-to-list 'load-path
         "/usr/local/share/emacs/site-lisp/")
(autoload 'scad-mode "scad-mode" "Activate OpenSCAD mode." 'interactive)
(add-to-list 'auto-mode-alist '("\\.scad\\'" . scad-mode))

;;;;;;;;
;;ANSYS
;;;;;;;;
     (add-to-list 'load-path
          "/usr/local/share/emacs/site-lisp/")

     (autoload 'ansys-mode "ansys-mode" "Activate Ansys mode." 'interactive)

    (add-to-list 'auto-mode-alist '("\\.txt\\'" . ansys-mode))
    (add-to-list 'auto-mode-alist '("\\.db\\'" . ansys-mode))
;    (add-to-list 'auto-mode-alist '("\\.dat\\'" . ansys-mode))
;    (add-to-list 'auto-mode-alist '("\\.inp\\'" . ansys-mode))

;;;;;;;;;;;
;;LS-DYNA
;;;;;;;;;;;
     (add-to-list 'load-path
          "/usr/local/share/emacs/site-lisp/")
      (autoload 'lsdyna-mode "lsdyna" "Enter ls-dyna mode." t)
      (setq auto-mode-alist (cons '("\\.k\\'" . lsdyna-mode) auto-mode-alist))

;;;;;;;;;;;
;;ABAQUS
;;;;;;;;;;;
;; ;; setup files ending in “.inp” to open in python-mode
;; (add-to-list 'auto-mode-alist '("\\.inp\\'" . python-mode))
     (add-to-list 'load-path
              "/usr/local/share/emacs/site-lisp/")
      (autoload 'abaqus-mode "abaqus" "Enter abaqus mode." t)
      (setq auto-mode-alist (cons '("\\.inp\\'" . abaqus-mode) auto-mode-alist))

;;;;;;;;;;;;;;;;;;;;;;
;; PDF-LATEX+INKSCAPE
;;;;;;;;;;;;;;;;;;;;;;
(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.
 '(LaTeX-command-style (quote (("" "%(PDF)%(latex) -shell-escape %S%(PDFout)"))))
 '(ansys-current-ansys-version "140")
 '(jabber-account-list (quote (("myemail.com"))))
 '(org-agenda-files (quote ("~/org/NOTES.org")))
 '(send-mail-function (quote smtpmail-send-it))
 '(smtpmail-smtp-server "smtp.googlemail.com")
 '(smtpmail-smtp-service 587))
(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.
 )

;; ;;;;;;;;;;;
;; ;;GNUPLOT
;; ;;;;;;;;;;;

;; (add-to-list 'Info-default-directory-list "/usr/info")

;; ;; load the file
;; (require 'gnuplot)

;; ;; specify the gnuplot executable (if other than /usr/bin/gnuplot)
;; (setq gnuplot-program "/usr/bin/gnuplot")

;; ;; automatically open files ending with .gp or .gnuplot in gnuplot mode
;; (setq auto-mode-alist 
;; (append '(("\\.\\(gp\\|gnuplot\\|p\\)$" . gnuplot-mode)) auto-mode-alist))

; GIT controls
 (add-to-list 'load-path ".../git/contrib/emacs")
  (require 'git)
  (require 'git-blame)
  (require 'vc-git)

;; OCTAVE
(autoload 'run-octave "octave-inf" nil t)

(put 'upcase-region 'disabled nil)

;; PHP
(autoload 'php-mode "php-mode" "Major mode for editing php code." t)
(add-to-list 'auto-mode-alist '("\\.php$" . php-mode))
(add-to-list 'auto-mode-alist '("\\.inc$" . php-mode))

;; Command for automatic alignment of comments
(defun align-comment (beg end)
  (interactive "r")
  (align-regexp beg end (concat "\\(\\s-*\\)" comment-start))
)
(global-set-key "\C-c\C-a" 'align-comment )

;; Flyspell mode binding to F6 key
(global-set-key [f6] 'flyspell-mode)        ; F6

;; Command for automatic auto-fill
(add-hook 'text-mode-hook 'turn-on-auto-fill)

2 个答案:

答案 0 :(得分:1)

感谢您的帮助。我没有正确阅读新的ansys-mode https://github.com/dieter-wilhelm/ansys-mode文档。这是问题所在:

  

请查看随附的default.el’ customisation example. It can be used as a configuration file (after moving it e. g. to / usr / share / emacs / site-lisp'或c:\EMACS_INSTALLDIR\site-lisp’, hint: The directory site-lisp/ in the Emacs installation tree is in its default load-path). Yet default.el'是否在您的个人Emacs配置文件之后加载(如果有的话) ~/.emacs’ (or〜/ .emacs.d / init.el')!如果您打算使用Emacs的自定义系统更改以下设置或直接在个人配置文件中更改它们,则必须在个人中设置变量inhibit-default-init’ to t'“(setq inhibit-default-init t)”配置文件或删除`default.el'否则您的设置可能会被覆盖!

所以我刚刚将(setq inhibit-default-init t)添加到init文件中。

再次感谢!

答案 1 :(得分:0)

请注意,使用Git 2.18(2018年第二季度),contrib/emacs/中的脚本已经过时了,并且已经被错误输出的存根替换,并告诉用户有替换。

因此,init错误消息可能在2018年不再适用。

commit 6d5ed48Ævar Arnfjörð Bjarmason (avar)(2018年4月11日) (由Junio C Hamano -- gitster --合并于commit 7d7d051,2018年5月8日)

  

git{,-blame}.el:删除旧的bitrotting Emacs代码

     

git-blame.el模式已被Emacs's own vc-annotate取代   (由 C - x v g 调用。)   对于Emacs自己的VC模式,使用Magit或Git后端的git.el模式的用户现在要好得多。

     

这些模式是在10年前Emacs自己的Git支持时添加的   不太成熟,野外没有其他成熟的模式   或与Emacs本身一起发货。

     

现在这些模式的用户很少,而git的用户则没有   我们运送这些(一些操作系统将它们与git一起安装)   默认情况下,这会引起混淆并导致用户误入歧途。)

     

[...]而不是在升级时收到神秘的加载错误,   现有用户将收到错误,指示他们访问README文件,或   只是停止要求这些模式

有关详情,请参阅“git/contrib/emacs/README”。