Handmade Hero .emacs file - emacs

I started to watch handmade hero series, the problem is when I try to use his .emacs configuration file, It seems it has problem, because launching Emacs using it (with -q -l options), Emacs starts with white background and not with the configuration using in the video series.

Related

Doom emacs display various themes in terminal

I employed the 'Ocean next theme' on alacritty terminal Color schemes ยท jwilm/alacritty Wiki
Upon starting doom-emacs from terminal (tmux new -s 'main'),
the identical commands emacs -nw display various theme.
I want the one above.
It's tricky that if start a new tmux session with other name saying 'focus',
They display the same themes
Restart the machine multiple times,
my desired theme appears on 'main' session to the above window.
What's the problem?
Your setup has too many layers:
Terminal->Tmux ->Emacs.
Try just running emacs without tmux (emacs has all the tmux goodies integrated) or better run the GUI emacs directly (themes will be in 100% full potential).
BTW, emacs GUI is not like GUI Vim. It's the total package if you run it with exwm.
Take out all decorations (scrool bar menu bar etc..) and it will look like a terminal app except with access to thousands of packages that cannot run in the terminal mode because of limitations.
Once you use it this way. There is no coming back.
My .xinitrc has one line exec emacs (keep in mind you can run firefox inside emacs)

Why can't I open another emacsclient after activating follow-mode?

I use Emacs for many things (the list seems to be growing every day). I like to have several frames open (so I can keep them in separate workspaces), so I first start it with emacs --daemon and then connect various clients to it with emacsclient -t.
One thing I have recently added to that list is writing papers. I write in Markdown, which allows easy version tracking with Git. In order to make it more readable, I usually split the frame into 3 or 4 windows vertically, and use follow-mode to split the paper between them.
I recently ran into a problem with this setup. Emacs would randomly stop accepting connections, and any time I ran emacsclient -t it would hang, never opening the frame. It took me a while to figure out why it happened, but I finally did. To reproduce:
Start emacs with emacs --daemon
Connect the first client with emacsclient -t <file> where <file> is some plaintext file.
Activate follow-mode with M-x follow-mode
Attempt to connect another client with emacsclient -t. This client will hang and never connect.
Deactivating follow-mode after that point had no effect, clients were still unable to connect. If I never activate follow-mode, I never have a problem.
I also tried it without loading any init files (emacs --daemon --no-init-file --no-site-file), with the same result.
I'm running GNU Emacs 23.4.1, from the Ubuntu software repositories.
Why does this happen?
Looks like a bug in follow-mode (I cannot reproduce it with with emacs 24.3). Upgrading emacs would be a solution for fixing the problem.
This seem to be the official thread for this problem, which provides some adittional information and a workaround for those unable or unwilling to upgrade emacs.

Color themes are strange/incorrect in terminal emulator

I'm running emacs-nox 23.3 in Konsole (from kde) emulator, the most color themes have strange colors.
For example, i like the Solarized Theme. I expect the theme should look like this:
(source: ethanschoonover.com)
However, this is what I get:
Broken Solarized Theme http://img824.imageshack.us/img824/3881/voronoi2.png
Most of themes that comes in emacs-color-theme package have similar behavior. I tried to change the Konsole color settings - no result. I also tried to replace my .Xresources with this one, with no success.
You need 256 colors in your terminal for most color themes to have decent appearance. Try adding this to your .bashrc (or .zshrc):
TERM=xterm-256color
After you've sourced the setting (source .bashrc), start again emacs and hopefully the themes will be looking much better.
No, do not put this line
TERM=xterm-256color
to .Xresources. Try to run emacs with this command:
TERM=xterm-256color emacs
and if everything is ok, put this line to your .bashrc or .bash_profile file:
alias emacs='TERM=xterm-256color emacs'
After that your can execute emacs with usual 'emacs' cmd and get the normal colors in editor.

How to set emacs to open new files in current instance on Ubuntu/Mint?

I want to keep emacs open most of the time, and then whenever I open a text file, python file, etc (from nautilus/finder), I want it to open as a new buffer in my current emacs instance, rather than starting a new instance.
I tried following this guide:
I wasn't really sure about what to do with the file, but what I tried was copying it to /usr/bin/emacs_openfile, adding #!/bin/sh to the first line, and running chmod +x emacs_openfile
However, it doesn't work for me and just opens a new instance, even though I was able to associate text files with this program.
On a sidenote, I set emacs as the default editor using this.
You want emacs client.
Basically, set emacsclient as your default editor, and add (server-start) somewere in your emacs config.
There needs to be a running Emacs instance for emacsclient to work, but if it's a hassle it's possible to have a headless Emacs launched at login.
Did you start server in emacs? Make sure that you add (server-start) to your .emacs or do M-x server-start from an existing EMACS session.
Conceptually, it's really easy, just do emacsclient file-name on the command line or where you name the program.
Just for your information, If you are using GUI version on Mac, the dir os emacsclient is below:
/Applications/Emacs.app/Contents/MacOS/bin/emacsclient

How do I byte-compile everything in my .emacs.d 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.