My .emacs

I learnt Emacs back in 1983. I must have been 6 or 7 years old. My fingers got bent early on, I am a mess at handwriting. I could well be a piano player, as my fingers instintively chord.
Emacs rules and we all know it. It is the best operating system ever.
But given a good .emacs (Emacs configuration) file, it rules even more. It can even become a great editor - Even a full-fledged IDE, if that's your fancy.
Is my .emacs a good .emacs? Maybe, maybe not... Up to you to judge. This is applied plagiarism - I am not and will probably never be lisp-proficient. But I have taken snippets from all over.

;; Entra en modo de coloreado por sintaxis
(global-font-lock-mode t)

;; Si estoy en X, activa highlight-current-line (en emacs-goodies-el)
(cond (window-system
       (require 'highlight-current-line)
       (highlight-current-line-on t)
       (highlight-current-line-set-bg-color "#003900")
))

;; Muestra pares de paréntesis/corchetes/llaves
(require 'paren)
(show-paren-mode)
(setq show-paren-mismatch t)

;; Si el nombre de dos archivos es igual, agrega el directorio para que el
;; nombre del buffer sea único
(require 'uniquify)
(setq uniquify-buffer-name-style 'post-forward-angle-brackets)

;; No me gustan los archivos de respaldo~ o con número VCS~1.0~ -
;; Guardo los respaldos automáticos en ~/.saves/
(setq make-backup-files nil)
(setq version-control 'never)
(setq   backup-by-copying t   
	backup-directory-alist   '(("." . "~/.saves"))  
	delete-old-versions t 
	kept-new-versions 6 
	kept-old-versions 2
	version-control t)  

;; Mostrar número actual de línea y columna
(setq line-number-mode t)
(setq column-number-mode t)
;; Mostrar los bloques marcados mientras los estamos marcando
(setq transient-mark-mode t)
;; La campana se ve, no se oye
(setq visible-bell t)
;; No seguir agregando líneas en blanco al final
(setq next-line-add-newlines nil)
;; Hacer scroll línea por línea
(setq scroll-step 1)
;; Si tenemos un display separado verticalmente, también doblar líneas largas
(setq truncate-partial-width-windows nil)
;; Agregar automáticamente fin de línea a los archivos
(setq require-final-newline t)
;; El modo default para archivos nuevos es text-mode
(setq default-major-mode 'text-mode)
;; Los archivos .tmpl, .rhtml y .html.erb son templates de HTML
(setq auto-mode-alist (cons '("tmpl$" . html-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("rhtml$" . html-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("html.erb$" . html-mode) auto-mode-alist))
;; Los archivos .t son tests de Perl
(setq auto-mode-alist (cons '("\\\.t$" . perl-mode) auto-mode-alist))
;; Los archivos llamados /tmp/mutt* son abiertos en mail-mode
(setq auto-mode-alist (cons '("^/tmp/mutt" . mail-mode) auto-mode-alist))
;; .emacs es abierto en lisp-mode
(setq auto-mode-alist (cons '(".emacs$" . lisp-mode) auto-mode-alist))
;; Cuando hacemos un diff, que sea en modo unified
(setq diff-switches '-u)
;; No me gusta perder un par de líneas gracias al toolbar..
(setq tool-bar-mode nil)
;; Muestra como título de la ventana/icono el nombre del archivo abierto
;; (%f - filename, más largo. %b - buffer, más corto)
(setq frame-title-format "Emacs - %f")
(setq icon-title-format "Emacs - %b")
;; Seguimos ligas simbólicas aún si apuntan a un archivo controlado por CVS
(setq vc-follow-symlinks t)
;; Recordamos nuestra posición en el buffer 
(setq save-place t)
;; Evitamos el splash screen al cargar, no sirve de nada...
(setq inhibit-startup-message t)

;; Los buffers en text-mode y mail-mode tienen activado auto-fill
(add-hook 'text-mode-hook '(lambda () (auto-fill-mode 1)))
(add-hook 'mail-mode-hook '(lambda () (auto-fill-mode 1)))

;; Si tenemos mouse con ruedita de scroll, habilítala
(cond (window-system
       (mwheel-install)
))

;; Si estoy desde consola, no quiero barra de menú
(if (not window-system) (menu-bar-mode -1))

;; Para poder teclear caracteres acentuados al usar en consola
(set-input-mode nil nil 1)

;; Acepta 'y' o 'n' cuando pide 'yes' o 'no'
(fset 'yes-or-no-p 'y-or-n-p)

;; Combinaciones útiles de teclas
(global-set-key "\C-x\." 'kill-this-buffer)
(global-set-key [(C-tab)] 'bury-buffer)
(global-set-key "\C-cg" 'goto-line)

;; Ctrl-Z es una joda - Se va
(global-unset-key "\C-z")


;;;;; La siguiente sección (mmm) fue tomada de:
;;;;; http://www2.ecos.de/~mailarc/embperl/2004-03/msg00078.html

;; needed for all mmm usage
(require 'mmm-vars)

;; needed for mmm automatic mode
(require 'mmm-auto)

;; needed for Embperl
(require 'mmm-sample)

;; now we setup mmm to automatically appear - if it is called for
(setq mmm-global-mode 'maybe)

;; ;; I don't like background colors in my perl sections, so '0' turns
;; ;; off all background fiddling. Up to you. See 'info mmm'.
;; (setq mmm-submode-decoration-level 0)
(setq mmm-submode-decoration-level 2)

;; mmm sets perl sections to use cperl-mode by default. I perfer
;; plain perl-mode, so I include the following. Up to you.
(mmm-add-to-major-mode-preferences 'perl 'perl-mode t)

;; Here force any oddball extensions used by Embperl to html
;; I use ".epl".
(setq auto-mode-alist
  (append 
   ;; File name ends in '.epl'.
   '(
     ("\\.epl\\'" . html-mode))
   auto-mode-alist))


;; If you want automatic Embperl mmm mode for certain files
;; (you can select with a regex on name/extension or directory -
;; see 'info mmm'), include lines similar to the following:

(mmm-add-mode-ext-class nil "\\.epl\\'" 'embperl)
(mmm-add-mode-ext-class nil "\\.html\\'" 'embperl)

;; if you use the above lines, no 'mode' line is required in the
;; source file.

(set-face-background 'mmm-special-submode-face "#000099")
(set-face-background 'mmm-output-submode-face  "#000079")
(set-face-background 'mmm-comment-submode-face "#000059")
(set-face-background 'mmm-code-submode-face    "#000039")
(set-face-background 'mmm-init-submode-face    "#000019")
;;(set-face-foreground 'mmm-output-submode-face "Black")
;;(set-face-foreground 'mmm-code-submode-face "Black")
;;(set-face-foreground 'mmm-comment-submode-face "Red")

;;; Modo MMM para RHTML (Ruby on Rails)
;;; Tomado de http://blog.cosinux.org/2006/06/13/emacs-and-ruby-on-rails
;;; (y recortado - MMM fue activado más arriba)
(mmm-add-classes
 '((erb-code
    :submode ruby-mode
    :match-face (("<%#" . mmm-comment-submode-face)
                 ("<%=" . mmm-output-submode-face)
                 ("<%"  . mmm-code-submode-face))
    :front "<%[#=]?" 
    :back "%>" 
    :insert ((?% erb-code       nil @ "<%"  @ " " _ " " @ "%>" @)
             (?# erb-comment    nil @ "<%#" @ " " _ " " @ "%>" @)
             (?= erb-expression nil @ "<%=" @ " " _ " " @ "%>" @))
    )))
(add-hook 'html-mode-hook
          (lambda ()
            (setq mmm-classes '(erb-code))
            (mmm-mode-on)))
(add-to-list 'auto-mode-alist '("\\.rhtml$" . html-mode))

;;;
;; rails mode
(defun try-complete-abbrev (old)
  (if (expand-abbrev) t nil))

(setq hippie-expand-try-functions-list
      '(try-complete-abbrev
    try-complete-file-name
    try-expand-dabbrev))

(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.
 '(mmm-cleanup-submode-face ((t (:background "#000000"))))
 '(mmm-code-submode-face ((t (:background "#000039"))))
 '(mmm-comment-submode-face ((t (:background "#590000"))))
 '(mmm-declaration-submode-face ((t (:background "#0000A9"))))
 '(mmm-default-submode-face ((t (:background "#000079"))))
 '(mmm-init-submode-face ((t (:background "#000019"))))
 '(mmm-output-submode-face ((t (:background "#000079")))))

;; convert dos (^M) end of line to unix end of line  (and viceversa)
(defun dos2unix()    
  (interactive)    
  (goto-char(point-min))
  (while (search-forward "\r" nil t)
    (replace-match "")
    )
  )
     
(defun unix2dos()   
  (interactive)
  (goto-char(point-min))
  (while (search-forward "\n" nil t)
    (replace-match "\r\n")
    )
  )
(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.
 '(column-number-mode t)
 '(show-paren-mode t)
 '(tool-bar-mode nil)
 '(transient-mark-mode t))