I downloaded Auto-Complete from here: http://github.com/m2ym/auto-complete/downloads, I placed all the files from the .zip file in my load-path (C:\...Application Data\.emacs.d\plugins\auto-complete-1.0), and added the following to my .emacs:
;; load auto complete
(add-to-list 'load-path "~/.emacs.d/plugins/auto-complete-1.0")
(require 'auto-complete)
(global-auto-complete-mode t)
but an error message shows up:
.emacs:53:1:Error: Cannot open load file: auto-complete
I use a trailing '/' with directory names (as per file-name-as-directory). e.g.:
(add-to-list 'load-path (file-name-as-directory
(expand-file-name "~/.emacs.d/plugins/auto-complete-1.0")))
I rather doubt that's actually an issue, though.
Are your permissions appropriate for those files and directories?
Are you sure that ~ really expands to C:\...Application Data? Do C-x d ~ RET to be sure.
Related
I know that Emacs has the polymode package that allows coding in RMarkdown. However, it seems that Spacemacs is still missing the equivalent of a polymode layer.
I have been trying to install it directly into Spacemacs, with no success. Therefore my question: is there a way to edit RMarkdown files in Spacemacs (not plain Emacs).
you can add packages to spacemacs by adding them to dotspacemacs-additional-packages in your .spacemacs:
dotspacemacs-additional-packages '(polymode poly-R poly-noweb poly-markdown)
after a restart the packages should get installed automatically, you probably want to set some other options in dotspacemacs/user-config () e.g. something like:
(add-to-list 'auto-mode-alist '("\\.md" . poly-markdown-mode))
(add-to-list 'auto-mode-alist '("\\.Snw" . poly-noweb+r-mode))
(add-to-list 'auto-mode-alist '("\\.Rnw" . poly-noweb+r-mode))
(add-to-list 'auto-mode-alist '("\\.Rmd" . poly-markdown+r-mode))
Edit:
polymode got a rework.
There's no official polymode layer for Spacemacs, but I've found a couple of implementations in random configs on GitHub. Here's one that works for me:
;;; packages.el --- polymode layer packages file for Spacemacs.
;;
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
;;
;; Author: Walmes Zeviani & Fernando Mayer
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; Layer retrieved from here:
;; https://github.com/MilesMcBain/spacemacs_cfg/blob/master/private/polymode/packages.el
;;
;;; Code:
(defconst polymode-packages
'(polymode
poly-R
poly-markdown))
(defun polymode/init-poly-R ())
(defun polymode/init-poly-markdown ())
(defun polymode/init-polymode ()
(use-package polymode
:mode (("\\.Rmd" . Rmd-mode))
:init
(progn
(defun Rmd-mode ()
"ESS Markdown mode for Rmd files"
(interactive)
(require 'poly-R)
(require 'poly-markdown)
(R-mode)
(poly-markdown+r-mode))
))
)
;;; packages.el ends here
There are a few ways to work with private custom layers like this, but one straightforward and easy way is to...
Save the code above as a file named packages.el in ~/.emacs.d/layers/private/polymode/.
Add polymode to your list of dotspacemacs/layers, e.g.
(defun dotspacemacs/layers ()
ess
polymode
python
...
Restart Emacs and the polymode package should install.
Using this, you shouldn't have to use (add-to-list 'auto-mode-alist... to declare the particular mode that .Rmd files should use since it's defined in the layer. I retrieved this particular layer from here. I tried one or two others as well, but they didn't work for me.
I have downloaded autopair from Github and extracted it to ~/.emacs.d . Also I added the lines given in the installation instructions
(add-to-list 'load-path "/path/to/autopair") ;; comment if autopair.el is in standard load path
(require 'autopair)
(autopair-global-mode) ;; enable autopair in all buffers
I modified (add-to-list 'load-path "/path/to/autopair") as (add-to-list 'load-path "~/.emacs.d/autopair-master/") as that folder contains the autopair.el file. But when I open emacs it shows
Warning (initialization): An error occurred while loading `/home/karthikeyan/.emacs':
File error: Cannot open load file, cl-lib
I use emacs 23.4.1 in Linux Mint 15 and is there any alternate way to autocomplete the braces with a function at startup? . Also it doesn't showup autopair mode in Meta-x
try this (my emacs version is 23):
create new directory cl-lib in your .emacs.d directory
put this file into this cl-lib directory
add at top of your .emacs file these strings:
(add-to-list 'load-path "/path_to_your.emacs.d/cl-lib/")
(require 'cl-lib)
I receive this message every time I start emacs
Emacs 24.2
Win7 64 and Ubuntu 12.10
yasnippet 0.8.0 installed with package-list
If there is a way to fix it ?
yasnippet doesn't get initialised automatically when installed with elpa, which I find unconventional. You still need to add the yasnippet directory into your load-path.
Here is my set up in my .emacs
;; yasnippet
(add-to-list 'load-path "~/.emacs.d/elpa/yasnippet-0.8.0")
(require 'yasnippet)
(setq yas-snippet-dirs '("~/.emacs.d/elpa/yasnippet-0.8.0/snippets" "~/Dropbox/Applications/Customise/emacs/myyassnipets"))
(yas-global-mode 1)
This is the sort of message I would expect to see if you're calling load or load-file in your init.el with a bad path. Look for any uses of those functions and correct the path if you can.
If this is in code you control, you probably want to call (require 'yasnippet) instead of directly loading the file.
I am trying to install ENSIME for emacs. On the first step, when I integrate the ./misc/scala-tool-support/emacs .elc files, the instructions say to
(add-to-list 'load-path "/path/to/some/directory/scala-mode")
Because of the way the directory is structured (where there is no dir scala-mode but all of the .el files are called scala-mode), I am unsure what this exactly specifies. I originally thought it jsut meant to do something like:
(add-to-list 'load-path "~/...../misc/scala-tool-support/emacs/"), but reading further down to the following made me rethink my assumption.
(setq yas/my-directory "/path/to/some/directory/scala-mode/contrib/yasnippet/snippets")
(yas/load-directory yas/my-directory)
Can someone clarify this please?
Thanks much.
The yas/load-directory call has nothing to do with your load-path. Yes, you had it right originally. Is this not working? If so, what error message do you get?
Here is my setup for scala-mode and ensime on Emacs. I'm on OS X.
In the vendor/scala directory, it's just all the .el files from the compiler distribution.
And ensime/dist is bin/ elisp/ and lib/ directories from a github download.
;; Scala Mode
(add-to-list 'load-path "/Users/you/.emacs.d/vendor/scala")
(require 'scala-mode-auto)
(add-to-list 'auto-mode-alist '("\\.scala$" . scala-mode))
(add-to-list 'load-path "/path/to/ensime/dist")
(require 'ensime)
(add-hook 'scala-mode-hook 'ensime-scala-mode-hook)
I've checked the scala-tool-support repo, all of the scala-related snippets for had been included in Yasnippet now. If we use the Yasnippet release version newer than 0.5.7 , the snippets for scala-mode should be included in /path/to/yasnippet/text-mode/scala-mode, so we don't need to set yas/load-directory by ourselves.
I'm trying to install lua-mode into emacs for windows but nothing seems to be working. I've set my HOME environment variable. I've added init.el and lua-mode.el to the HOME\.emacs.d directory. Then I've added the following code to init.el:
(autoload 'lua-mode "lua-mode" "Lua editing mode." t)
(add-to-list 'auto-mode-alist '("\\.lua$" . lua-mode))
(add-to-list 'interpreter-mode-alist '("lua" . lua-mode))
(add-hook 'lua-mode-hook 'turn-on-font-lock)
Nothing is working when I start up emacs and load a .lua file. The major mode is always set to fundamental and there are no other options to change to. What can I do to get this working?
It's possible that your init.el is never read, because you also have a .emacs file (or .emacs.el) in your $HOME directory. You can choose between those three alternatives for Emacs' init file, but only one of them will be read. Traditionally, that's .emacs but some operating systems have problems with that filename syntax.
Also, make sure that you placed init.el in your actual home directory, not a directory called "HOME" or something.
See here for further details on Emacs init files and here for more info on home directories.
If you're not keen on using the init.el variant, here are instruction that should make lua-mode work for you using .emacs:
Start a new Emacs
Type C-x C-f ~/.emacs <ENTER> (C-x means press CTRL, hold it, press x, release - same for C-f)
Insert the following lines:
(add-to-list 'load-path "/path/to/lua-mode-dir")
(autoload 'lua-mode "lua-mode" "Lua editing mode." t)
(add-to-list 'auto-mode-alist '("\\.lua$" . lua-mode))
(add-to-list 'interpreter-mode-alist '("lua" . lua-mode))
(add-hook 'lua-mode-hook 'turn-on-font-lock)
Type C-x C-s to save the buffer to file
Type C-x C-c to close Emacs
Note that in step 3 you have to adjust "/path/to/lua-mode-dir" with the actual path to the directory where you saved the file lua-mode.el on your hard disk.
maybe you need something like (require 'lua-mode) or something like that? Also make sure that the lua-mode file is in a directory in your load-path variable. Something like this before anything else:
(add-to-list 'load-path "/home/dervin/.emacs.d/site-lisp/")
or wherever, and then the require-
The lines look OK. This can depend on a number of things:
The init.el file is not loaded at startup. In face, this is a non-standard name when it comes to Emacs. Emacs tries to load the files ~/.emacs, ~/emacs.el, and ~/.emacs.d/init.el in order, and will load the first one found. To verify that you file has loaded, you could add (message "Loading my init.el") inside it and check the *Messages* buffer.
The directory where you stored the file lua-mode.el is not in the load path. In fact, the ~/.emacs.d directory is not part of the standard load path.