Error when loading emacs with emacs-live - emacs

When I start emacs I get the error
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
string-match("cmd\\.exe" nil)
(if (string-match "cmd\\.exe" tramp-encoding-shell) "/c" "-c")
eval((if (string-match "cmd\\.exe" tramp-encoding-shell) "/c" "-c"))
this appears to occur when loading the magit pack
eval-buffer(#<buffer *load*-330059> nil "c:/cygwin64/home/johnstonk/.emacs.d/emacs-live/packs/stable/git-pack/lib/magit/magit.el" nil t) ; Reading at buffer position 3100
I confirmed this occurs with a fresh git clone of emacs-live.
I tried removing the magit pack from loading in the live init file but I got the same error again when it loaded the clojure pack. Looks like a nil string error in tramp.
Does anyone know why?

Going through and loading the source code for tramp-sh.el I got the same (wrong-type-argument stringp nil) on the first line (require 'tramp)
So I loaded tramp.el (version 22.1) and got to the section
(defcustom tramp-encoding-shell
(if (memq system-type '(windows-nt))
(getenv "COMSPEC")...
I noticed that this system-type is getting set to windows-nt (As it should, I'm on windows7) but (getenv "COMSPEC") is returning nil. From what I googled elsewhere this COMSPEC environment variable is expected to exist on windows machines and point to the shell. Tramp uses the tramp-encoding-shell var for encoding and decoding commands on the local machine such as "~" -- at least according to tramps comments.
COMSPEC didn't exist as an system environment variable for me so I created it and pointed it to cmd.exe C:\Windows\System32\cmd.exe That fixed it for me.
Note don't set COMSPEC to powershell, I tried that first but got a nasty memory leak when I tried to use lein (keeps trying to create a server, fails, and tries again but doesn't clean up previous thread).

Related

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?

Cannot Open fi-site-init.el

Lately i've been trying to install ELI on my Linux computer!
I've followed the guide from http://www.franz.com/emacs/ to make it work! I've also searched for similar errors and found this thread http://ubuntuforums.org/showthread.php?t=1646855
However unlike the person in the forum I cannot load the fi-site-init.el file from the scratch buffer.
By opening emacs with the --debug-init flag i get the following error messege
Debugger entered--Lisp error: (file-error "Cannot open load file" "fi-site-init.el")
load("fi-site-init.el")
eval-buffer(#<buffer *load*> nil "/home/simon/.emacs" nil t) ; Reading at buffer position 82
load-with-code-conversion("/home/simon/.emacs" "/home/simon/.emacs" t t)
load("~/.emacs" t t)
#[nil "\205\264
What can be worth noticing is that in the guide they have
"/usr/local/acl82express/eli"
as the search path while i'm having
"/usr/Documents/acl82express/eli"
as path (since Allegro CL is installed there)
All in all this is what I've writed in the .emacs file
(push "/usr/Documents/acl82express/eli" load-path)
(load "fi-site-init.el")
(setq fi:common-lisp-image-name "/usr/Documents/acl82express/alisp")
(setq fi:common-lisp-image-file "/usr/Documents/acl82express/alisp.dxl")
(setq fi:common-lisp-directory "/usr/Documents/acl82express")
I am thankful for any help!
Simon Nyström
Documents is typically the name of the directory in the user home directory. It is customary to find it under /home/{user}/Documents where {user} is the currently logged in user. who am i | awk '{ print $1 }' - this is the way to find out, unless you forget :)
This directory is often times aliased with ~ (tilde) or $HOME environmental variable, so that when doing path expansion happens these "$HOME/Documents", "~/Documents" and "/home/{user}/Documents" will all point to the same directory.
Notice the leading "/"-symbol. I'm quite sure it'd have to be "/usr/Documents/acl82express/eli" for you.

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”)

PATH and exec-path set, but emacs does not find executable

My .emacs contains
(setenv "PATH" (concat ".:/usr/texbin:/opt/local/bin" (getenv "PATH")))
(setq exec-path (append exec-path '(".:/usr/texbin:/opt/local/bin")))
(add-to-list 'load-path "/usr/local/share/emacs/site-lisp")
(require 'tex-site)
(load "auctex.el" nil t t)
(load "preview-latex.el" nil t t)
/usr/texbin is where latex/pdflatex/.. are located.
/opt/local/bin/ is where gs can be found.
And yet when I run preview-at-point, which apparently needs both latex and gs, I get
Preview-DviPS finished at Thu Dec 22 11:25:46
DviPS sentinel: Searching for program: No such file or directory, gs
which means that latex could be found all right, but not gs.
I am not sure whether setting exec-path is necessary, perhaps PATH is enough, but I've set it as a debugging measure.
Why can emacs not find gs even though the directory it's in is in both PATH and exec-path?
If you're setting $PATH inside your Emacs, you might well be on OS X. GUI applications are not started via your shell, so they see different environment variables.
Here's a trick which I use to ensure the $PATH inside Emacs is the same one I see if I fire up a terminal (but see "update" below):
(defun set-exec-path-from-shell-PATH ()
"Set up Emacs' `exec-path' and PATH environment variable to match that used by the user's shell.
This is particularly useful under Mac OSX, where GUI apps are not started from a shell."
(interactive)
(let ((path-from-shell (replace-regexp-in-string "[ \t\n]*$" "" (shell-command-to-string "$SHELL --login -i -c 'echo $PATH'"))))
(setenv "PATH" path-from-shell)
(setq exec-path (split-string path-from-shell path-separator))))
Then simply call the set-exec-path-from-shell-PATH function, perhaps from your Emacs init file. I keep that code on github, BTW.
Update: this code has now been improved and published as an elisp library called exec-path-from-shell; installable packages are available in MELPA.
Try replacing the second line with this:
(setq exec-path (append exec-path '("/usr/texbin" "/opt/local/bin")))
I hit a similar problem, but with a correct PATH, including trailing ´:´. It turned out the internal emacs shell program was missing, resulting in a ´Searching for program: No such file or directory´ message.
Fixed with
(setq shell-file-name "bash").
It appears you're missing a path separator : at the end of your path string.