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

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.

Related

Emacs24 , org-mode, can't find `latex'(needed to convert LaTeX fragments fo images)

I want to use the command C-c C-x C-l to preview latex code in org-mode. Since the emacs-nox cannot do this, I tried apt-get install emacs24. However, after I have installed the emacs24 with GUI, I get an error like
can't find \`latex'(needed to convert LaTeX fragments to images)
I have installed texlive2016, and I can latex *.tex in shell command.
I added the /paht/to/latex to .emacs, but it don't work well.
Adding the following to my init.el makes it work:
;; Making emacs find latex (so that C-c C-x C-l works on orgmode)
(setenv "PATH" (concat ":/Library/TeX/texbin/" (getenv "PATH")))
(add-to-list 'exec-path "/Library/TeX/texbin/")
It is not a very pretty solution, but it does the job and is very easy to modify and understand.
This solution worked on a Mac running macOS Sierra and Emacs v25.1.
My crystal ball tells me that the problem is that you're not starting the GUI Emacs from a terminal, so it can't inherit your $PATH settings. See for example https://emacs.stackexchange.com/questions/10722/ (that question is within OSX, but the same problem appears in other systems).
Apparently you can set env-vars globally (so that they affect all applications, including those started directly from the GUI) in ~/.pam_environment (that's for GNU/Linux systems). Note that this is only consulted when you login, so you need to logout+login for changes to take effect.

emacs elpa version of auctex has no "auctex.el"

To set up auctex in Emacs you are told to include
(load "auctex.el" nil t t)
...etc. in your init/.emacs file. But if you installed auctex with elpa (which puts files in ~/.emacs.d/elpa/auctex-11.86/), you have no auctex.el and the (load ...) fails. What should I do?
Instead of loading nonexistent auctex.el do
(require 'tex)
which initializes AUCTeX for me (Windows Emacs 24.3 and pdflatex from Cygwin). If you have MiKTeX, you would also need
(require 'tex-mik)
Another potential problem with the package from elpa is the tex-site.el which is supposed to be generated during installation and contain system-specific data but gets installed from elpa instead. You may want to examine the file and make corrections if needed (and copy it to some other location which is listed earlier in your load-path). For instance it has some unix paths which make no sense in Windows environment.
Your problem is most likely due to the package initialization problem discussed here: Emacs 24 Package System Initialization Problems
You need to call (package-initialize) before calling load to not get an error.

Independent emacs installations and locations of the .emacs.d directory and the .emacs file

I have multiple installations of emacs on my Windows 7 computer, each configured slightly differently. Let's say installation1 and installation2, where installation1 is the main emacs, and installation2 is subsidiary.
I would like to maintain two sets of .emacs files and .emacs.d. directories, such that installation1 looks for it in the default HOME or %appdata% directory (C-x C-f ~/.emacs RET), but that installation2 cannot find the .emacs file in these directories at all. That is, I would like installation2 to not look in the HOME or %appdata% locations for the .emacs.d directory or .emacs file. Ideally, this would be implemented by redefining the ~ expansion for installation2.
I guess I could have a (add-to-list 'load-path "C:/installation2-location/.emacs.d/lisp/") and save it to a .emacs file in the same directory as the installation2 emacs executable, but I am not sure that this is a robust solution.
Suggestions welcome.
Well you can use the system-type variable. From the Emacs help
system-type is a variable defined in `C source code'. Its value is
darwin
Documentation: The value is a symbol indicating the type of operating
system you are using. Special values: gnu' compiled for a
GNU Hurd system.gnu/linux' compiled for a GNU/Linux system.
gnu/kfreebsd' compiled for a GNU system with a FreeBSD kernel.
darwin' compiled for Darwin (GNU-Darwin, Mac OS X, ...).
ms-dos' compiled as an MS-DOS application.windows-nt'
compiled as a native W32 application. `cygwin' compiled using
the Cygwin library. Anything else (in Emacs 24.1, the possibilities
are: aix, berkeley-unix, hpux, irix, usg-unix-v) indicates some sort
of Unix system.
Or use system-name to determine discriminate between machines of the same of.
Finally you can make a function to load what you want in installation-1 and another to load what you want in installation-2. But I can't see any valid reason as to why you would want to maintain different emacs.d in the same machine.

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

Emacs not recognizing its own scripts in /emacs/lisp/

I'm very new to emacs and I'm using version 23.2 on Windows. I'm trying to get CEDET working, but when I require it in .emacs it fails to find the file:
File error: Cannot open load file
I was able to get cedet working by loading it manually with:
(load "C:/emacs/lisp/cedet/cedet.el")
But I still can't require other files from cedet like semantic-gcc or semantic-ia.
Here's my .emacs file:
(load "C:/emacs/lisp/cedet/cedet.el")
(global-ede-mode t)
(semantic-mode 1)
;(semantic-load-enable-excessive-code-helpers)
(require 'semantic-ia)
(require 'semantic-gcc)
It's like emacs isn't looking for these files in its own path, and I did try
(add-to-list 'load-path "C:/emacs/lisp/cedet")
With a lot of other variations but none worked.
Firstly, you need to find the reason that cedet won't load with a simple (require 'cedet).
Is Emacs installed at c:\emacs? (ie the emacs.exe you are running is c:\emacs\bin\emacs.exe)
Is something setting EMACSLOADPATH externally from Emacs (your environment, or in the registry under HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER /Software/GNU/Emacs?
Is there another installation of an older version of CEDET on your load path?
Has c:\emacs\lisp\subdirs.el been edited to remove the cedet subdirectory?
Once you've solved that, note that the paths were changed when CEDET was merged into Emacs to accommodate old systems that have limitations on file name lengths. But at the same time, the autoloads were improved, so you shouldn't need to explicitly require those files any more. If you still do, the following should work:
(require 'semantic/ia)
(require 'semantic/bovine/gcc)