orgweb/site/articles/emacs.org
2012-06-21 21:24:54 +02:00

127 lines
3.4 KiB
Org Mode

#+TITLE: Emacs
#+STYLE: <link rel="stylesheet" type="text/css" href="../../stylesheet.css" />
#+LINK_UP: ../index.html
#+LINK_HOME: ../index.html
#+OPTIONS: H:5
* General Emacs Tips
Tips might be the wrong word here, but the way I use Emacs has
resulted into looking at some things that others might not think of
or see.
** Emacs Init File
Your Emacs init file can be any of the following:
- ~$HOME/.emacs~
- ~$HOME/.emacs.el~
- ~$HOME/.emacs.d/init.el~
I personally use ~$HOME/.emacs.d/init.el~ because that way I can
keep *everything* Emacs related in a single directory
(~$HOME/.emacs.d~).
** Displaying time
I've seriously minimized the use of my window manager's task
bar. It only shows which tags there are, some important daemons'
status (running or not) and whether or not I have mail. This makes
it difficult to tell time when I need it. That why it's useful to
see what time it is in Emacs, since that is on 99.99% of the time
I'm behind my computer, and it's very easy:
#+BEGIN_SRC emacs-lisp
(display-time-mode t)
#+END_SRC
That is all. When you have that in your [[Emacs Init File]], you will
always have the time in your modeline.
** Automatically compile startup files
I know that for 99% of the things you might have in your having a
compiled init files won't make much of a difference, but still I
like having my init files compiled. This gets messy when you share
your init files across multiple PCs and the source files become
newer than the compiled ones.
To fix this I've put only a very little bit of code in my actual
[[Emacs Init File]]:
#+BEGIN_SRC emacs-lisp
(require 'bytecomp)
(defvar startup-files
(directory-files "~/.emacs.d/startup/" t "^[^.].*\\.el$")
"A list of the files that should be loaded during startup.")
(while startup-files
(let ((filename (car startup-files))
(byte-compile-warnings nil))
(if (not (eq (byte-recompile-file filename nil 0) nil))
(load (substring filename 0 -3))))
(setq startup-files (cdr startup-files)))
#+END_SRC
It gets all the files in the ~$HOME/.emacs.d/startup/~ directory
that end with ~.el~. It loops through all these files and compiles
them, and then loads them. I use ~byte-recompile-file~ instead of
~byte-recompile-directory~ because the directory one didn't work
quite right. It doesn't recompile anything if the source file is
still up to date, so it only slows down when you have a lot of new
files in the ~startup~ directory. It also disables warnings so
that you're not bothered by them during startup.
* Emacs as...
There are *many* things Emacs[fn:emacs] is useful for, not just
coding and writing, but certainly very much for these uses as well.
** ... An IDE...
Emacs features many modes for a lot of different languages.
# *** ... For PHP
# Coming soon...
# *** ... For Python
# Coming soon...
# **** ... With django
# Coming soon...
# *** ... For C
# Coming soon...
# *** ... For Java on Android
# Coming soon...
# *** ... For Go
# Coming soon...
# *** ... For Guile (Scheme)
# Coming soon...
# ** ... A web authoring tool
# Coming soon...
# ** ... An organizational tool
# Coming soon...
# ** ... A social network interface
# Coming soon...
# ** ... A notifier
# Coming soon...