cannot load cl-lib at emacs startup - emacs

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)

Related

How can I install nginx-mode into emacs?

I want to install nginx-mode into emacs so that I can have highlighting and formatting of my nginx configuration files. What is the easiest way to do this?
This requires emacs24 or newer.
emacs now has a pretty good package management system. The default package repository ELPA has a pretty restricted set of modes and packages, so instead we'll use MELPA which is actively maintained and growing.
First, install MELPA:
emacs /sudo::/etc/emacs/site-start.el
Paste in this code: (from https://melpa.org/#/getting-started)
(require 'package) ;; You might already have this line
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/"))
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize) ;; You might already have this line
Save and exit.
Second, install nginx-mode
To get nginx pretty-printing and indentation, do this to install nginx-mode:
emacs
M-x package-list-packages RET (Type meta-key and S, then type package-list-packages and hit return)
C-s nginx RET (Type control-S to search, type nginx and hit return to find the nginx-mode package)
i (to mark it to install)
x (to execute installation of marked packages)
Use nginx-mode
Now you can switch into nginx-mode with M-x nginx-mode. E.g.:
emacs /sudo::/etc/nginx/sites-available/default
M-x nginx-mode RET
You can make it recognize the sites-enabled files automatically by looking at these instructions.
If you can't use melpa:
You can download the file nginx-mode.el from https://github.com/ajc/nginx-mode and copy it in ~/.emacs.d/
Then in you .emacs you can add
(add-to-list 'load-path "~/.emacs.d/")
(autoload 'nginx-mode "nginx-mode" nil t)
(add-to-list 'auto-mode-alist '("nginx.conf\\'" . nginx-mode)) ;; or M-x nginx-mode

cannot open load file: /yasnippet

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.

Emacs Starter Kit Mac Not Installing

I'm trying to install this:
https://github.com/technomancy/emacs-starter-kit
I put the following into my ~/.emacs.d/init.el file:
(require 'package)
(add-to-list 'package-archives
'("marmalade" . "http://marmalade-repo.org/packages/"))
(package-initialize)
I then go to run M-x eval-buffer and am told "Cannot open load file: package"
Any idea how I can get around this? I'm unsure what's wrong, but for what it's worth, there was previously no init.el file and my .emacs file doesnt exist either.
The package.el used by emacs-starter-kit is for emacs 24.
There's the package.el file available for the emacs 23 :
here
You should replace the package.el file

Plugin in Emacs

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.

Problem installing Auto-Complete plugin in Emacs

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.