问题
I've recently made a few changes in my init emacs file, and I've noticed with --debug-init that some load files seem to be missing. Here is the output from the debugger
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()
I've searched for what the a-m file stands for online, and how to correct these errors but without success. Thanks for any help!
Best Andre
Edit: Here is the init file. I've just changed some info on jabber (email) but other than that the file is unchanged
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 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)
回答1:
Thanks for your help. I didn't read the new ansys-mode https://github.com/dieter-wilhelm/ansys-mode documentation properly. Here is the issue:
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’ orc:\EMACS_INSTALLDIR\site-lisp’, hint: The directory site-lisp/ in the Emacs installation tree is in its default load-path). Yet
default.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 variableinhibit-default-init’ to
t’ “(setq inhibit-default-init t)” in your personal configuration file or remove `default.el’ otherwise your settings might be overwritten!
So I just added (setq inhibit-default-init t)
to the init file.
Thanks again!
回答2:
Note that with Git 2.18 (Q2 2018), the scripts in contrib/emacs/
have outlived their usefulness and have been replaced with a stub that errors out and tells the user there are replacements.
So the init
error message might not apply anymore in 2018.
See commit 6d5ed48 (11 Apr 2018) by Ævar Arnfjörð Bjarmason (avar).
(Merged by Junio C Hamano -- gitster -- in commit 7d7d051, 08 May 2018)
git{,-blame}.el
: remove old bitrotting Emacs codeThe
git-blame.el
mode has been superseded by Emacs's own vc-annotate
(invoked by C-x v g).
Users of thegit.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
See "git/contrib/emacs/README" for more.
来源:https://stackoverflow.com/questions/37920437/emacs-lisp-error-at-init-file-error-cannot-open-load-file-home-user-a-m