Emacs Lisp 初始化错误(文件错误 "Cannot open load file" “/home/user/a-m”)

Emacs Lisp error at init (file-error "Cannot open load file" "/home/user/a-m")

我最近对我的 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 "52

command-line()

normal-top-level()

我在网上搜索了a-m文件代表什么,以及如何更正这些错误但没有成功。感谢您的帮助!

最佳 安德烈

编辑:这是初始化文件。我刚刚更改了一些关于 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)

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

Please have a look at the accompanying default.el’ customisation example. It can be used as a configuration file (after moving it e. g. to/usr/share/emacs/site-lisp’ or c:\EMACS_INSTALLDIR\site-lisp’, hint: The directory site-lisp/ in the Emacs installation tree is in its default load-path). Yetdefault.el’ is loaded AFTER your personal Emacs configuration file (if there is any) ~/.emacs’ (or~/.emacs.d/init.el’)! If you intend to change the following settings with Emacs’ customisation system or changing them directly in your personal configuration file, you must either set the variable inhibit-default-init’ tot’ “(setq inhibit-default-init t)” in your personal configuration file or remove `default.el’ otherwise your settings might be overwritten!

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

再次感谢!

请注意,在 Git 2.18(2018 年第 2 季度)中,contrib/emacs/ 中的脚本已不再有用,并已被替换为存根,该存根会出错并告诉用户有替换。

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

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

git{,-blame}.el: remove old bitrotting Emacs code

The git-blame.el mode has been superseded by Emacs's own vc-annotate
(invoked by C-x v g).
Users of the git.el mode are now much better off using either Magit or the Git backend for Emacs's own VC mode.

These modes were added over 10 years ago when Emacs's own Git support was much less mature, and there weren't other mature modes in the wild or shipped with Emacs itself.

These days these modes have few if any users, and users of git aren't well served by us shipping these (some OS's install them alongside git by default, which is confusing and leads users astray).

[...] rather than receive a cryptic load error when they upgrade, existing users will get an error directing them to the README file, or to just stop requiring these modes

有关更多信息,请参阅“git/contrib/emacs/README”。