How to fix my emacs? - emacs

I get the following error from emacs:
Warning (initialization): An error occurred while loading `/afs/nada.kth.se/hom\
e/d99/home/.emacs':
File error: Cannot open load file, jde
To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file. Start Emacs with
the `--debug-init' option to view a complete error backtrace.
I didn't use it for some time and the environment might've changed. What should I do? I don't think I have a .emacs file anymore, should I create one and what should it contain?
Update
I do have a .emacs file (I was looking in the wrong dir) and it's
;; - - - - - - - - - -
;;
;; Emacs JDE
;;
(setq load-path
(nconc '(
"/pkg/jde/2.1.4"
)
load-path))
(require 'jde)
;; - - - - - - - - - -
;; - - - - - - - - - -
;;
;; Make possible to compile from inside emacs
;; using control-c -m
;;
(global-set-key "\C-cm" 'compile)
(setq load-path (cons "/src/lang/sictus/sicstus3.5" load-path))
(autoload 'run-prolog "prolog"
"Start a Prolog sub-process." t)
(autoload 'prolog-mode "prolog"
"Major mode for editing prolog programs" t)(autoload 'prolog-menu-hook-function "prolog-menu" t)
(add-hook 'prolog-mode-hook 'prolog-menu-hook-function)
How do I fix it?

From the error message, it seems fairly likely that you do indeed have a ~/.emacs file. Please double-check if this is the case or not. Whether it does or doesn't exist, try
$ emacs --no-init-file
which tells emacs to ignore your .emacs file if any. If this causes an error, you might have something wrong in the emacs installation you're using. If emacs starts without errors, now try the suggestion from the error message you quote above:
$ emacs --debug-init
This will enter the emacs debugger at the point of the error in the init file. Even if you're not comfortable with the debugger, the backtrace might give you a clue as to what the problem is.
Added after the post was extended with the actual .emacs file:
In the particular ~/.emacs file you show in the question, the immediate cause of the failure is the line
(require 'jde)
You can tell this by the line saying Cannot open load file, jde. The most immediate way to eliminate this particular problem is by commenting out or removing the offending require line. As long as you don't actually need whatever it is jde provides, this should fix you up. (You should probably also delete the previous expression that's trying to add something to the load path to let emacs find the jde library.) If you need jde, you want to figure out where it actually lives, and modify load-path appropriately.

Related

emacs init file on MS Windows

There's a huge literature on the topic, but, nevertheless, I cannot get this done.
My ultimate goal is to work with fstar on Microsoft Windows.
C-x C-f resolves ~ as C:/Users/myname which is in line with my HOME environment variable in the Environmental variables Windows section.
(expand-file-name user-emacs-directory), as described here yields, C:/Users/myname/.emacs.d/
In C:/Users/myname/.emacs.d/ I have placed .emacs.el and init.el with the suggested script:
(require 'package) (add-to-list 'package-archives '("melpa" .
"http://melpa.org/packages/") t) (package-initialize)
However M-x returns undefined, no matter if I start Emacs with or without the -q flag (see here). My "Messages" buffer is empty".
A couple of things you could try:
Check the value of the variable user-init-file (use C-h v). That should tell you if Emacs loads the file you want it to load. If you started Emacs with the -q option, the value of this variable should be nil.
The error M-x is undefined can be caused by rebinding the Escape key. (That's because pressing a key while holding down the "Meta" key is equivalent to first pressing Escape and then the key in question.) Is there something in the init file that might cause this to happen?
Try starting Emacs with -Q instead of -q. This makes Emacs skip "site-wide" init files. I can't really think of a reason why your system would have any of those, but it might be worth ruling this out.
You could edit your question and include your entire init file (surround it with ``` on a line by itself), so we could have a look.

Emacs Warning (initialization) -- File error

Whenever I open emacs on a linux server I'm using I get the following message which takes up half my screen:
Warning (initialization): An error occurred while loading `/home/[my username]/.emacs':
File error: Cannot open load file, sm
To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file. Start Emacs with
the `--debug-init' option to view a complete error backtrace.
What's happening here? I don't have any issues editing, except for this warning message in the way. How can I address this?
EDIT:
My ~/.emacs file contains the following:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; Supermongo (SM) mode stuff
;;
(require 'sm)
(setq auto-mode-alist
(append
'( ("\\.sm\\'" . sm-mode) )
auto-mode-alist)
)
Your load-path variable is probably set missing something. You need to add a path so that the sm.el (or sm.elc) file can be found by emacs. Something like this at the beginning of your .emacs file:
(add-to-list 'load-path "/path/to/directory/containing/sm.el")

Opening HTML file with nXhtml produces error with flymake

When I open an HTML file with emacs (and nXhtml,) I get the following error from flymake:
Error (flymake): Flymake: Failed to launch syntax check process 'xml'
with args (val
/home/ABC/Downloads/capitals_flymake.html):
Searching for program: no such file or directory, xml. Flymake will be
switched OFF
I assume this means that I need to have a program installed that can be run at the command line with xml. However, I have not been able to find out what this program is in the documentation.
I am also currently using the following gist (with a modification suggested by one of the commenters to change equal to >=) to disable the Mumamo buffer filenames warning in my .emacs:
;; Workaround the annoying warnings:
;; Warning (mumamo-per-buffer-local-vars):
;; Already 'permanent-local t: buffer-file-name
(when
(and
(>= emacs-major-version 24)
(>= emacs-minor-version 2))
(eval-after-load "mumamo"
'(setq mumamo-per-buffer-local-vars
(delq 'buffer-file-name mumamo-per-buffer-local-vars))))
But, I am not sure if that is relevant.
How can I get flymake to work with nXhtml? I am currently on GNU Emacs 24.3.1.
I have this in my .emacs for live validating of XML and HTML, see if this would help.
(defun flymake-xml-init ()
(list "xmllint"
(list "--valid"
(flymake-init-create-temp-buffer-copy
'flymake-create-temp-inplace))))
(defun flymake-html-init ()
(let* ((temp-file (flymake-init-create-temp-buffer-copy
'flymake-create-temp-inplace))
(local-file (file-relative-name
temp-file
(file-name-directory buffer-file-name))))
(list "tidy" (list local-file))))
(add-to-list 'flymake-allowed-file-name-masks
'("\\.html$" flymake-html-init))
Also, re xml executable: it might be this one http://packages.ubuntu.com/quantal/amd64/xml2/filelist from how it looks... also you can try apt-file /usr/bin/xml (I'm not sure if apt-file is installed by default, if not, then apt-get install apt-file). Also, maybe this would help: http://www.emacswiki.org/emacs/FlyMake . I couldn't find any setting particular to nXhtml that does something to flymake.
The default program that flymake is told to use (xml) isn't installed on your computer, or its location isn't in your path. You need to tell flymake to use a different syntax checker just like #wvxvw said (see their answer for the code).
However, when you change the syntax checker, you may also need to tell flymake how that new checker will output error messages or else flymake won't know how to read the checker's output.
If your new checker program has an exit code other than 0 (which normally indicates an error) AND flymake didn't see anything that it recognized as error text, then flymake will throw a CFGERR and turn off.
From the flymake manual:
The following errors cause a warning message and switch flymake mode OFF for the buffer.
CFGERR : Syntax check process returned nonzero exit code, but no errors/warnings were reported. This indicates a possible configuration error (for example, no suitable error message patterns for the syntax check tool)
So what you need to do is tell flymake how to interpret the errors from your updated parser. You do this by adding a regex expression to a list that flymake will check against the output of your parser. Add something like this to your .emacs file:
(add-to-list
`flymake-err-line-patterns
'("at line \\([0-9]+\\) of \"\\([^ \n]+\\)\"$" 2 1 nil))
This will then tell flymake that if your parser generates output that matches the regex ("at line \\([0-9]+\\) of \"\\([^ \n]+\\)\"$") to identify it as an error message. The 2 1 nil tell flymake which group in the regex represents the file, line number, and column number, respectively. If the error message doesn't provide that information, then set that parameter to nil. In this example, the error message only identifies the file (second group) and line number (first group), so the column is set to nil.

loading icicle-mode in emacs on startup by default

I would like to configure emacs so that the Icy mode is active by default. As suggested in "icicles-doc1.el", I added the following code at the end of my .emacs file:
(require 'icicles)
(icicle-mode 1)
When I run emacs, I get a *Warning* buffer:
Warning (initialization): An error occurred while loading `c:/Users/USER/AppData/Roaming/.emacs':
File error: Cannot open load file, icicles
To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file. Start Emacs with
the `--debug-init' option to view a complete error backtrace.
When I do the debug option, a *Backtrace* buffer says something like:
Debugger entered--Lisp error: (file-error "Cannot open load file" "icicles")
require(icicles)
eval-buffer(# nil "c:/Users/USER/AppData/Roaming/.emacs" nil t) ;
Reading at buffer position 5062
load-with-code-conversion("c:/Users/USER/AppData/Roaming/.emacs"
"c:/Users/USER/AppData/Roaming/.emacs" t t)
load("~/.emacs" t t)
#[0 "\205\262
With or without those two lines in my .emacs that are causing the problem, icicle-mode seems to work fine when I do a M-x icicle-mode.
(file-error "Cannot open load file" "icicles") means that Emacs didn't know where to find library icicles.el[c]. You need to put the location of the Icicles files in variable load-path.
E.g, if your Icicles files are in directory /my/icicles/ then you need to do this (e.g., in your init file, ~/.emacs):
(add-to-list 'load-path "/my/icicles/")
Do that before you do (require 'icicles). That way, Emacs will know where to load Icicles from.
Given that the (require 'icicles) code is failing, but the M-x icy-mode is working, then it seems that someone has already set up your Emacs installation to include icicles via an autoload command, but didn't update the load-path to include the directory where icicles.el resides.
Replace those two lines with:
(icy-mode 1)
(which is the equivalent of M-x icy-mode when icicles has yet to be enabled)
If you want to use a different version of icicles, then you need to add the proper directory to the load path.

eval-buffer doesn't do anything when setting up CLISP/SLIME

I am using the following tutorial:
http://www.pchristensen.com/blog/articles/installing-clisp-emacs-and-slime-on-windows-xp/
I have set-up all the directories and downloaded all the necessary files. However, on step 4. I am using the emacs command "eval-buffer". I type in my settings, ran "eval-buffer", received feedback (in the bottom bar), and assumed everything worked correctly. Then when I ran M-x "slime" I received the error:
Spawning child process: invalid argument
I assumed I had typed something incorrectly in my .emacs file so I re-edited it. However, now when I attempt to run M-x "eval-buffer" I receive no feedback and I don't believe my new code executes.
My file, by the way, is:
(setq inferior-lisp-program "C:/Documents and Settings/U9UW/Desktop/root/bin/clisp/full/lisp.exe -B C:/Documents and Settings/U9UW/Desktop/root/bin/clisp/full -M
C:/Documents and Settings/U9UW/Desktop/root/bin/clisp/full/lispinit.mem -ansi -q")
(add-to-list 'load-path "C:/Documents and Settings/U9UW/Desktop/root/bin/emacs/site-lisp/slime/")
(require 'slime)
(slime-setup)
eval-buffer actually was evaluating. To fix the problem "Spawning child process: invalid argument", one has to replace the first line with:
(setq inferior-lisp-program “clisp”)