My Emacs configuration

I'm by no means an expert in using Emacs, but it has been my favorite editor for some time if I need to write anything more than a short note or a simple one-line script. Unfortunately, I will probably never have time to learn Lisp, which means I'll never be able to write my own functions or modify the existing modes or functions written for the Emacs. Luckily, with some googling one can usually find a ready solution for just about any problem one encounters using Emacs.

The following code contains some of the tweaks I have added to the configuration of Emacs on most of my boxes. Just copy and paste the code (or parts of it) to ~./emacs. If you don't have .emacs file in your home directory, you can create it with any editor you like (you might even like to use vi for the task!). In openSUSE the tweaks can also be included in ~/.gnu-emacs-custom.

Please suggest some more tweaks in the comment box!


;; == disable splash screen & toolbar to save screen space ==
(setq inhibit-splash-screen t)
(tool-bar-mode -1)

;; == disable menu bar as well ==
;; (menu-bar-mode -1)

;; == use text mode as default mode and use longlines-mode with text files ==
(setq default-major-mode 'text-mode)
(add-hook 'text-mode-hook 'longlines-mode)

;;; == use org-mode for .org files ==
(add-to-list 'load-path (expand-file-name "~/git/org-mode/lisp"))
(add-to-list 'auto-mode-alist '("\\.\\(org\\)$" . org-mode))
(require 'org-install)

;; == enable mouse wheel ==
(mouse-wheel-mode t)

;; == save backup files in ~/.emacs-backups
(setq make-backup-files t)
(setq version-control t)
(setq backup-directory-alist (quote ((".*" . "~/.emacs-backups/"))))

;; === pretty colors on blackground ==
(set-background-color "black")
(set-foreground-color "green")
(set-cursor-color "yellow")

;;== count words with Esc x wc
(defun wc ()
(interactive)
(message "Word count: %s" (how-many "\\w+" (point-min) (point-max))))

1 comment:

Electron said...

Some handy basic things: Sorry these are horribly formatted, your blog doesn't allow me to use the pre tag

(setq compilation-scroll-output nil)
(column-number-mode 1) ;show the current column position
(setq mouse-drag-copy-region nil) ; stops selection with a mouse being immediately injected to the kill ring
(setq x-select-enable-primary nil) ; stops killing/yanking interacting with primary X11 selection
(setq x-select-enable-clipboard t) ; makes killing/yanking interact with clipboard X11 selection

;force Emacs to indent with spaces, never with TABs:
(setq-default indent-tabs-mode nil);

if want to use emacsclient to do all of your editing in one emacs instance

(server-start)