loading icicle-mode in emacs on startup by default - emacs

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.

Related

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.

Emacs freezes on adding remote tramp path to ecb-source-path

I'm trying to add a remote directory to my ecb directory pane by modifying the ecb-source-path variable in my .emacs file under Emacs 24.2, ecb 2.40, OS X 10.8.2. The following works via tramp from within emacs:
/username#server.com:/home/username
/username#server:/home/username (have set up an alias server->server.com)
/server.com:/home/username (username is same as local user, so can be omitted)
/server:/home/username
I'm not sure whether I have the syntax wrong, but I've tried the following to add the path to ecb:
(setq ecb-source-path (quote("/username#server.com:/home/username"))) (**)
(setq ecb-source-path (quote("/server.com:/home/username")))
(setq ecb-source-path (quote("/scpc:username#server.com:/home/username")))
Which cause emacs to hang when issuing ecb-activate, with no error messages displayed in the message buffer
(setq ecb-source-path (quote("/username#server:/home/username")))
(setq ecb-source-path (quote("/server:/home/username")))
(setq ecb-source-path (quote("username#server.com:/home/username")))
Which result in message: Warning: Source-path <ENTERED PATH> is not accessible - ignored!
Has anyone done this and know the correct syntax for adding remote paths to ecb-source-path? According to the documentation, (**) should work. If the syntax is indeed correct, are there any tips for debugging what might be going on and causing emacs to freeze? Or is this an issue with ecb itself?

How to fix my 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.

emacs won't close because of buffer "ido.last"

When I try to close emacs I get the message
"buffer ido.last modified; kill anyway?"
and whatever I answer, emacs stays open. But I can't open this buffer and the ido.last file doesn't exist. How can I get my emacs closed?
If you've used emacs as another user, as root for instance, it's possible that the .ido.last file is owned by root and hence you aren't allowed to remove or save it.
When you get the "buffer .ido.last modified"-question just remove the .ido.last file before you answer yes (if you're using emacs within a shell, just C-z, remove file and then resume with %). Then the .ido.last file will be written to disk with you as the owner.
IDO tries to save a file called ido.last into ~/.emacs.d directory. But, in your case IDO seems to be unable to do so. Maybe your ~/.emacs.d directory is read-only for a particular reason, or your disk is full, etc. So IDO raise an error that prevent your emacs to close.
If you don't use IDO, try to remove this kind of lines from your .emacs :
(require 'ido)
(ido-mode t)
Add this code (eg. to your .emacs.el, init.el, etc.) to
fix the issue with ido preventing emacs from exiting
when the ido.last file is not writable:
(defun ido-kill-emacs-hook ()
(ignore-errors (ido-save-history)))
Like Jérôme Radix said, IDO gives that error when unable to save the ido.last file, and the error prevents emacs from closing.
The default location for IDO to save the file is into ~/.emacs.d directory, but this can be overridden by setting the variable ido-save-directory-list-file. This means you should check the value of this variable (e.g., M-x describe-variable) to see where IDO is trying to save a file, and figure out why it can't save the file.
Possible reasons include:
The directory or file is read-only.
The directory does not exist. IDO will not create the directory for you.
The directory or file is owned by another user.
The disk is full.