;
;;** Archivo .emacs de XXXXXXXX **
;

;
;; Primeros pasos de la configuración
;

;; Apaga el mensaje de inicio de Emacs
(setq inhibit-startup-message t)

;; Advierte sobre el cierre de Emacs, hay que confirmarlo con "yes" o "no".
;; Evita accidentes de cerrado
(setq kill-emacs-query-functions
      (cons (lambda () (yes-or-no-p  "¿De verdad te vas? "))
            kill-emacs-query-functions))

;; Inicio automático de las definiciones de abreviaciones
(setq-default abbrev-mode t)
(read-abbrev-file "~/emacs/definiciones_abreviaciones")
(setq save-abbrevs t)

(defun abr-back ()
"move abbrev cursor position back to [/"
(search-backward "[/")
(put no-self-insert t)
)

;; Define el idioma
;; Los caracteres extraños de esos idiomas de mierda.
(set-language-environment "Latin-1")
(setq default-buffer-file-coding-system 'iso-latin-1)

;; Para poder usar acentuacin cuando uso Emacs en el CLI
(set-keyboard-coding-system 'latin-1)

;; Inicio automático en modo texto
(setq default-major-mode 'text-mode)

;; Scroll de a una línea sola.
(setq scroll-step 1)

;;******************************************************************

;
;;**  Sección Botones **
;

;; Selección de texto mediante Shift y flechas
(pc-selection-mode)

;; Esc + flechas derecha/izquierda revientan la palabra
(define-key esc-map [right] 'kill-word)         ;; esc -> kill-word
(define-key esc-map [left] 'backward-kill-word) ;; esc <- backward-kill-word

;; Tab de 8 espacios
(setq-default tab-width 8)

;; Botones de Home y End, para que funcionen como debe ser
(global-set-key [home]   'beginning-of-line)
(global-set-key [end]    'end-of-line)

;; Para ir derecho al inicio -o al final- del buffer
;; Ctrl + Home o End, respectivamente
(global-set-key [(control home)] 'beginning-of-buffer)
(global-set-key [(control end)] 'end-of-buffer)

;; Botones de borrar, hace que las teclas Delete, Backspace, etc, se comporten como se debe
(global-unset-key [backspace] )
(global-set-key [backspace] 'delete-backward-char)
(global-unset-key [delete] )
(global-set-key [delete] 'delete-char)

;;  Comienzo de Atajos de teclado con teclas F

;; F-1 Abre un archivo
(global-set-key [f1]    'find-file)

;; F-2 Salva un archivo
(global-set-key [f2]    'save-buffer)

;; F-3 Cierra un buffer
(global-set-key [f3]    'kill-buffer)

;; F4 - Abre un shell de línea de comando
(global-set-key [f4] 'shell)

;; F5 - Circula por los buffers abiertos
(global-set-key [f5] 'bury-buffer)

;; F6 - Otro forma de circular por los buffers
(global-set-key [f6] 'switch-to-buffer)

;; F7 - Comenta toda la región seleccionada, independientemente del modo en uso
(global-set-key [f7] 'comment-region)

;; Shift-F7 F7 - Descometa toda la región seleccionada
(global-set-key [(shift f7)] 'universal-argument)

;; Shift-F8 - Agrega un esqueleto de script de Bash
(defun esqueleto_bash ()
  (interactive)
  (insert
"#!/bin/bash
 # Fecha:  /  / 2003
 # Host:
# Nombre:
# Descripción:
#
#
")
 (previous-line 6)
 (end-of-line))

(global-set-key [(shift f8)] 'esqueleto_bash)

;; F12 - Undo
(global-set-key [f12] 'undo)

;************************************************************************
;
;;**  Sección Forma y contenido **
;

;; Los colores del editor

;;;; (set-background-color  "White")
;;;; (set-foreground-color  "Blue")
;;;; (set-cursor-color  "Black")

;; Regiones colorizadas de forma personal
(setq font-lock-use-default-fonts nil)
(setq font-lock-use-default-colors nil)

    (require 'font-lock)

(set-face-foreground 'modeline "navyblue")
(set-face-background 'modeline "yellow")
(set-face-foreground 'font-lock-comment-face "red")
(set-face-background 'font-lock-comment-face "lightgreen")
(set-face-foreground 'font-lock-string-face "Navyblue")
(set-face-background 'font-lock-string-face "lightyellow")
(set-face-background 'font-lock-keyword-face "white")

;; La barra de desplazamiento del lado izquierdo, como en Windows, coño
;(setq scroll-bar-mode-explicit t)
;(set-scroll-bar-mode `right)
(set-scroll-bar-mode nil)

;; Numeración de línea y de columna en la "Barra de herramientas"
(setq line-number-mode t)
(setq column-number-mode t)

; Add time stamp capabilities. See time-stamp.el for doc.
;(add-hook 'write-file-hooks 'time-stamp)

;; A function to insert the time stamp at point.
(defun stamp ()
  "Insert at point the dummy time stamp string to activate the time stamp facility."
  (interactive "*")
  (insert "Time-stamp: <>")             ;insert the bare bones
  (time-stamp)                          ;call the function to fill it in
                                        ;where we put it.
  )

;; Programas de Emacs
;; NOTA: Todas estos programas difieren mucho entre sí­, los coloqué en este lugar, ya que todas ellos
;; necesitan de algún archivo en el directorio $HOME/emacs/lisp

;; Setnu-mode
;; Numeración dentro del buffer, al costado de la pantalla, bah...
(setq load-path (cons  "/home/xxxxxxxxx/emacs/lisp/" load-path))
(autoload 'setnu-mode  "setnu" "Buffer Line Numbering" t)
(defun turn-on-setnu-mode ())

;; Recent.el -Menu de archivos recientemente visitados-
(setq load-path (cons "/home/xxxxxxx/emacs/lisp/" load-path))
(require 'recent)
;; La hora en la "barra de herramientas"
(display-time)

;; La barra de desplazamiento
(setq scroll-bar-mode 't)

;; Las formas de los cursores, esta configuración es muy importante para mi.
;; Sólo funciona en X Window
(if (eq window-system 'x)
    (if (x-display-color-p)
       (progn
         (setq x-pointer-shape x-pointer-arrow)
                 (set-mouse-color  "black")
                 )))

;***************************************************************************

;
;;** Sección **
;

(setq make-backup-files         nil)    ; Para que no haga backups automáticos
(setq auto-save-list-file-name  nil)    ; Para que no salve automáticamente
(setq auto-save-default         nil)    ; Idem
(setq search-highlight           t)     ; Highlight search object
(setq query-replace-highlight    t)     ; Highlight query object
(setq mouse-sel-retain-highlight t)     ; Keep mouse high-lightening
(setq frame-title-format "Emacs: %f")   ; Barra con nombre del archivo
(setq next-line-add-newlines nil)       ; No agrega líneas al final de un buffer
(show-paren-mode t)                     ; Coloriza los pares de paréntesis
(fset 'y-or-n-p 'yes-or-no-p)           ; Uniformidad en los mensajes de "yes or no"


;
;; Archivos de backup
;

; Guarda los archivos de backup míos en $HOME/emacs/backups/
(defun make-backup-file-name (file-name)
   "Create the non-numeric backup file name for `file-name'."
  (require  'dired)
  (if (file-exists-p  "~/emacs/backups")
      (concat (expand-file-name  "~/emacs/backups/")
      (dired-replace-in-string  "/" "|" file-name))
      (concat file-name  "~")))

;*******************************************************************

;
;;** Sección E-mail **
;

;; Emacs es un excelente programa de e-mail, se pueden enviar e-mails con sólo pasar a "modo e-mail":
;; Ctrl + m, utiliza por defecto los alias de $HOME/.mailrc, para enviar el e-mail:
;; Ctrl + c - c

;; **-- Envío --**

;; Guarda copias de cada uno de los e-mails enviados, las copias las guarda en el
;; archivo "enviados"
(setq mail-archive-file-name  "/home/xxxxxxxx/Mail/Mail_Emacs/enviados")

;; E-mail desde XXXXXXX
(defconst user-mail-address  "xxxxxxx@xxxxxxx.com")

;; Agrega automáticamente mi firma a los e-mails, tomada, por supuesto, del archivo $HOME/signature,
;; si este existe
(setq mail-signature t)

;; Mailcrypt -- Permite encriptaqr los e-mails, y archivos, utilizando gnupg-
(setq load-path (cons "/home/xxxxxxxx/emacs/lisp/share/emacs/site-lisp/" load-path))
(add-hook 'rmail-show-message-hook 'mc-install-read-mode)
(load-library "mailcrypt")
(mc-setversion "gpg")

;; --Recibo-- ;;
(setenv "MAILHOST" "xxxxxx.xxxxx.xxxxx.xxxx")
(setq rmail-primary-inbox-list
    '("po:esteban") rmail-pop-password-required t)


;
;;** Sección Impresión **
;

;;* Nota: *
; Descomentar la 1º línea para que Emacs no imprima la información adicional,
; el encabezado en cada página que imprime

(setq ps-n-up-printing 1)       ; Imprime una pág. por cada hoja de papel. Print one page on 1 sheet of paper
; ps-print-header nil)          ; No imprime el header al principio de cada una de las páginas.


;
;;**  Sección Syntax Highlighting  **
;

;; Color Syntax para todos los lenguajes
(global-font-lock-mode t)

;; Lisp
(add-hook 'lisp-mode-hook 'turn-on-font-lock)

;; C
(add-hook 'c-mode-hook 'turn-on-font-lock)

;; HTML
(add-hook 'html-mode-hook 'turn-on-font-lock)

;; Helper mode de HTML
(setq load-path (cons "/home/xxxxxxx/emacs/lisp/" load-path))
(autoload 'html-helper-mode "html-helper-mode" "Yay HTML" t)
(setq auto-mode-alist (cons '("\\.html$" . html-helper-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.htm$" . html-helper-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.php$" . html-helper-mode) auto-mode-alist))

;; Agrega un template de HTML
(setq html-helper-build-new-buffer t)

;; Tempo
;(setq load-path (cons "/usr/share/emacs/21.2/lisp/" load-path))
;(require 'tempo)

;; Agrega sintaxis de color, usando html-font
(add-hook 'html-helper-load-hook '(lambda () (require 'html-font)))
(add-hook 'html-helper-mode-hook '(lambda () (font-lock-mode 1)))


;;; ALPHA ALPHA ALPHA
;;;
;;; load and eval this buffer (i.e. in your .emacs) to enable
;;; html-helper-mode customization even if the mode is not loaded.
;;;
;;; For Emacs 20.5.1 or newer (better: for those Emacsen supporting
;;; configuration
(defgroup html-helper nil
  "Customizing html-helper-mode"
  :group 'languages
  :group 'hypermedia
  :group 'local)

(defgroup html-helper-faces nil
  "Customizing html-helper-mode custom faces"
  :group 'html-helper
  :group 'faces)

;; Default distribution doesn't include visual-basic-mode
(defcustom html-helper-mode-uses-visual-basic nil
  "Non nil to require visual-basic-mode"
  :type 'boolean
  :initialize 'custom-initialize-default
  :group 'html-helper
  :require 'html-helper-mode)

(defcustom html-helper-mode-uses-JDE nil
  "No nil to use jde instead of java-mode"
  :type 'boolean
  :initialize 'custom-initialize-default
  :group 'html-helper
  :require 'html-helper-mode)

(defcustom html-helper-mode-uses-bold-italic nil
  "Non nil to use the bold-italic font (if your font supports it)"
  :type 'boolean
  :initialize 'custom-initialize-default
  :group 'html-helper
  :require 'html-helper-mode)

(defcustom html-helper-mode-uses-KG-style nil
  "Non nil to make Emacs consider PHP/ASP code blocks beginning in
the first column"
  :type 'boolean
  :initialize 'custom-initialize-default
  :group 'html-helper
  :require 'html-helper-mode)

(defcustom html-helper-mode-global-JSP-not-ASP t
  "Non nil to make Emacs consider <% %> blocks as JSP (global default behaviour)"
  :type 'boolean
  :initialize 'custom-initialize-default
  :group 'html-helper
  :require 'html-helper-mode)

(progn
  (defvar html-tag-face
    (defface html-tag-face
      '((((class color)
          (background dark))
;         (:foreground "deep sky blue" :bold t))
         (:foreground "dark blue" :bold t))
        (((class color)
          (background light))
         (:foreground "dodger blue" :bold t))
        (t
         (:foreground "dodger blue" :bold t)))
      "Face to use for HTML tags."
      :group 'html-helper-faces))
  (defvar html-helper-bold-face
    (defface html-helper-bold-face
      '((((class color)
          (background dark))
         (:foreground "wheat" :bold t))
        (((class color)
          (background light))
         (:foreground "peru" :bold t))
        (t
         (:foreground "peru" :bold t)))
      "Custom bold face."
      :group 'html-helper-faces))
  (defvar html-helper-italic-face
    (defface html-helper-italic-face
      '((((class color)
          (background dark))
         (:foreground "spring green" :italic t))
        (((class color)
          (background light))
         (:foreground "medium sea green" :italic t))
        (t
         (:foreground "medium sea green" :italic t)))
      "Custom italic face."
      :group 'html-helper-faces))
  (cond (html-helper-mode-uses-bold-italic
         (defvar html-helper-bold-italic-face
           (defface html-helper-bold-italic-face
             '((((class color)
                 (background dark))
                (:foreground "peachpuff" :bold t:italic t))
               (((class color)
                 (background light))
                (:foreground "orange" :bold t :italic t))
               (t
                (:foreground "orange" :bold t :italic t)))
             "Custom bold italic face."
             :group 'html-helper-faces))))
  (defvar html-helper-underline-face
    (defface html-helper-underline-face
      '((((class color)
          (background dark))
         (:foreground "cornsilk" :underline t))
        (((class color)
          (background dark))
         (:foreground "cornsilk" :underline t))
        (((class color)
          (background light))
         (:foreground "goldenrod" :underline t))
        (t
         (:foreground "goldenrod" :underline t)))
      "Custom underline face."
      :group 'html-helper-faces)))


;; Mouse con ruedita
(autoload 'mwheel-install "mwheel" "Enable wheely mouse")
(mwheel-install)
(custom-set-variables
 '(mwheel-scroll-amount (quote (5 . 20))))

;
;;** Sección corte de las palabras **
;

;*********************************************************

;; >> Comentado por el momento por que es una ladilla << ;;

;*********************************************************

; Para que no corte las palabras al final de la línea
; (setq-default auto-fill-function 'do-auto-fill)

; No corta las líneas
;(setq truncate-lines nil)
(custom-set-variables
  ;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
  ;; Your init file should contain only one such instance.
 '(inverse-video t))
(custom-set-faces
  ;; custom-set-faces was added by Custom -- don't edit or cut/paste it!
  ;; Your init file should contain only one such instance.
)

    Source: geocities.com/vivlox/linux

               ( geocities.com/vivlox)