; Common part of stolfi's emacs profile ;;; Guard against Trojan files (setq inhibit-local-variables t) (setq inhibit-startup-message t) (setq vm-inhibit-startup-message nil) (put 'eval-expression 'disabled nil) (setq-default indent-tabs-mode nil) (setq require-final-newline t) (setq lpr-switches (list "-h")) ;;;;;;;;;; DISPLAY ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq buffers-menu-max-size 20) (if (eq window-system 'x) (progn (menu-bar-mode 1) ;; show menu bars (scroll-bar-mode -1) ;; supress scroll bars (transient-mark-mode -1) ) ) (setq truncate-partial-width-windows nil) ;; Dont truncate lines on narrow windows ;;;;;; PORTUG MODE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; (require 'iso-syntax) ;; para reconhecer letras acentuadas (standard-display-european 1) ;; para mostrar caracteres acentuados (setq-default ctl-arrow 1) ; (autoload 'Portug-mode "iso") ; (autoload 'Portug "iso" ; "Toggles Portug-mode. In Portug mode, the keys '`\"~^ work as accents toward ; the following letter; one gets c-cedilla with 'c. A double accent inserts itself. ; Case fold searches also fold accents. " ; t) ; (fset 'portug 'Portug) ; (load "stolfi-accent-conversion") (add-hook 'text-mode-hook (function (lambda () (auto-fill-mode 1))) t ; after existing hooks ) ;;;;;; HACK TO FIX CURRENT-TIME-ZONE ;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun current-time-zone (&optional time) "patch to current-time-zone" nil ) ;;;;;; PRELOAD COMMONLY USED STUFF ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (load "complete") ; (load "execcmd") (garbage-collect) ;;;;;;; ELECTRIC HELP ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; (load "electric") ; (load "echistory") ; (load "ehelp") ; (load "utilities") (garbage-collect) ; (defun electric-apropos () ; "Electric version of apropos." ; (interactive) ; (electric-helpify 'apropos)) ; (defun electric-super-apropos () ; "Electric version of super-apropos." ; (interactive) ; (electric-helpify 'super-apropos)) ; (define-key ehelp-map "p" 'electric-super-apropos) ; (define-key ehelp-map "a" 'electric-apropos) ;; Make meta-shift a default help ; (let ((k ?A)) ; (while (<= k ?Z) ; (define-key esc-map (char-to-string k) ; (or (lookup-key esc-map (char-to-string k)) ; (lookup-key ehelp-map (char-to-string (downcase k))))) ; (setq k (1+ k)))) ; (fset 'help-command ehelp-map) ;;;;;;; DIRED ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (load "dired") ; (load "dired-support") (garbage-collect) (setq dired-listing-switches "-al") ;; recomendavel para seguir symlinks (defun dired-default-directory (&optional arg) ;;; (am) "Does dired on the current directory. With an argument, the output goes to another window." (interactive "P") (if arg (switch-to-buffer-other-window (dired-noselect default-directory)) (switch-to-buffer (dired-noselect default-directory)))) (defun stolfi-dired-mouse-2 (start-event) ;;; (js) "Selects the clicked line and does a dired-find-file." (interactive "e") (let* ( (start-posn (event-start start-event)) (start-point (posn-point start-posn)) (start-window (posn-window start-posn)) ) (select-window start-window) (goto-char start-point) ) (dired-find-file) ) (define-key dired-mode-map [mouse-2] 'stolfi-dired-mouse-2) ;;;;;; VM MAILER ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (autoload 'vm "vm" "*Read mail under Emacs. Optional first arg FOLDER specifies the folder to visit. It defaults to the value of vm-primary-inbox. The folder buffer is put into VM mode, a major mode for reading mail. Visiting the primary inbox causes any contents of the system mailbox to be moved and appended to the resulting buffer. All the messages can be read by repeatedly pressing SPC. Messages are marked for deletion with `d', and saved to a folder with `s'. Quitting VM with `q' expunges messages marked for deletion and saves the buffered folder to disk. See the documentation for vm-mode for more information." t) (autoload 'vm-visit-folder "vm" "*Visit a mail file. VM will parse and present its messages to you in the usual way." t) ; (setq rmail-delete-after-output t) (setq mail-default-reply-to (concat (getenv "USER") "@ic.unicamp.br")) (setq mail-yank-prefix " > ") (load "vm-hacks") ; Nao vale `a pena esperar que lusers descubram isso (add-hook 'mail-setup-hook 'mail-abbrevs-setup) ; Headers para 8-bit messages: (add-hook 'mail-setup-hook 'mail-insert-8bit-headers) (defun mail-insert-8bit-headers() "Insert 8bit specification headers in current buffer" (interactive) (let ( (p-here (copy-marker (point))) ) (goto-char (point-min)) (forward-line 2) (insert "MIME-Version: 1.0\n") (insert "Content-Transfer-Encoding: 8bit\n") (insert "Content-Type: text/plain; charset=iso-8859-1\n") (goto-char p-here) ) nil ) ;;;;;; MHE MAILER ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq mh-summary-height 6) (setq mh-bury-show-buffer nil) (setq mh-ins-buf-prefix " > ") ;;;;;; TIME STAMP ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq time-stamp-format "%04y-%02m-%02d %02H:%02M:%02S by %u") (setq time-stamp-start "^[^A-Za-z]*Last edited on ") (setq time-stamp-end "[^A-Za-z]*$") ;;;;;; SHELLS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (add-hook 'comint-output-filter-functions 'comint-strip-ctrl-m) (setq rlogin-explicit-args "-8") ;;;;;; OTHER PACKAGES ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (autoload 'uncompress-while-visiting "uncompress2" "load uncompress" t) (autoload 'zcat-buffer "zcat") (autoload 'zcat-insert-file "zcat") (autoload 'live-find-file "live-find" "View a file with \"tail -f\"" t) (autoload 'modula-3-mode "modula3" "Modula-3 mode" t) (autoload 'makefile-mode "makefile-mode" "Makefile mode" t) (autoload 'm3makefile-mode "m3makefile-mode" "M3makefile mode" t) ;;;;;; DICIO ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (autoload 'dic-mode "dic-mode" "wordlist markup mode" t) ;;;;;; GLOBAL BINDINGS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (load "stolfi-hacks") (load "stolfi-mouse-hacks") (load "my-bindings") (setq auto-mode-alist '( ; Some standard modes: ("\\.l\\'" . lisp-mode) ("\\.lisp\\'" . lisp-mode) ("\\.bib\\'" . bibtex-mode) ("\\.tar\\'" . tar-mode) ("\\.\\(arc\\|zip\\|lzh\\|zoo\\)\\'" . archive-mode) ("[]>:/]\\..*emacs\\'" . emacs-lisp-mode) ("[:/]_emacs\\'" . emacs-lisp-mode) ; My own modes: ("\\.m3make$" . m3makefile-mode) ("/m3makefile$" . m3makefile-mode) ("\\.make$" . makefile-mode) ("/makefile$" . makefile-mode) ("/Makefile$" . makefile-mode) ("\\.m3$" . modula-3-mode) ("\\.i3$" . modula-3-mode) ("\\.mg$" . modula-3-mode) ("\\.ig$" . modula-3-mode) ("\\.iso$" . portug) ("\\.html$" . portug) ("\\.html-[a-zA-Z]*$" . portug) ("\\.dic$" . portug) ("\\.diccheck$" . dic-mode) ("/[0-9][0-9]*$" . portug) ("\\.c$" . c-mode) ("\\.h$" . c-mode) ("\\.Z$" . uncompress-while-visiting) ("\\.z$" . uncompress-while-visiting) ("\\.gz$" . uncompress-while-visiting) ) ) ;;;;;; COLORFUL WINDOWS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; The following command paints text in different colors depending on ; function. It may be pretty (well, depending on your taste), but it ; seems to slow down file loading... ; ; (load "my-hilit-profile.el") ;;;;;; EMACS SERVER ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; The following command enables Emacs to act as an "edit server". ; After "server-start" executed, other applications can cause this ; instance of Emacs to load and display some file "foo" by executing ; "emacsclient foo". ; ; (server-start)