How do you recompile emacs-lisp scripts from within emacs without problems? I've tried batch-recompile-direcory, but this causes weird glitches with the recompiled files until I restart emacs. Is there any way to do this so that no errors are caused?
This page of the GNU Emacs Reference manual taks about reloading files and/or libraries.
You definitely have to explicitey reload the new file with M-x load-library, unless there is another emacs mechanism that forces it to reload the newly byte-compiled function.
Related
I would like to disable emacs lock files. Per this thread it is possible to do it with (setq create-lockfiles nil).
However, when I put this in my .emacs file and start up, the value of this variable (via describe-variable) is t. If I set it manually via set-variable then it sticks and works as expected.
I'm using GNU Emacs 24.5.1, via the Goulet installer for windows. For what it's worth, I tried a fresh install of Emacs on a brand new PC (Win10) and it has the same issue. I also tried commenting out everything except this line in my config file, and it still failed to work.
Why would it not work if put at the end of my .emacs file? Is some other emacs package overwriting this (perhaps ESS)? Is there a way to set it permanently, after everything else is loaded?
Thanks
Using the latest emacs 24.3 I want rainbow parenthesis for my lisp editing. I'm following the instructions on this page.
Here is what I get after I setup everything:
File error: Cannot open load file, rainbow-delimiters
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.
The byte compile proceded fine and created a .elc file. Is there a missing step in the instructions? How would emacs know where this compiled is located if there is no path mentioned anywhere in the .emacs file?
Not a direct answer I'm afraid but I would recommend watching this as rainbow-delimiters is available in MELPA and this will make managing Emacs extensions MUCH easier.
Since some time (but I didn't change anything in .emacs), I have some errors with emacs's behaviour :
Remember mode will not kill the temporary buffer on "Ctl-C Ctl-C"
Orgmode will not refile any entry
Both operations complain with error "Not bookmark format"
I restored an old .emacs to make sure that I didn't mess it up but the error persists.
Where can I investigate to find out the problem ?
I have Emacs 24.2.1 since end of august.
The built in orgmode version is 7.8.11 (I see 7.9.2 is out ...)
It's always best to start debugging problems such as this by seeing if the problem still happens when you ignore your init file altogether - try starting emacs with --no-init-file and seeing if you still get the problem. If you don't then it's clearly something in your init file.
You can also get odd behaviour if you've got a local install of Org-mode in addition to the one bundled with Emacs itself - eg if you pull in a newer one through ELPA. If you have a local install through ELPA then you can try uninstalling the Org-mode package and trying again using the built-in Org-mode.
I have something similar to the following in my init file to make it switch to the ELPA-installed Org-mode to avoid such problems (this variant is untested so forgive me if it's not quite right):
(package-initialize) ; load and initialise ELPA-installed packages
(org-reload) ; restart Org-mode with the ELPA package
I filed a bug to the emacs team and they found out that the error comes from a corrupted bookmark file.
I removed my ~/.emacs.d/bookmark file (it was empty) and everything is fine now.
I'm using some plugins and I byte-compiled my .emacs but the start up still slow. Do I hava to byte-compile my prlugins too? (for instance, yasnippet.el -> yasnippet.elc)?
Byte compiled files load up faster so I'd recommend that you byte compile everything as Pascal suggested. I also keep this in my init file so automatically byte compile all the emacs lisp files I edit and save.
(add-hook 'emacs-lisp-mode-hook '(lambda ()
(add-hook 'after-save-hook 'emacs-lisp-byte-compile t t))) ;; Automatically byte-compile emacs-lisp files upon save
Emacs can feel slow to start up even without any .emacs or plugins :)
It is a good idea to compile plug-ins, that's as much time shaved from start-up. Compiling the .emacs configuration file is less usual (because it changes more often and is typically small anyway), but why not?
You probably already know this, but .el files can be byte-compiled using: M-x byte-compile-file or M-x byte-recompile-directory .
You can use emacs server to speed things up, then it only takes time to start the server the first time.
The way to start an Emacs server is to run Emacs as a daemon, using the ‘--daemon’ command-line option. When Emacs is started this way, it calls server-start after initialization, and returns control to the calling terminal instead of opening an initial frame; it then waits in the background, listening for edit requests.
Once an Emacs server is set up, you can use a shell command called emacsclient to connect to the existing Emacs process and tell it to visit a file. If you set the EDITOR environment variable to ‘emacsclient’, programs such as mail will use the existing Emacs process for editing.
From: http://www.gnu.org/software/emacs/manual/html_node/emacs/Emacs-Server.html
You'll likely find something use here: http://www.emacswiki.org/emacs/AutoRecompile
A great selection of tips for automatically byte-compiling files, when you save them or when you load them, and even caching the compiled files in a certain directory.
I have decided to check out Emacs, and I liked it very much. Now, I'm using the Emacs Starter Kit, which sort of provides better defaults and some nice customizations to default install of Emacs.
I have customized it a little, added some stuff like yasnippet, color-themes, unbound, and other stuff. I've set up a github repository where I keep all of the customizations so I can access them from multiple places or in case something goes bad and I lose my .emacs.d directory.
All of this is very nice, but there is a problem: Emacs takes about 1-2 seconds to load. AFAIK I can compile individual .el files with M-x byte-compile-file to .elc, and it works. But there are a lot of .el files, and I wonder if there is a way to compile them all with a simple command or something, to speed up the loading of Emacs. My Emacs is not always open, and I open and close it quite frequently, especially after I've set it up as a default editor for edit command in Total Commander to get used to it faster (yeah, windows xp here).
My Emacs version is 22.3. And yes, the default Emacs installation without any customizations fires up instantly.
I am not sure which version is preferred when loading, the .el or compiled .elc one by the way O.o
So, is there an elisp command or Emacs command line switch to make Emacs byte-compile everything in .emacs.d directory?
C-u 0 M-x byte-recompile-directory
will compile all the .el files in the directory and in all subdirectories below.
The C-u 0 part is to make it not ask about every .el file that does not have a .elc counterpart.
To automatically byte compile everything that needs byte compiling each time I start emacs, I put the following after my changes to load-path at the top of my .emacs file:
(byte-recompile-directory (expand-file-name "~/.emacs.d") 0)
Surprisingly, it doesn't add much to my startup time (unless something needs to be compiled).
To speed up my emacs, I first identified the slow parts using profile-dotemacs.el and then replaced them with autoloads.
You can use the --batch flag to recompile from the command line.
To recompile all, do
emacs --batch --eval '(byte-recompile-directory "~/.emacs.d")'
or to recompile a single file as from a Makefile,
emacs --batch --eval '(byte-compile-file "your-elisp-file.el")'
This is swaying a bit from the question, but to solve the problem of loading slowly you can use the new daemon feature in Emacs 23.
"If you have a lot of support packages,
emacs startup can be a bit slow.
However, emacs 23 brings emacs
--daemon, which enables you to start emacs in the background (for example
when you log in). You can instantly
pop up new emacs windows (frames) with
emacsclient. Of course, you could
already have an emacs 'server' in
older versions, but being able to
start it in the background makes this
a much nicer solution"
From http://emacs-fu.blogspot.com/2009/07/emacs-23-is-very-near.html
The command I use is M-x byte-force-recompile RET, it then asks the directory so, for example, I give it ~/.emacs.d/elpa/. It then recompiles everything in there, usually no need to delete .elc files first or mess with it in other ways.
For my using spacemacs, the command is spacemacs/recompile-elpa. The command byte-recompile-directory does not compile any file.