Racket and Geiser on Windows, strange path error - emacs

When I try (run-racket) or (run-geiser) on my Windows 8.1 machine running GNU Emacs 24.3 and Racket v6.1 I get the following output:
Welcome to Racket v6.1.
default-load-handler: cannot open input file
path: f:/c/Users/James/AppData/Roaming/.emacs.d/el-get/geiser/scheme/racket/geiser/startup.rkt
system error: The system cannot find the path specified.; errno=3
>
Which is decidedly odd, but after browsing the backtrace I still don't have a good idea what's going on.
Indeed, since Racket starts up fine it seems to be some strangeness in the way paths are passed from Geiser to Racket. The only other time I see this kind of path strangeness is when MinGW bash is involved, and that /c/ makes me think that it probably is. In fact, that path would be perfectly valid if not for the leading f:.
I'm at a bit of a loss as to how to approach this problem, as I don't know how Geiser communicates with Racket (I just started trying to use it today), but I would really like to get it to work, as I'm quite invested in Emacs as my editor.
So my question is thus: What possible problem points should I investigate, given the above as clues?

After some digging through the Geiser source I found in geiser/elisp/geiser-load.el the line:
(setq geiser-scheme-dir "/c/Users/James/AppData/Roaming/.emacs.d/el-get/geiser/scheme")
Which was probably generated incorrectly by MinGW make.
I changed it to:
(setq geiser-scheme-dir "c:/Users/James/AppData/Roaming/.emacs.d/el-get/geiser/scheme")
After which everything works perfectly.
The problem was that Emacs' expand-file-name assumed that the /c/... path was a relative path due to the initial forward slash, and guessed that it should prepend the letter of the current drive to make it a proper Windows Emacs path.

Related

My plantuml-mode in emacs is not working correctly

I have tried to install and use plantuml-mode in emacs, with no success.
My emacs version: 25.2.2
Operating system: Ubuntu 18.04 x86_64
I have followed the official instructions on
https://github.com/skuro/plantuml-mode
When I load a file it says
"Contacting host: www.plantuml.com:443".
After a few seconds I get the error message
"plantuml-init: Wrong type argument: stringp, nil"
I've looked at
Can't turn on plantuml-mode in Emacs
It didn't help. In a previous attempt I found some other similar help pages, on github and stackoverflow, but I can't find them right now. One was to fix a broken url, and the other was to provide the correct path to the jar file. I fixed both, but none of them fixed my problem.
The above mentioned problem reports are related to the mode's attempts to contact a web server, or to run plantuml. I am not interested in any of them, I prefer to run plantuml myself from the command line. All I want from the mode is syntax highlighing and indentation. It is possible to turn off the other features, to get rid of the errors? Or is there another, simpler mode out there, that doesn't try to contact the web or run executables?
Best regards
The plantuml-mode sends your data to be evaluated at www.plantuml.com by default.
To run it locally, you need to set both the plantuml jar path and the execution mode as described in https://github.com/skuro/plantuml-mode#quick-guide:
(setq plantuml-jar-path "/path/to/your/copy/of/plantuml.jar")
(setq plantuml-default-exec-mode 'jar)

Spawning child processes returns invalid argument

I have a class this semester that requires a lisp dialect so I'm trying to get started with Clojure but I'm running into a lot of problems setting up my environment.
I'm on a Windows machine and am following the tutorial at http://www.braveclojure.com/basic-emacs/ to set up emacs which from my research seems like the best IDE for working with lisp. I had Cygwin installed before starting which supposedly has a lot of support for emacs but I'm not sure if I need to do more than just have it installed.
My problems is when I try to start a REPL in emacs with M-x cider-jack-in I get the response Spawning child process: invalid argument. If I do the M-x load-path command I get a list of every subfolder in my .emacs.d folder but not the .d folder itself but the folder where my cider package is installed is clearly listed.
I installed lein before I decided to try setting up emacs and I could open a REPL just fine with it but emacs seems like a much better way of working than just using the terminal.
Any advice is greatly appreciated but if there is a better/easier way to get started with Clojure on Windows than what I'm currently doing I'd love to hear about it.
Thanks in advance for any replies.
Yes, emacs is great, but if you haven't worked with it before then you will have a very steep learning curve, exacerbated by the fact you are running Windows. I myself use emacs with CIDER a lot, and I also use emacs on Windows quite a bit, but I don't mix it - I use emacs/CIDER only on Linux. It doesn't mean at all that it can't be made to work on Windows, it's just it has a lot of complexity of its own, which you might not have time or inclination to deal with right now. (By the way, I wouldn't recommend using emacs under Cygwin [1] , use a good native build instead. And if you still decide to go with emacs, by all means try Prelude - it comes from the author of CIDER by the way.)
If you want an option that is definitely smoother under the circumstances, download IntelliJ IDEA Community Edition and install Cursive. That will have its own learning curve for sure, but give it a try and see what you prefer. I use both, nothing beats IntelliJ/Cursive in Java interop projects.
Both emacs/CIDER and IntelliJ/Cursive are terrific and will repay for deeper learning.
[1] I am not even sure a combination of emacs on Cygwin and lein/clojure on Win32 can work, but I have no environment to test.
unset the SHELL env variable - taken from: http://tb-nguyen.blogspot.com/2010/05/how-to-fix-emacs-windows-error-spawning.html
It worked for me

Change default save folder in LispBox

So I've finally decided to learn Lisp. I'm reading Practical Common Lisp and I'm using Lispbox (not the one the book recommends - it's no longer available, but it seems this is suitable nonetheless).
So far in my career I have managed to avoid wresting with emacs, but I guess that part of my life is over :-) Actually, I'm kind of excited - this is a brand new world.
When saving .lisp files, the out-of-the-box setup dumps these files into the lispbox-0.7 folder (which is also the LISPBOX_HOME env.var). My math teacher taught me, "If you don't know what you're doing, at least do it neatly." So I want to at least keep my work in a nice tidy folder. I can specify the full path on saving/loading. But can I tell (lispbox|emacs|whatever) to use a different folder by default?
If it matters: I will likely use the Windows version more often, but I also have a setup on Ubuntu.
I have looked at this and this and this. I tried adding these to the .emacs file (one at a time):
(setq default-directory "C:/Work/lisp/")
(cd "C:/Work/lisp/")
To open the .emacs file I used C-x C-f~/.emacs
If I try changing the LispBox shortcut's "Start in" property, it fails to load at all.
M-xcd c:/work/lisp does work, but I have to do it every time I launch LispBox
What I'm doing in the meantime: I've created a separate lisp folder beside the lispbox-0.7 folder. That way I can prepend ../lisp/ before any filename. This isn't so bad, especially with the tab auto-complete.
Found it!
The reason modifying .emacs wasn't working is because of the lispbox.bat file. It has this line:
%EMACS% --no-init-file --no-site-file --eval=%TO_EVAL%
So took out the two "no" parameters, leaving this...
%EMACS% --eval=%TO_EVAL%
...and it worked.
This worried me, though. Why would the default not want to load the .emacs file? I guess once I understand all of this better I'll have an answer. Until then, I restored the above, the changed this line...
set TO_EVAL="(progn (load \"lispbox\") (slime))"
...to this...
set TO_EVAL="(progn (load \"lispbox\") (slime) (cd \"C:/work/lisp/\"))"
Now I'm happy.
I know nothing about Lisp Box, and not all of what you describe is clear to me. But here goes.
It sounds like you are looking for a way to make c:/work/lisp the default directory when you start Emacs. For that, using an MS Windows shortcut, putting that folder in the Start in field does indeed accomplish that. But you speak of a LispBox shortcut's Start in. If by that you just mean an Emacs shortcut, then it should work.
But of course you need to use Windows syntax for the folder - not c:/work/lisp, but c:\work\lisp.
Is that what the problem was?
The Windows shortcut is a Windows thing. Emacs is different: it accepts / as a folder separator.
Tip: If that solves your problem, you might also want to start Emacs in Dired mode on that same folder, that is, if that folder is the one you will use a lot. To do that, add that folder at the end of the command line - again, using Windows syntax, but between double-quotes:
c:\your\path\to\runemacs.exe "c:\work\lisp"
Try starting lispbox.bat from the directory you want to save files to. For example, from the OS command prompt:
cd c:\work\lisp
path-to-bat-file\lispbox.bat
You can also cd to c:\work\lisp in listbox.bat before it executes Emacs. For Linux it looks like this in lispbox.sh:
#!/bin/bash
if [ "${0:0:2}" = "./" ]; then
export LISPBOX_HOME=`pwd`/../../..
else
export LISPBOX_HOME=`dirname $0`/../../..
fi
cd ~/work/lisp
export SBCL_HOME=${LISPBOX_HOME}/sbcl-1.0.42/lib/sbcl
exec ${LISPBOX_HOME}/Emacs.app/Contents/MacOS/Emacs --no-init-file --no-site-file --eval='(progn (load "lispbox") (slime))'

Emacs, anything and the Everything search tool under Windows 7

I am struggling to get Everything working with anything in Emacs 24.3.1 on Windows 7. Ultimately I want to use anything-locate to browse code directories and subdirectories, as recommended in answers to this question. I did once, briefly, seem to have anything-locate working but I changed something and cannot get it back.
When I enter M-x anything-locate (or, using helm, M-x helm-locate) I get a pattern: prompt but when I enter a search term I get an error message like this:
Locate
'es' is not recognized as an internal or external command,
operable program or batch file.
I assume but do not know for sure that this is related to es.exe which is the command line version of Everything. In my init file I have this:
(add-to-list 'load-path "~/.emacs.d/.emacs.d/elpa/everything")
(setq everything-ffap-integration nil)
(setq everything-cmd "~/.emacs.d/.emacs.d/elpa/everything/es.exe")
(require 'everything)
...and I have edited everything.el so that the
(defcustom everything-cmd "c:/Programme/Everything/es.exe" "Path to es.exe."
line now reads:
(defcustom everything-cmd "~/.emacs.d/.emacs.d/elpa/everything/es.exe" "Path to es.exe."
(EDIT Please note that despite the "~/" convention used above, in reality the paths are fully qualified with c:/blah/blah/blah/.emacs.d/)
I expected this to allow Emacs to find es.exe. And yet it still throws the error message. Any thoughts on how to fix this?
I know this is old, but I found this question when I ran into the same problem with helm, so it might be useful.
The problem was a conflict between how emacs specifies PATH, and how windows does it (similar to juanleon's suggestion).
The solution was to remove all forms that modified the path in emacs, and instead just add es.exe to the windows path.
es.exe is an extra download at the bottom of the voidtools download page, below the old versions, took me a while to find.
It is possible that windows shell (whatever it is) does not know how to expand "~/" (even if emacs does understand it).
A very quick test would be to copy the es.exe in "c:\es.exe" and then repeat the test with the proper change in the configuration of everything-cmd; if it works then just use the whole path.

Swank server startup failure

Emacs SLIME can't connect to swank, because apparently swank cannot initialize correctly.
It says some back end function not implemented. However, my swamp backend is SBCL, which is supported. I am using windows xp os.
A similar issue was found posted at the following link, but no solution.Link to similar issue
Am I missing any configuration file for Swank? Or perhaps emacs and SBCL versions I am using have compatibility issues? In that case, where can I get the correct compatibility matrix for windows?
I'm mostly using Linux, but it's very easy to run into conflicts if you have multiple versions of slime/swank code installed.
The best method is to use quicklisp and make sbcl/emacs not use any other code (at least in your first attempt):
sbcl --no-userinit --no-sysinit --load ~/quicklisp/setup.lisp
(asdf:initialize-source-registry '(:source-registry :ignore-inherited-configuration))
(ql:quickload "quicklisp-slime-helper")
(swank:create-server :port 4545 :dont-close t :coding-system "utf-8-unix")
Then start emacs as:
emacs -q -name SLIME -eval '(progn (load (expand-file-name "~/quicklisp/slime-helper.el")) (slime-connect "localhost" 4545))'
http://www.pchristensen.com/blog/articles/installing-sbcl-emacs-and-slime-on-windows-xp
Use this or any other manual, which describes how to install Emacs, sbcl and slime separately. But using the latest releases. Then it will be easier to find the problem than it is now.
This is not exactly an answer to the problem, more of an alternative.
I think some interfaces/ method definitions that Swank expects, need to be implemented by SBCL. I shifted the lisp implementation to CLisp from SBCL, and after some setup tweaking, got it to work. So, I think Swank is fine but SBCL is not.
Just for information, CLisp cannot work with short windows path, the ones that look like "Progra~1", while SBCL expects short paths. CLisp also gave some problem with the temp folder in Windows, for which a variable had to be added to the .emacs file, but after that was setup quickly.
There seem to be lots of differences between the various Lisp implementations' ports to Windows, which would not be a problem had better documentation been present. All this had to be gleaned from different blogs and mailing list.
As soon as a better answer to the original problem comes along, I'll accept that.