Seguindo a tradição, segue meu ~/.emacs. Como há muita coisa específica, use-o como exemplo apenas – simplesmente copiá-lo servirá pouco.
;; ;; .emacs ;; ;; Hélio Nunes <dedalu _a___t___ dedalu.art.br> ;; ;; Time-stamp: <2007-02-12 11:04:31 dedalu> ;;
;;
;; Programas locais
;;
(setq load-path
(append (list (expand-file-name "~/elisp")
(expand-file-name "~/elisp/http-emacs")
(expand-file-name "~/elisp/simple-wiki")
(expand-file-name "~/elisp/nx")
(expand-file-name "~/elisp/mailcrypt")
(expand-file-name "~/elisp/dictionary")
(expand-file-name "~/elisp/misc"))
load-path))
;;
;; Servidor
;;
(server-start);; ;; Codificação utf-8 ;; (prefer-coding-system 'utf-8)
;; ;; interface ;; (delete-selection-mode t) (setq transient-mark-mode t) (setq next-line-add-newlines nil) (global-font-lock-mode t) (setq inhibit-startup-message t) (iswitchb-mode t) (line-number-mode 1) (column-number-mode 1) (show-paren-mode t) (temp-buffer-resize-mode t) (resize-minibuffer-mode) (setq display-time-day-and-date t) (display-time) ;; ;; Ao invés de `yes', apenas `y' para confirmar (fset 'yes-or-no-p 'y-or-n-p) ;; ;; ignorar MAI./min. (setq sort-fold-case t) (setq case-fold-search t) ;; ;; scroll (set-scroll-bar-mode 'right) (setq scroll-step 1) (setq scroll-conservatively 1) (setq scroll-up-aggressively .00000001) (setq scroll-down-aggressively .00000001) ;; ;; mouse (mouse-avoidance-mode 'animate) (mouse-wheel-mode t)
;; ;; Cua ;; ;; teclas de atalho semelhantes ao windows ;; Para prefixos, usar C-S-x (cua-mode t) ;; Make Shift|Control|Control+Shift-movement|Home|End keys work on the ;; GNU/Linux console or in an xterm ;; (when (or (string= (getenv "TERM") "linux") ;; (string= (getenv "TERM") "xterm")) ;; (define-key function-key-map "\eO2A" [S-up]) ;; (define-key function-key-map "\eO2B" [S-down]) ;; (define-key function-key-map "\eO2C" [S-right]) ;; (define-key function-key-map "\eO2D" [S-left]) ;; (define-key function-key-map "\eO5C" [C-right]) ;; (define-key function-key-map "\eO5D" [C-left]) ;; (define-key function-key-map "\eO6C" [C-S-right]) ;; (define-key function-key-map "\eO6D" [C-S-left]) ;; (define-key function-key-map "\eO2H" [S-home]) ;; (define-key function-key-map "\eO2F" [S-end]) ;; (define-key function-key-map "\eO5H" [C-home]) ;; (define-key function-key-map "\eO5F" [C-end]) ;; (define-key function-key-map "\eO6H" [C-S-home]) ;; (define-key function-key-map "\eO6F" [C-S-end]) ;; )
;; ;; Redo ;; (require 'redo)
;; ;; arquivos ;; (auto-compression-mode t) (setq require-final-newline t) ;; ;; insere TAB e não espaços (setq indent-tabs-mode t) (setq tab-always-indent t) ;; ;; Time-stamp: <> (add-hook 'write-file-hooks 'time-stamp)
;; ;; Dired ;; (setq dired-recursive-deletes t)
;; ;; GPG ;; (require 'mailcrypt) (mc-setversion "gpg") (require 'mc-gpg-file-mode)
;;
;; Backup sempre no mesmo local e com controle de versões
;;
(setq make-backup-files t)
(setq backup-directory-alist nil)
(setq backup-directory-alist
(cons (cons ".*" (expand-file-name "~/.emacs_backups"))
backup-directory-alist))
(setq version-control t)
(setq kept-new-versions 3)
(setq kept-old-versions 1)
(setq delete-old-versions t);; ;; modo texto ;; (add-hook 'text-mode-hook 'turn-on-auto-fill)
;; ;; nxhtml -- TODO: definir site ;; (load "~/elisp/nx/autostart.el")
(add-to-list 'auto-mode-alist '("\\.inc\\'" . nxhtml-mode))
(add-to-list 'auto-mode-alist '("\\.php[34]?\\'" . nxhtml-mode))
(add-to-list 'auto-mode-alist '("\\.[sj]?html?\\'" . nxhtml-mode))(defun my-nxhtml-mode-hook() (xhtml-multi-mode t)) (add-hook 'nxhtml-mode-hook 'my-nxhtml-mode-hook)
;; ;; "indentação" ;; (defun my-c-mode-hook() (setq c-indent-tabs-mode t c-indent-level 4 c-argdecl-indent 0 c-tab-always-indent t backward-delete-function nil) (c-set-offset 'substatement-open '0) (c-set-offset 'inline-open '+) (c-set-offset 'block-open '+) (c-set-offset 'brace-list-open '+) (c-set-offset 'case-label '+)) (add-hook 'c-mode-hook 'my-c-mode-hook) (add-hook 'c++-mode-hook 'my-c-mode-hook)
;;
;; CVS
;;
(if (not (getenv "CVS_RSH"))
(setenv "CVS_RSH" "ssh")) ;;
;; WIKI
;;
(require 'simple-wiki-completion)
;;
;; pcomplete
(add-hook 'simple-wiki-edit-mode-hook 'pcomplete-simple-wiki-setup)
(setq pcomplete-ignore-case t)
;;
;; longlines
(load "longlines")
(setq longlines-show-hard-newlines t)
(add-hook 'simple-wiki-edit-mode-hook
'longlines-mode-on)
(add-hook 'simple-wiki-save-before-hooks
(lambda () (when longlines-mode (longlines-mode-off))))
(add-hook 'simple-wiki-edit-mode-hook 'turn-off-auto-fill)
;;
;; Meus wikis
(set-variable (quote swd-user-name) "DeDaLu")
(setq swd-wiki-defs-list
(append swd-wiki-defs-list '(("dedalu"
"http://www.dedalu.art.br/cgi-bin/wiki.pl"
"?action=browse&raw=2&id="
"?action=index&raw=1"
"?action=rc&raw=1"
1.1
swd-usemod-wiki-save
utf-8) ("museumuseu"
"http://www.dedalu.art.br/cgi-bin/mmwiki.pl"
"?action=browse&raw=2&id="
"?action=index&raw=1"
"?action=rc&raw=1"
1.1
swd-usemod-wiki-save
utf-8))))
(defun my-dedaluwiki-browse ()
"abre página do meu diário de bordo"
(interactive)
(set-variable (quote swd-user-name) "DeDaLu")
(swc-browse "dedalu"))
(defun my-museumuseuwiki-browse ()
"abre página do museumuseu wiki"
(interactive)
(set-variable (quote swd-user-name) "Hélio")
(swc-browse "museumuseu"))
;;
;; Permite entrar no wiki direto do calendário
(load "calendar")
(defun swb-insert-entry (arg)
"get the date page for the date indicated by point"
(interactive "P")
(let* ((date (calendar-cursor-to-date t))
(month (pop date))
(day (pop date))
(year (pop date))
;;date page use ISO format YYYY-MM-DD
(page (format "%04d-%02d-%02d" year month day))
(nick "dedalu")
(buffer (get-buffer-create (concat (upcase nick) ":" page))))
(switch-to-buffer-other-window buffer)
(swc-browse nick page)))
;;bind the function to w
;(add-hook 'calendar-mode-hook
; (define-key calendar-mode-map "w" 'swb-insert-entry))
(add-hook 'calendar-load-hook
(define-key calendar-mode-map "w" 'swb-insert-entry)) ;;
;; ispell
;;
(setq
ispell-local-dictionary-alist
'(("pt_BR" ; Brazilian mode
"[A-Z\301\311\315\323\332\300\310\314\322\331\303\325\307\334\302\312\324a-z\341\351\355\363\372\340\350\354\362\371\343\365\347\374\342\352\364]"
"[^A-Z\301\311\315\323\332\300\310\314\322\331\303\325\307\334\302\312\324a-z\341\351\355\363\372\340\350\354\362\371\343\365\347\374\342\352\364]"
"[']"
nil
("-d" "pt_BR")
nil
iso-8859-1)))
(setq ispell-local-dictionary "pt_BR")
;;
;; my-switch-dict
(defun my-switch-dict ()
"permite alternar dicionário entre pt_BR e american"
(interactive)
(if (string-equal ispell-local-dictionary "american")
(setq ispell-local-dictionary "pt_BR")
(setq ispell-local-dictionary "american"))
(message "Dicionário: %s" ispell-local-dictionary));; ;; dictionary ;; (autoload 'dictionary-search "dictionary" "Ask for a word and search it in all dictionaries" t) (autoload 'dictionary-match-words "dictionary" "Ask for a word and search all matching words in the dictionaries" t) (autoload 'dictionary-lookup-definition "dictionary" "Unconditionally lookup the word at point." t) (autoload 'dictionary "dictionary" "Create a new dictionary buffer" t) (autoload 'dictionary-mouse-popup-matching-words "dictionary" "Display entries matching the word at the cursor" t) (autoload 'dictionary-popup-matching-words "dictionary" "Display entries matching the word at the point" t) (autoload 'dictionary-tooltip-mode "dictionary" "Display tooltips for the current word" t) (autoload 'global-dictionary-tooltip-mode "dictionary" "Enable/disable dictionary-tooltip-mode for all buffers" t)
;; ;; print ;; (setq ps-lpr-command "kprinter")
;; ;; browser ;; (setq browse-url-netscape-program "firefox")
;;
;; data
;;
(defun insert-date (prefix)
"Insert the current date. With prefix-argument, use ISO format. With
two prefix arguments, write out the day and month name."
(interactive "P")
(let ((format (cond
((not prefix) "%d/%m/%Y")
((equal prefix '(4)) "%Y-%m-%d")
((equal prefix '(16)) "%A, %d de %B de %Y")))
(system-time-locale "pt_BR"))
(insert (format-time-string format))))
(global-set-key (kbd "C-c d") 'insert-date);; ;; Changelog ;; (setq add-log-keep-changes-together t)
;; ;; KEYBINDINGS ;; ;; f1 == C-h (global-set-key (kbd "<f2>") 'split-window-horizontally) ;; f3 == kmacro-start-macro-or-insert-counter ;; f4 == kmacro-end-or-call-macro (global-set-key (kbd "<f5>") 'ispell-word) (global-set-key (kbd "<f6>") 'comment-or-uncomment-region) (global-set-key (kbd "<f7>") 'indent-region) ;; (global-set-key (kbd "<f8>") ') ;; (global-set-key (kbd "<f9>") ') ;; ; f10 == x-menu-bar-open ;; (global-set-key (kbd "<f11>") ') ;; (global-set-key (kbd "<f12>") ')
(global-unset-key (kbd "C-p")) (global-set-key (kbd "C-/") 'undo) (global-set-key (kbd "C-?") 'redo) (global-set-key (kbd "C-p c") 'calendar) (global-set-key (kbd "C-p d") 'my-switch-dict) (global-set-key (kbd "C-p e") 'swc-emacswiki-browse) (global-set-key (kbd "C-p f") 'flyspell-mode) (global-set-key (kbd "C-p g") 'goto-line) (global-set-key (kbd "C-p i") 'ispell-buffer) (global-set-key (kbd "C-p I") 'ispell-region) (global-set-key (kbd "C-p m") 'my-museumuseuwiki-browse) (global-set-key (kbd "C-p w") 'my-dedaluwiki-browse) (global-set-key [M-left] 'backward-sexp) (global-set-key [M-right] 'forward-sexp)
;; ;; desktop e recentf ;; ;; arquivos recentes (require 'recentf) (setq recentf-max-saved-items 30) (recentf-mode 1) ;; para lembrar onde estava (setq save-place t) ;; para lembrar a última sessão (desktop-save-mode t) (desktop-read)