;(setq debug-on-error t)
;;; Ajusta directorio Lisp para Emacs 21.x en adelante
;(if (>= emacs-major-version 21)
;;; activar para Emacs 21.1 - Directorio para *.el nuevos
;(setq load-path (append (list "c:/archiv~1/emacsen/site-lisp/")
; load-path))
;)
;;; Integracion con R y Splus
;(setenv "HOME" "c:/users/imh")
;(setenv "PATH"
; "C:/cygwin/bin;C:/archiv~1/sp2000/cmd")
; ESS and customization:
(load "/usr/share/emacs/site-lisp/ess/lisp/ess-site")
(add-to-list 'Info-default-directory-list "/usr/share/emacs/site-lisp/ess/info")
;(setenv "SHELL" "C:/cygwin/bin/bash")
;(setenv "S_ELMHOST" "123.45.67.890")
;(setenv "S_FIRST" "source(\"c:/users/imh/S/init.s\")") ; Initialization file
;(setenv "S_PROJ" "c:/users/imh/S")
;(setenv "SHOME" "C:/archiv~1/sp2000")
;(setq-default inferior-Sqpe+4-program-name "c:/archiv~1/sp2000/cmd/Sqpe")
(setq ess-ask-for-ess-directory nil)
;(setq ess-directory "c:/users/imh/R/") ; arranca en directorio R
(setq ess-execute-in-process-buffer t)
(make-local-variable 'comment-indent-function)
(setq-default comment-indent-function 'ess-comment-indent)
(setq ess-ask-about-transfile t) ; pregunta sobre fichero de transcripcion
;(fset 'run-s "\C-x2\M-xS\C-m")
;(global-set-key "\M-s" 'run-s) ; ESC-s runs "run-s" which starts S
;;; Octave
(autoload 'octave-mode "octave-mod" nil t) ; lanza con M-x run-octave
(setq auto-mode-alist
(cons '("\\.m$" . octave-mode) auto-mode-alist))
; font-lock, autofill y abreviaturas
(add-hook 'octave-mode-hook
(lambda ()
(abbrev-mode 1)
(auto-fill-mode 1)
(if (eq window-system 'x)
(font-lock-mode 1))))
;;; LaTeX
;(setq load-path (cons "c:/archiv~1/emacsen/auctex-11.06" load-path))
(add-to-list 'Info-default-directory-list "/usr/share/emacs/site-lisp/auctex/doc")
(require 'tex-site)
(if window-system
(require 'font-latex))
(add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; RefTeX
(setq reftex-bibpath-environment-variables '("~/texmf/bibtex/"))
(autoload 'turn-on-bib-cite "bib-cite")
(add-hook 'LaTeX-mode-hook 'turn-on-bib-cite)
;(setq-default TeX-master nil) ; Query for master file.
(setq-default TeX-master 'dwim) ; Query for master file.
(setq TeX-parse-self t) ; Enable parse on load.
(setq TeX-auto-save t) ; Enable parse on save.
; Activate Math mode in menu.
(add-hook 'latex-mode-hook 'latex-math-mode 'append)
(add-hook 'LaTeX-mode-hook 'latex-math-mode 'append)
; Des-comentar las 2 siguientes lineas para utilizar acentos multiplataforma (llaves)
;(require 'iso-cvt)
;(add-hook 'latex-mode-hook 'iso-spanish)
; Forward Search (necesita xdvik reciente y paquete srcltx)
(require 'xdvi-search)
(add-hook 'latex-mode-hook (lambda ()
(local-set-key "\C-c\C-x" 'xdvi-jump-to-line)))
(add-hook 'LaTeX-mode-hook (lambda ()
(local-set-key "\C-c\C-x" 'xdvi-jump-to-line)))
; preview LaTeX
(setq gs-device "x11alpha")
(setq load-path (cons "/usr/share/emacs/site-lisp/preview" load-path))
;(require 'preview)
(autoload 'LaTeX-preview-setup "preview")
(add-hook 'LaTeX-mode-hook #'LaTeX-preview-setup)
; Prosper support
(eval-after-load "latex"
'(add-to-list 'LaTeX-style-list '("prosper")))
; Contador de palabras para LaTeX buffer (requiere programa deTeX)
(require 'tex-wcount)
(add-hook 'latex-mode-hook 'tex-wcount-mode)
(add-hook 'LaTeX-mode-hook 'tex-wcount-mode)
;;; HTML helper mode (HTML)
(autoload 'html-helper-mode "html-helper-mode" "Yay HTML" t)
;; To invoke html-helper-mode automatically on .html files, do this:
(setq auto-mode-alist (cons '("\\.html$" . html-helper-mode)
auto-mode-alist))
;; To invoke html-helper-mode automatically on .htm files, do this:
(setq auto-mode-alist (cons '("\\.htm$" . html-helper-mode) auto-mode-alist))
;; To invoke html-helper-mode automatically on .asp files, do this:
(setq auto-mode-alist (cons '("\\.asp$" . html-helper-mode) auto-mode-alist))
;; To invoke html-helper-mode automatically on .phtml files, do this:
(setq auto-mode-alist (cons '("\\.phtml$" . html-helper-mode) auto-mode-alist))
(setq browse-url-browser-function 'browse-url-galeon) ; lanza Konqueror en vez de Netscape
(setq html-helper-do-write-file-hooks t) ; Graba automaticamente fecha y autor
(setq html-helper-build-new-buffer t) ; Incluye comandos basicos en doc nuevo
(setq html-helper-address-string "Juan I. Modroño")
; Acentos (convierte automaticamente de Latin-1 a SGML (HTML))
(require 'iso-sgml)
;; CSS mode (colorea ficheros CSS)
(autoload 'css-mode "css-mode")
(setq auto-mode-alist
(cons '("\\.css\\'" . css-mode) auto-mode-alist))
;; Postscript mode
; Set up autoloading and auto-mode
(autoload 'ps-mode "ps-mode" "Major mode for editing PostScript" t)
(setq auto-mode-alist
(append
'(("\\.[eE]?[pP][sS]$" . ps-mode))
auto-mode-alist))
; PS Fontification
(add-hook 'ps-mode-hook
'(lambda ()
(make-local-variable 'font-lock-support-mode)
(make-local-variable 'lazy-lock-defer-on-scrolling)
(setq font-lock-support-mode 'lazy-lock-mode
lazy-lock-defer-on-scrolling t)
(turn-on-font-lock)))
(add-hook 'ps-run-mode-hook
'(lambda ()
(turn-on-font-lock)))
;;; Asociaciones (GNUServ)
;(setq load-path (append (list "c:/archiv~1/emacsen/gnuserv/")
; load-path))
;(require 'gnuserv)
(gnuserv-start)
(setq gnuserv-frame (selected-frame))
;; Fuentes
(modify-frame-parameters nil '((wait-for-wm . nil))); soluciona lapso al cambiar fuente con KDE 2.1
(set-language-environment "Latin-1") ; acentos y demas
(setq locale-coding-system 'iso-8859-1) ; estos
(set-terminal-coding-system 'iso-8859-1) ; hacen
(set-keyboard-coding-system 'iso-8859-1) ; falta
(set-selection-coding-system 'iso-8859-1) ; desde
(prefer-coding-system 'iso-8859-1) ; Emacs 21.2
;(setq w32-enable-italics t) ; *must* be before font settings
(setq w32-enable-synthesized-fonts t) ; idem para Emacs 21.1
(set-default-font "-misc-fixed-medium-r-normal--15-*-*-*-c-*-iso8859-1")
;(set-face-font 'italic "-*-Courier New-normal-i-*-*-15-*-*-*-c-*-iso8859-1")
;(set-face-font 'bold-italic "-*-Courier New-bold-i-*-*-15-*-*-*-c-*-iso8859-1")
;; Colores ## los colores pueden cambiarse al gusto
; General
(set-foreground-color "green1")
(set-background-color "black")
(global-font-lock-mode 1) ; Resalte de sintaxis
(setq font-lock-maximum-decoration t) ; maxima (necesario en ESS 5.1.19)
(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.
)
; Basic Faces
; (set-face-background 'default "black") ; Si activamos esto, se imprime
; fondo negro en impresion PS
; (set-face-foreground 'default "green1") ; idem
(set-face-background 'modeline "blue4")
(set-face-foreground 'modeline "lightskyblue")
(set-face-foreground 'highlight "black")
(set-face-background 'highlight "green1")
(set-face-foreground 'region "blue4")
(set-face-background 'region "light green")
(set-face-background 'secondary-selection "light green")
(set-face-foreground 'secondary-selection "black")
(set-cursor-color "hot pink")
; Resalte de sintaxis
(set-face-foreground 'font-lock-comment-face "dark grey")
(set-face-foreground 'font-lock-function-name-face "cornflower blue")
(set-face-foreground 'font-lock-keyword-face "turquoise1")
(if (eq font-lock-reference-face 'font-lock-constant-face )
(set-face-foreground 'font-lock-constant-face "violet")
(set-face-foreground 'font-lock-reference-face "coral")
)
(set-face-foreground 'font-lock-string-face "yellow")
(set-face-foreground 'font-lock-type-face "salmon")
(set-face-foreground 'font-lock-variable-name-face "turquoise")
(set-face-foreground 'font-lock-builtin-face "orange")
; Resalte de sintaxis LaTeX
(set-face-foreground 'font-latex-math-face "yellow")
(set-face-foreground 'font-latex-warning-face "white")
(set-face-foreground 'font-latex-bold-face "lawn green")
(set-face-foreground 'font-latex-italic-face "chartreuse")
(set-face-foreground 'font-latex-sedate-face "light sea green")
(set-face-foreground 'font-latex-string-face "sandy brown")
;Tipo de fuentes LaTeX cursiva y negrita
; (set-face-font 'font-latex-italic-face "-*-Courier New-normal-i-*-*-15-*-*-*-c-*-iso8859-1")
; (set-face-font 'font-latex-bold-face "-*-Courier New-bold-r-*-*-15-*-*-*-c-*-iso8859-1")
;;; Varios
; Resalte de parejas de parentesis
(show-paren-mode 1)
(set-face-background 'show-paren-match-face "azure2")
(set-face-foreground 'show-paren-match-face "royal blue")
; Window size:
;(set-frame-size (selected-frame) 82 32) ; adecuado para monitor 15"
(set-frame-size (selected-frame) 100 38) ; adecuado para monitor 17"
; Frames nuevas (importante al usar GNUServ)
;(setq default-frame-alist
; '((cursor-color . "yellow")
; (cursor-type . box)
; (foreground-color . "green1")
; (background-color . "black")
; ))
; Personaliza directorio de inicio
;(cd "c:/users/imh/")
(cd (getenv "HOME")) ; cambia a %HOME%
; Avanza solo una linea en scroll al final de la pantalla
(setq scroll-step 1)
; always terminate last line in file
(setq require-final-newline t)
; make pgup/dn remember current line
(setq scroll-preserve-screen-position t)
; don't scroll past end of file
(setq next-line-add-newlines nil)
; modeline options
(setq display-time-day-and-date t) ; allow display of day & date when time
(setq display-time-24hr-format t)
(setq display-time-interval 15)
(display-time) ; display the time
; Use column and line numbering
(line-number-mode 1)
(column-number-mode 1)
; replace y-e-s by y
(fset 'yes-or-no-p 'y-or-n-p)
; reemplaza texto seleccionado por lo que tecleamos
(delete-selection-mode t)
; the column beyond which do word wrap
(setq default-fill-column 80)
; Word wrap
(setq-default auto-fill-function 'do-auto-fill)
; Acorta lineas largas automaticamente solo en pantalla sin cambiar el lineado
(load "longlines")
; Mas sobre edicion y finales de linea
(setq next-line-add-newlines nil)
(setq require-final-newline t)
(setq-default truncate-lines nil)
; Inhibe mensajes iniciales
(setq inhibit-startup-message t)
(setq initial-scratch-message nil)
;;; Highlight rectangles (uses rect-mark.el)
;; Support for marking a rectangle of text with highlighting.
(define-key ctl-x-map "r\C-@" 'rm-set-mark)
(define-key ctl-x-map [?r ?\C-\ ] 'rm-set-mark)
(define-key ctl-x-map "r\C-x" 'rm-exchange-point-and-mark)
(define-key ctl-x-map "r\C-w" 'rm-kill-region)
(define-key ctl-x-map "r\M-w" 'rm-kill-ring-save)
(define-key global-map [S-down-mouse-1] 'rm-mouse-drag-region)
(autoload 'rm-set-mark "rect-mark"
"Set mark for rectangle." t)
(autoload 'rm-exchange-point-and-mark "rect-mark"
"Exchange point and mark for rectangle." t)
(autoload 'rm-kill-region "rect-mark"
"Kill a rectangular region and save it in the kill ring." t)
(autoload 'rm-kill-ring-save "rect-mark"
"Copy a rectangular region to the kill ring." t)
(autoload 'rm-mouse-drag-region "rect-mark"
"Drag out a rectangular region with the mouse." t)
; Open file dialog box (incluido en Emacs 21.1)
;(load "c:/archiv~1/emacsen/site-lisp/dlgopen") ; Usar con C-c C-f
; Muestra nombre de fichero en la barra de titulo
(setq frame-title-format "%b")
; Cuando avanza linea/pag., cursor queda siempre en la misma columna
(setq picture-mode t)
; Permite seleccion de rectangulos
(setq transient-mark-mode nil)
; Permite ordenar directorios en dired
(add-hook 'dired-load-hook
(lambda () (require 'dired-sort-menu)))
; Follow mode (split with C-x 1 C-x 3
(autoload 'follow-mode "follow"
"Synchronize windows showing the same buffer, minor mode." t)
;; highlight during query
(setq query-replace-highlight t)
;; highlight incremental search
(setq search-highlight t)
; Comenta una region
(autoload 'comment-out-region "comment" nil t)
(global-set-key "\C-cq" 'comment-out-region)
; Muestra espacios en blanco
(require 'blank-mode)
; Auto revert mode
(autoload 'auto-revert-mode "autorevert" nil t)
(autoload 'turn-on-auto-revert-mode "autorevert" nil nil)
(autoload 'global-auto-revert-mode "autorevert" nil t)
;(global-auto-revert-mode 1) ; esto lo activa por defecto (no recomendado)
;;; Impresion
(setq printer-name "lp1") ;Imprime en Secretaria
;(setq printer-name "lp2") ; Imprime en Sala Comun
;(setq printer-name "//econestad/color") ; Imprime en Color
;(setq ps-printer-name "//econestad/secre") ; si la impresora PostScript es distinta
(setq ps-print-buffer-with-faces t) ; Imprime PS sin/con colores
(setq ps-print-region-with-faces t) ; Imprime PS sin/con colores
(setq ps-paper-type 'a4) ; Cambia papel a A4 en vez de letter por defecto (PS)
(setq paper-type 'ps-a4) ; Cambia papel a A4 en vez de letter por defecto (normal)
;; Version Control
; RCS (INCLUIDO EN EMACS 21.1)
;(require 'vc)
; CVS (ACTIVAR PARA EMACS 20.7)
;(setq load-path (append (list "c:/archiv~1/emacs/site-lisp/elib/")
; load-path))
;(load "pcl-cvs-startup")
; Activa pcl-cvs para Emacs 20.7. Emacs 21 ya lo carga por defecto.
;(if (< emacs-major-version 21)
;(and
;(setq load-path (append (list "c:/archiv~1/emacs/site-lisp/elib/")
; load-path))
;(load "pcl-cvs-startup")
;))
;; Control de versiones propio de Emacs
(setq version-control t)
(setq kept-old-versions 1) ; guarda las 1 primeras versiones
(setq kept-new-versions 2) ; guarda las 2 ultimas versiones
(setq delete-old-versions t) ; borra el resto (v1