I am a new to Emacs , i downloaded auto-complete , moved it to ~/.emacs.d/plugins/ then modified the .emacs file to look like :
(add-to-list 'load-path (file-name-as-directory
(expand-file-name "~/.emacs.d/plugins/auto-complete"))\
)
(require 'auto-complete)
(global-auto-complete-mode t)
(ac-config-default)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(menu-bar-mode nil)
'(package-archives (quote (("melpa" . "http://stable.melpa.org/packages/") ("g\
nu" . "http://elpa.gnu.org/packages/")))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
when i restart emacs , it displays the following error :
Warning (initialization): An error occurred while loading `/Users/zeaksilva/.emacs':
File error: Cannot open load file, auto-complete
To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file. Start Emacs with
the `--debug-init' option to view a complete error backtrace.
Put (setq debug-on-error t) at the beginning of your init file. Or better yet, append --debug-init to the command line you use to invoke Emacs. That will open the debugger when the error occurs. But it seems that the file that has (provide 'autocomplete) in it, or that file's directory, is not in your load-path. When the debugger opens, use C-h v load-path, and see whether it is correct.
And try commenting out all of the extra stuff in your init file, which does not seem related to this problem: the custom-set-variables and custom-set-faces. IOW, simplify the sack of stuff that you try to debug.
Related
I'm fairly new to emacs. In fact I'm learning the editor and trying to setup something that will replicate "go to a file inside the project" feature known from Code::Blocks or certain plugins of notepad++.
'projectile' fulfills this need, and I installed it through MELPA. Package installed properly, as I can start it with M-x projectile-global-mode and C-c p commands are recognized.
However, if I put it into my .emacs file, Emacs starts with an error:
Symbol's function definition is void: projectile-global-mode
Contents of my .emacs file are as follows:
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
(global-whitespace-mode 1)
(global-linum-mode 1)
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
(projectile-global-mode 1)
When I try to (require 'projectile) first, I only end up with another error:
'File error: Cannot open load file, projectile'
I'm using Emacs 24.3.1.
How do I put this on autostart properly?
By default, Emacs initializes packages after evaluated init.el. Hence, in a standard setup, packages are not yet available while init is evaluated.
Use (add-hook 'after-init-hook #'projectile-global-mode) to enable Projectile only after packages are initialized, or explicitly initialize packages at the beginning of your init.el with the following code:
(require 'package)
(setq package-enable-at-startup nil) ; To avoid initializing twice
(package-initialize)
You have to load projectile first, e.g. by using this:
(require 'projectile)
(projectile-global-mode)
you can add
'(initial-major-mode (quote projectile-global-mode))
to your .emacs(or init.el or whatever your file is called) file in the custom-set-variable section.
Alternatively, in newer versions of emacs, the menu Options | Customize Emacs | Specific Option you can type 'initial-major-mode' and this will take you to an interface where emacs can customize itself with that setting. just remember to apply and save
(message "%S" load-path) and (describe-variable 'load-path)
give different results.
Several more path like "/Users/updogliu/.emacs.d/elpa/flycheck-20140323.828" appeared in the latter.
How can I make (require 'flycheck) use the "describe" one load-path?
To setup Flycheck properly, you do not need to require Flycheck. Instead, just enable Global Flycheck Mode:
(add-hook 'after-init-hook #'global-flycheck-mode)
This will enable Flycheck for all supported languages.
To make (require 'flycheck) work in your init.el, you need to add (package-initialize) at the very beginning of your init.el.
(package-initialize) sets up Emacs' built-in package system, which includes adding all packages to the load-path. Emacs calls this automatically, but only after your init.el has been processed, hence the use of after-init-hook to enable Flycheck.
If you added a message call to your init.el without calling (package-initialize) first, you'll hence see the standard load-path without any of your packages.
To make your packages available in your init.el right away, you need to call (package-initialize) manually, at the beginning of your init.el.
I have emacs24 installed on windows in C:\Program Files(x64) and python2.7 under C:\Python27
I've tried to install python mode to send commands to the interpreter from emacs. My init.el file in Users/myname/.emacs.d:
(setq py-install-directory "~/.emacs.d/python-mode.el-6.1.1")
(add-to-list 'load-path py-install-directory)
(require 'python-mode)
(setq py-shell-name "C:\Python27\python.exe")
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(py-shell-name "C:\\Python27\\python.exe"))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
I've put the python mode files in: C:\Users\myname\.emacs.d\python-mode.el-6.1.1
An interactive python session can be formed in a buffer by choosing the PyShell > Default Intepreter option in the menu, but if I open a .py file and try to run a hellow world like by going to the menu PyExec > Execute Statement I get errors of this nature:
Opening output file: no such file or directory, c:/Users/Ben/AppData/Local/Temp/C-/Python27/python.exe-705218Y.py
How can I set up so I can edit python code and then send lines to the python interpreter in another buffer without this error?
You are using setq and custom-set-variables to set py-shell-name. If I remember correctly, custom-set-variables does not work if you use setq before it. Also, you need to escape backslash when you write it in string literals. Using one of the following should solve your problem.
To use setq, fix backslashes:
(setq py-install-directory "~/.emacs.d/python-mode.el-6.1.1")
(add-to-list 'load-path py-install-directory)
(require 'python-mode)
(setq py-shell-name "C:\\Python27\\python.exe")
To use custom-set-variables, just remove setq:
(setq py-install-directory "~/.emacs.d/python-mode.el-6.1.1")
(add-to-list 'load-path py-install-directory)
(require 'python-mode)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(py-shell-name "C:\\Python27\\python.exe"))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
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.
I am totally new to emacs and is starting to learn how to use it effectively.
The first thing I wanna use is the svn mode.
I downloaded psvn.el and put it in the ~/.emacs.d directory
Then following the instruction in the comment part of the psvn.el file, I put this line
(require 'psvn)
Into the .emacs file
This is my current .emacs file
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(inhibit-startup-screen t))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
(require 'psvn)
Now when I starts emacs, I got this error message:
An error has occurred while loading `/home/akong/.emacs':
File error: "Cannot open load file", "psvn"
To ensure normal operation, you should investigate the cause
of the error in your initialization file and remove it. Start
Emacs with the `--debug-init' option to view a complete error
backtrace
Did I put the psvn.el in a wrong location?
I am using cygwin + WinXP
This is because Emacs cannot find any file providing psvn on its load-path.
In your shell:
mkdir -p ~/.emacs.d # Make the directory unless it exists
mv /some/path/psvn.el ~/.emacs.d/ # Move psvn.el into that directory
In your Emacs init file (often ~/.emacs):
(add-to-list 'load-path "~/.emacs.d") ; Add this directory to Emacs' load path
(require 'psvn) ; Load psvn
EDIT: I just realized that you are on Windows XP. I'm not sure how Cygwin will handle all of this, but the procedure is pretty much the same outside of Cygwin, just remember that ~ is %APPDATA% on Windows XP, so .emacs.d and .emacs should both be in that directory.
I guess you have problem finding your home directory on Windows? Try C-x d ~ RETURN (run dired on your home directory) to see where you home directory is, then do what the other answers say: put psvn.el in .emacs.d and add ~/.emacs.d in your load-path
First thing you're going to want to do is add .emacs.d to your load path so it knows where to look. Generally most people store .el plugins in ~/.emacs.d/site-lisp so i do this:
;; >>> Configure Load Path <<< ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq emacs-config-path "~/.emacs.d/")
(setq base-lisp-path "~/.emacs.d/site-lisp/")
(setq site-lisp-path (concat emacs-config-path "/site-lisp"))
(defun add-path (p)
(add-to-list 'load-path (concat base-lisp-path p)))
;; I should really just do this recursively.
(add-path "")
;; (add-path "some-nested-folder")
Now (require 'psvn) should work out fine.