Tuareg-mode can't find ocaml? - emacs

I have tuareg-mode working on emacs. I downloaded ocaml 4.01.0 on my Mac OS and installed it.
Maxs-MacBook-Pro:~ Max$ ocaml
OCaml version 4.01.0
Maxs-MacBook-Pro:~ Max$ which ocamlrun
/usr/local/bin/ocamlrun
When in tuareg-mode, C-x C-b ocaml returns "Searching for program: No such file or directory, ocaml"
What do I need to do to get ocaml to work with tuareg-mode?
Thanks.

Although /usr/local/bin may be in $PATH for your shell, Emacs may not have the correct value set for $PATH
Try adding this to your .emacs file, and then evaluating it .
(setq exec-path (append exec-path (list "/usr/local/bin")))

Related

Emacs Dired not working - Searching for program: no such file or directory, ls

When I open emacs, and type C-x C-f RET, the minibuffer says
Searching for program: no such file or directory, ls
This also happens when I press return after having typed any directory name. Dired doesn't work when i use C-x d either. Finding files works fine.
I'm using mac os x 10.11 and GNU Emacs 24.5.1. Is there something that could have been put in .emacs to cause this? Also, it seemed to be working fine until I restarted my computer.
You can use which ls in bash to find where ls is located, say it is in /bin/ls whose parent directory is /bin. Then you need to add the parent directory /bin to both PATH and exec-path with following code.
(setenv "PATH" (concat (getenv "PATH") ":/bin"))
(setq exec-path (append exec-path '("/bin")))
Note that the parent directory /bin should be both in PATH and exec-path, to check if this config is setup:
M-x get-env PATH RET
M-x describe-variable exec-path RET
Sometime /bin may not appended to exec-path correctly, you can use Emacs's own customizations workflow

How to configure erlang mode in emacs?

OK, I create a .emacs file in the path where I install erlang.
(setq load-path (cons "/usr/lib64/erlang/lib/tools-2.7.1/emacs"
load-path))
(setq erlang-root-dir "/usr/lib64/erlang")
(setq exec-path (cons "/usr/lib64/erlang/bin" exec-path))
(require 'erlang-start)
/usr/lib64 is the folder where I installed erlang. But it doesn't work. On the other hand I use this command:
yum install emacs-erlang.
Then /usr/share/emacs/site-emacs/sit-start.d will have a file named erlang-init.el. And the content in this file is:
(setq load-path (cons "/usr/share/emacs/site-lisp/erlang" load-path))
(setq erlang-root-dir "/usr/lib/erlang")
(setq exec-path (cons "/usr/lib/erlang/bin" exec-path))
(require 'erlang-start)
By this way, emacs can work in erlang-mode.
I feel it is strange, because I feel the erlang-init.el is wrong but the .emacs is right.
But why in fact .emacs can't work rightly?
My OS is fedora 21 and emacs version is 24.4
OK, I create a .emacs file in the path where I install erlang.
That's not going to do anything unless that path happens to be your $HOME directory.
Emacs loads ~/.emacs -- not any file by that name in any arbitrary directory you happen to put it in. (How would Emacs know it was there?!)
The package-managed file is no doubt being loaded because your system's emacs package has configured a site-start.el file which loads libraries in /usr/share/emacs/site-emacs/sit-start.d/
See: C-hig (emacs) Init File RET

How to install the slime into emacs under Windows7

How to install the slime into emacs under Win7?
I download a compact package with '.tgz'. But it seems for linux. But there is really not one thing for windows(win 32 OS).
I unfold this package and I find there are lots of documents.
It's actually the same as for other operating systems, as far as I can tell. (At least, it always worked for me under FreeBSD/ArchLinux/Win7.) First, you unpack to a location you like, then add something like this to your .emacs (assuming you unpacked somewhere under your user directory):
(add-to-list 'load-path "~/my/path/to/slime/")
;; (add-to-list 'load-path "~/my/path/to/slime/contrib/") ; for optional features
(slime-setup
;; '(slime-fancy slime-asdf slime-references ; optional features
;; slime-indentation slime-xref-browser)
)
(setq slime-lisp-implementations
'((ccl ("~/path/to/ccl/wx86cl"))
(clisp ("~/path/to/clisp-2.49/clisp" "-modern"))) ; giving a command arg
slime-default-lisp 'ccl)
Restart Emacs or type C-x C-e behind each of these toplevel forms. Then, type M-x slime RET (or C-u M-x slime RET if you want to choose between the implementations in slime-lisp-implementations, otherwise slime-lisp-default will be used) and it should just work (it does for me). The setting of slime-lisp-implementations is optional – you can also give the path to your lisp implementation executable by hand when starting Slime.
Assuming you want to use Slime with CL, since there is no Clojure tag. If you want to use it with Clojure, things are unfortunately a little different and both versions don't play very nicely together. The recommended way for use with Clojure, last time I checked, would be installation using the package system of Emacs 24 or, if you're using an older version, ELPA (which is essentially the same).
This worked for me,
Get a Slime copy from https://github.com/slime/slime, either by git clone or by downloading the zip. Unzip and save it in D:/myuser/slime-2.13, for example
Download and install CLISP
Add this to the .emacs file, usually located in C:/users/myuser/AppData/Roaming:
; This is the path where you've saved Slime in the first step
(add-to-list 'load-path "D:/myuser/slime-2.13/")
(require 'slime-autoloads)
; This is the path where CLISP was installed.
; Use Progra~1 for "Program Files" and Progra~2 for "Program Files (x86)"
(setq inferior-lisp-program "/C/Progra~2/clisp-2.49/clisp.exe")

Using two emacs (Cocoa emacs and Aquamacs) at the same time

I happen to have two emacs on my Mac because of clojure setup.
The problem is that Cocoa emacs and Aquamacs uses the same ~/.emacs.d, but the ELPA of Cocoa emacs and that of Aquamacs are not compatible so that some files are overwritten and not usable for both of them.
Is there any way to tell Aquamacs not to use ~/.emacs.d for ELPA? I mean, can I change the default ELPA directory other than ~/.emacs.d ?
I use Aquamacs Starter Kt, but it seems that the ~/.emacs directory is used in init.el.
(unless (file-directory-p "~/.emacs.d/elpa")
(make-directory "~/.emacs.d/elpa" t))
I am not familiar with ELPA, but if aquamacs and carbon emacs are using different copies of package.el, you could try changing the definition of package-user-dir in one of them. In general I have found that using two different emacses on one machine is a recipe for baldness.

Match Aquamacs' settings in emacs

How can I match Aquamacs' settings in Mac OS X emacs' AucTeX?
Because of some reason I tried to install AucTeX to emacs for Mac OS X.
For Aquamacs that has pre-installed AucTeX, everything is pretty cool.
It runs SKIM pdf viewer for viewing the result.
It can use pdfsync for reverse/forward link between Aquamacs and SKIM.
I have the following in my .emacs, though there are probably better ways:
(setq LaTeX-command "latex -synctex=1 -shell-escape")
(when (file-exists-p "/Applications/Skim.app/Contents/SharedSupport/displayline")
(add-to-list 'TeX-output-view-style
'("^pdf$" "." "/Applications/Skim.app/Contents/SharedSupport/displayline -b %n %o %b")))
You might try seeing what those variables are set to in Aquamacs. Use C-h v VARIABLE RET to see documentation and the current value.