common lisp auto completion on aquamacs - emacs

When I start aquamacs with the autocompletion program
installed, http://cx4a.org/software/auto-complete/, with a lisp file that has el as an extension (example.el)
Then all lisp features are loaded into aquamacs including autocompletion.
But when I load a common lisp file (example.lisp) no autocompletion features are loaded.
So my question is, is it possible
to change the autocompletion code so also common lisp files are
recognized?
Thanks

From autocomplete manual:
Enable auto-complete-mode automatically for specific modes
auto-complete-mode won't be enabled automatically for modes that are
not in ac-modes. So you need to set if necessary:
(add-to-list 'ac-modes 'brandnew-mode)
Or in your case
(add-to-list 'ac-modes 'lisp-mode)
Just for info. By default the following modes are included
(defcustom ac-modes
'(emacs-lisp-mode
lisp-interaction-mode
c-mode cc-mode c++-mode
java-mode clojure-mode scala-mode
scheme-mode
ocaml-mode tuareg-mode
perl-mode cperl-mode python-mode ruby-mode
ecmascript-mode javascript-mode js-mode js2-mode php-mode css-mode
makefile-mode sh-mode fortran-mode f90-mode ada-mode
xml-mode sgml-mode)
"Major modes `auto-complete-mode' can run on."
:type '(repeat symbol)
:group 'auto-complete)

Related

How to set up LSP for Emacs with Julia

I would like to use Julia with Emacs and have installed julia-mode, julia-repl and lsp-julia. I am using Julia 1.7.3.
I have added the following to my init.el
(require 'lsp-mode)
(add-hook 'julia-mode-hook #'lsp)
(require 'lsp-ui)
(require 'julia-mode)
(require 'julia-repl)
(require 'lsp-julia)
(julia-repl-set-terminal-backend 'vterm)
(add-hook 'julia-mode-hook 'julia-repl-mode) ;; Always use minor mode
(require 'vterm)
However, when I have the (add-hook 'julia-mode-hook #'lsp) line enabled the keyboard shortcuts don't work (e.g., C-Enter is not found). All I want to do is set up julia in Emacs in a similar way using LSP with keyboard shortcuts to how I have it in VSCode.
What have I done wrong in my init.el?

C-c C-c does not work anymore to compile a tex under Emacs

I just upgraded my Ubuntu from 12.04 to 14.04.
When I edited .tex file under 12.04, I have set up my Emacs in such a way that C-c C-c launched automatically Latex, View or BibTex according to the circumstance. Consequently, I just needed to keep pressing C-c C-c to compile and view a simple .tex file. A part of the ~/.emacs file is as follows:
(require 'server)
(or (server-running-p)
(server-start))
(add-hook 'LaTeX-mode-hook 'TeX-PDF-mode)
(defun pdf-with-okular ()
(add-to-list 'TeX-output-view-style
(quote ("^pdf$" "." "okular %o %(outpage)"))))
(add-hook 'LaTeX-mode-hook 'pdf-with-okular t)
(setq TeX-view-program-list '(("Okular" "okular %o")))
(setq TeX-view-program-selection '((output-pdf "Okular") (output-dvi "Okular")))
(eval-after-load "tex"
'(setcdr (assoc "LaTeX" TeX-command-list)
'("%`%l%(mode) -shell-escape%' %t"
TeX-run-TeX nil (latex-mode doctex-mode) :help "Run LaTeX")))
(custom-set-variables
'(LaTeX-command "latex -synctex=1")
'(cua-mode t nil (cua-base))
'(show-paren-mode t)
'(tool-bar-mode nil))
After upgrading, this mechanism does not work anymore: C-c C-c launches Command [pdflatex], and if I just press Enter, it could not find the .tex file.
Does anyone know what is wrong?
It sounds like the command you expect to be bound to C-c C-c is not -- some other command is.
C-h m tells you what mode you are in, and some things about it. C-h k C-c C-c tells you what command is bound to C-c C-c, and it gives you a link to the library where that command is defined.
This info, together with your init file and the Lisp source code, will help you find out why C-c C-c is not bound to the command you expect.
And you might want to start your search by bisecting your init file, to narrow it down to the code that causes the problem.
In sum, the answer is to ask Emacs first.
The command that you describe comes from the AUCTeX extension, which replaces the built-in LaTeX mode of Emacs. It appears that AUCTeX was not properly upgraded or removed from your system, so you are back to the built-in mode, which is pretty primitive compared to AUCTeX.
Check whether AUCTeX is still available in your Emacs session (e.g. M-x locate-library RET auctex). Also, check whether the AUCTeX package is still installed, and reinstall it if necessary.
Alternatively, you can obtain AUCTeX from GNU ELPA with Emacs' built-in package manager, which makes your Emacs setup independent from your system.

can't find any symbol in common lisp in emacs with slime

According to the guide on the Internet, we can search in the HyperSpec for the symbol like "format" in emacs by typing C-c C-d h , However, I just cannot have it work, emacs just prompts that there's no completion for the symbol. Can somebody cope with it? thanks in advance!
Are you actually using the Slime REPL mode? Sometimes, when starting Slime without any configuration, you're not getting the REPL mode, and instead you'll be sitting in the *inferior-lisp* buffer.
First of all, check what the title of the buffer is. If it's *inferior-lisp*, it's not the correct one. It should read *slime-repl sbcl* (where sbcl refers to the CL implementation you're using).
If this is the case, then you need to make sure you enable slime-fancy in your Emacs init file. This is what I have:
(defun init-slime-configuration ()
(slime-setup '(slime-fancy slime-fuzzy))
(setq slime-load-failed-fasl 'never)
(define-key slime-repl-mode-map (kbd "C-<tab>") 'slime-fuzzy-complete-symbol)
(define-key slime-mode-map (kbd "C-<tab>") 'slime-fuzzy-complete-symbol))
(add-hook 'slime-load-hook 'init-slime-configuration)
This also allows me to use C-TAB for fuzzy expand.
I ran into this very problem after switching from the version of SLIME installed using Quicklisp (version 2.9) to that installed from MELPA (version 20141010.1357, as a dependency of ac-slime).
Using SLIME from Quicklisp worked fine with my local copy of the HyperSpec, using the settings:
(require 'slime-autoloads)
(add-to-list 'slime-contribs 'slime-fancy)
(setq slime-lisp-implementations
'((ccl ("ccl"))
(clisp ("clisp"))
(cmucl ("cmucl"))
(ecl ("ecl"))
(sbcl ("sbcl"))))
(setq slime-default-lisp 'sbcl)
(setq common-lisp-hyperspec-root "file:/usr/share/doc/HyperSpec/")
(setq common-lisp-hyperspec-symbol-table "file:/usr/share/doc/HyperSpec/Data/Map_Sym.txt")
I then completely removed and reinstalled Quicklisp (without reinstalling SLIME!), then installed ac-slime from MELPA using the Emacs package manager.
By chance I happened to notice that when I tried to lookup documentation in the HyperSpec, Emacs opened a hidden buffer with an empty file named "Map_Sym.txt" in it.
Looking at the full pathname of this file using C-h v buffer-file-name [RET] revealed that it was set to "/home/miki/file:/usr/share/doc/HyperSpec/Data/Map_Sym.txt".
As an experiment, I tried removing the "file:/" from the last two lines of my settings, to make them read:
(setq common-lisp-hyperspec-root "/usr/share/doc/HyperSpec/")
(setq common-lisp-hyperspec-symbol-table "/usr/share/doc/HyperSpec/Data/Map_Sym.txt")
It appears to have resolved the issue. Why this works, I don't know (it differs from the documentation). A bug or undocumented change, maybe?

Start C++ syntax highlighting for .cu (CUDA) files

I use Emacs as an editor. Of late whenever I use CUDA files (which usually have extensions .cu) I have to manually do M-x c++-mode to turn on syntax highlighting and other yasnippet features.
How do I do I ensure that all .cu files when started in EMACS automatically borrow all the C++ mode features. In other words .cu extension becomes an alias for .cpp extension.
( I know there is a CUDA mode for EMACS, (not inbuilt) but when I installed this mode it does not turn on many of the useful features present in the C++-mode of emacs )
Putting this into your .emacs should do the trick:
(add-to-list 'auto-mode-alist '("\\.cu\\'" . c++-mode))
Just in case people have missed it; there's a slightly more official cuda-mode available: http://www.emacswiki.org/emacs/CudaMode
You need to put it somewhere in your load-path; for example on my Mac, I put the code in $HOME/Library/emacs/cuda-mode.el and added the following lines to my .emacs file.
(add-to-list 'load-path "~/Library/emacs")
(autoload 'cuda-mode "cuda-mode.el")
(add-to-list 'auto-mode-alist '("\\.cu\\'" . cuda-mode))

Running Clojure and other Lisp at the same time on Emacs

I use Aquamacs, and Aquamacs is pre-equipped with SLIME.
(setq inferior-lisp-program "/usr/local/bin/sbcl") #####!!!
(add-to-list 'load-path "/Library/Application Support/Aquamacs Emacs/SLIME/contrib")
(add-to-list 'load-path "/Library/Application Support/Aquamacs Emacs/SLIME")
(require 'slime)
(slime-setup)
As is asked in somewhere, I try to use Clojure by adding this code.
(add-to-list 'load-path "~/clojure/clojure-mode")
(setq inferior-lisp-program "/Users/smcho/bin/clj") ################
(require 'clojure-mode)
(setq auto-mode-alist
(cons '("\\.clj$ . clojure-mode")
auto-mode-alist))
(add-hook 'clojure-mode-hook
'(lambda ()
(define-key clojure-mode-map "\C-c\C-e" 'lisp-eval-last-sexp)))
)
I couldn't make it Clojure run with SLIME, but I'm satisfied with the current setting, the only problem is that because of the (setq inferior-lisp-program ...) code, I have to change the .emacs code depending on I use Clojure or SBCL.
Is there any way to solve this problem? Can I choose between multiple (inferior) Lisps?
Added
I could make Clojure run on Aquamacs. Please refer to Running Clojure with 'lein swank' on Aquamacs problem. Forget about the settings written above, if you want to run Aquamacs/Clojure. You need just one line, (slime-setup '(slime-repl)) and lein swank.
Sure, you can use C-u M-x slime instead of just M-x slime to have SLIME ask you for the name of the Lisp executable to be launched, with whatever is your default already filled in.
There's also a slime-lisp-implementations variable which I have configured like so:
(setq slime-lisp-implementations
`((clojure ,(swank-clojure-cmd) :init swank-clojure-init)
(sbcl ("sbcl") :coding-system utf-8-unix)))
I have to say that I just can't remember what this does for me anymore (if indeed it does anything)... Type C-h v slime-lisp-implementations to learn roughly what it's supposed to do. I seem to have to type sbcl if I want to start that, which is fine by me due to the high Clojure-to-SBCL ratio in my SLIME'ing.
Update:
I have just rediscovered M-- M-x slime (that first key is meta-minus for a negative argument), which prompts for one of the names of Lisp implementations in slime-lisp-implementations (with tab completion) and then starts the required Lisp. With the above example config, M-- M-x slime sbcl starts SBCL.
(I find this useful mostly because of how it allows one to configure more complex commands to start Lisp -- e.g. (sbcl-options ("sbcl" "--an-option" "--another-option") ...), (sbcl-clbuild ("/path/to/clbuild" "lisp") ...) -- and refer to them by name.)