juan reyero

Emacs

Emacs for OS-X

Get Emacs-23 if the web site is up, or Carbon Emacs for OS-X,

My .emacs

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; General stuff
;;
(setq compile-command "make")
(setq tab-width 4)
(auto-fill-mode 1)
(setq indent-tabs-mode nil)
(show-paren-mode t)
(define-key global-map (read-kbd-macro "M-RET") 'hippie-expand)
(global-set-key "\M-g" 'goto-line)
;;;(setq display-time-day-and-date t
;;;      display-time-24hr-format t)
;;;(display-time)
; Turn off Emacs 21 toolbar
(if (fboundp 'tool-bar-mode)
    (tool-bar-mode -1))
(desktop-save-mode 1)
(savehist-mode 1)

(require 'ido)
(ido-mode t)

(setq tags-table-list
      '("~/hp" "~/cjr/jac" "~/cjr/gsk"))

(setq user-mail-address "juan@juanreyero.com")
;;(add-hook 'desktop-after-read-hook '(lambda () (kill-buffer "*GNU Emacs*")))
;;; HP
(setenv "http_proxy" "http://web-proxy.bpo.hp.com:8080")
;;; These paths are set up in .bashrc and emacs does not know about them
(setq exec-path (append (list "/Users/juanre/bin" "/usr/local/bin") exec-path))

(defun load-if-there (conf-file)
  (if (file-exists-p conf-file)
      (load-file conf-file)))

(add-to-list 'load-path "/Users/juanre/lib/emacs-lisp/ess/lisp")
(require 'ess-site)

(add-to-list 'load-path "/Users/juanre/lib/emacs-lisp")
(load-if-there ".org.el")

(add-to-list 'load-path "/Users/juanre/lib/emacs-lisp/slime")
(setq inferior-lisp-program "/usr/local/bin/sbcl")
(require 'slime)
(slime-setup '(slime-fancy))

;; (load-if-there ".slime.el")

(load-file "/Users/juanre/src/lib/el/plan/plan.elc")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; minor modes
;;;
(autoload 'longlines-mode "longlines.el" 
  "Minor mode for automatically wrapping long lines." t)

(autoload 'wikipedia-mode "wikipedia-mode.el"
  "Major mode for editing documents in Wikipedia markup." t)

(add-to-list 'auto-mode-alist 
             '("\\.wiki\\'" . wikipedia-mode))

(require 'yaml-mode)
(add-to-list 'auto-mode-alist '("\\.yml$" . yaml-mode))

;;;(require 'git-emacs)
(add-to-list 'load-path "/Users/juanre/lib/emacs-lisp/magit/")
(require 'magit)
;;(define-key global-map (read-kbd-macro "C-c m") 'hippie-expand)
(global-set-key (read-kbd-macro "C-c m") 'magit-status)
(setq magit-git-executable "/usr/local/git/bin/git")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Major modes

;;;;;;;;;;;;;;;;;;;;
;; Apache
;;
(autoload 'apache-mode "apache-mode" nil t)
(add-to-list 'auto-mode-alist '("\\.htaccess\\'"   . apache-mode))
(add-to-list 'auto-mode-alist '("httpd\\.conf\\'"  . apache-mode))
(add-to-list 'auto-mode-alist '("srm\\.conf\\'"    . apache-mode))
(add-to-list 'auto-mode-alist '("access\\.conf\\'" . apache-mode))
(add-to-list 'auto-mode-alist '("sites-\\(available\\|enabled\\)/" . 
                                apache-mode))

;;;;;;;;;;;;;;;;;;;;
;; Sage
;;
;; (add-to-list 'load-path (expand-file-name "/Applications/sage/data/emacs"))
;; (require 'sage "sage")
;; (setq sage-command "/Applications/sage/sage")
;; 
;; ;; If you want sage-view to typeset all your output and have plot()
;; ;; commands inline, uncomment the following line and configure sage-view:
;; (require 'sage-view "sage-view")
;; (add-hook 'sage-startup-hook 'sage-view)
;; (add-hook 'sage-startup-hook 'sage-view
;;        'sage-view-disable-inline-plots)

;; You can use commands like
;; (add-hook 'sage-startup-hook 'sage-view
;; 'sage-view-disable-inline-output 'sage-view-disable-inline-plots)
;; to have some combination of features.  In future, the customize interface
;; will make this simpler... hint, hint!


;;;;;;;;;;;;;;;;;;;;
;; C/C++
;;
(defconst my-c-style
  '((c-tab-always-indent        . t)
    (c-comment-only-line-offset . 4)
    (c-hanging-braces-alist     . ((substatement-open after)
                                   (brace-list-open)))
    (c-hanging-colons-alist     . ((member-init-intro before)
                                   (inher-intro)
                                   (case-label after)
                                   (label after)
                                   (access-label after)))
    (c-cleanup-list             . (scope-operator
                                   empty-defun-braces
                                   defun-close-semi))
    (c-offsets-alist            . ((arglist-close . c-lineup-arglist)
                                   (substatement-open . 0)
                                   (inline-open . 0)
                                   (comment-intro . 0)
                                   (case-label        . 4)
                                   (block-open        . 0)
                                   (knr-argdecl-intro . -)))
    (c-echo-syntactic-information-p . t))
  "Reasonable C style")

;; Customizations for all of c-mode, c++-mode, and objc-mode
(defun my-c-mode-common-hook ()
  ;; add my personal style and set it for the current buffer
  (c-add-style "PERSONAL" my-c-style t)
  ;; offset customizations not in my-c-style
  (c-set-offset 'member-init-intro '++)
  ;; other customizations
  (setq tab-width 4
        ;; this will make sure spaces are used instead of tabs
        indent-tabs-mode nil)
  ;; we like auto-newline and hungry-delete
  (c-toggle-auto-hungry-state 1)
  ;; keybindings for all supported languages.  We can put these in
  ;; c-mode-base-map because c-mode-map, c++-mode-map, objc-mode-map,
  ;; java-mode-map, and idl-mode-map inherit from it.
  (define-key c-mode-base-map "\C-m" 'newline-and-indent))

(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)

(defun no-tabs-hook ()
  (setq tab-width 4)
  (setq indent-tabs-mode nil))

(add-hook 'emacs-lisp-mode-hook 'no-tabs-hook)
(add-hook 'apache-mode-hook 'no-tabs-hook)

;;;;;;;;;;;;;;;;;;;;
;; Javascript
;;
(autoload 'javascript-mode "javascript" nil t)
(setq auto-mode-alist (append '(("\\.js$" . javascript-mode))
                              auto-mode-alist))
(add-hook 'javascript-mode-hook 'no-tabs-hook)

;;;;;;;;;;;;;;;;;;;;
;; LaTeX
;;
(setq tex-dvi-view-command "xdvi")
(add-hook 'tex-mode-hook 'no-tabs-hook)

;;;;;;;;;;;;;;;;;;;;
;; text
;;
(defun my-text-hook ()
  (setq tab-width 4)
  (auto-fill-mode 1)
  ;;(flyspell-mode 1)
  (setq indent-tabs-mode nil)
  (setq fill-column 65))
(add-hook 'text-mode-hook 'my-text-hook)

;;;;;;;;;;;;;;;;;;;;
;; perl
;;
(add-hook 'perl-mode-hook 'no-tabs-hook)

;;;;;;;;;;;;;;;;;;;;
;; make
;;
(defun my-makefile-hook ()
  (setq tab-width 4))
(add-hook 'makefile-mode-hook 'my-makefile-hook)


;;;;;;;;;;;;;;;;;;;;
;; python
;;
;;;(autoload 'python-mode "python-mode" "Python editing mode." t)
;;;(setq auto-mode-alist
;;;      (cons '("\\.py$" . python-mode) auto-mode-alist))
;;;(setq interpreter-mode-alist
;;;      (cons '("python" . python-mode)
;;;            interpreter-mode-alist))
(add-hook 'python-mode-hook 'no-tabs-hook)

;;;;;;;;;;;;;;;;;;;;
;; asymptote
;;
;; (add-to-list 'load-path "/usr/local/share/asymptote")
;; (autoload 'asy-mode "asy-mode.el" "Asymptote major mode." t)
;; (autoload 'lasy-mode "asy-mode.el" "hybrid Asymptote/Latex major mode." t)
;; (autoload 'asy-insinuate-latex "asy-mode.el" "Asymptote insinuate LaTeX." t)
;; (add-to-list 'auto-mode-alist '("\\.asy$" . asy-mode))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; fonts
;;
(require 'font-lock)
(add-hook 'emacs-lisp-mode-hook  'turn-on-font-lock)
(add-hook 'lisp-mode-hook    'turn-on-font-lock)
(add-hook 'c-mode-hook       'turn-on-font-lock)
(add-hook 'c++-mode-hook     'turn-on-font-lock)
(add-hook 'perl-mode-hook    'turn-on-font-lock)
(add-hook 'tex-mode-hook     'turn-on-font-lock)
(add-hook 'texinfo-mode-hook 'turn-on-font-lock)
(add-hook 'postscript-mode-hook  'turn-on-font-lock)
(add-hook 'dired-mode-hook   'turn-on-font-lock)
(add-hook 'ada-mode-hook     'turn-on-font-lock)
(add-hook 'makefile-mode-hook     'turn-on-font-lock)
(add-hook 'tcl-mode-hook     'turn-on-font-lock)
(add-hook 'sgml-mode-hook     'turn-on-font-lock)
(add-hook 'html-mode-hook     'turn-on-font-lock)
(add-hook 'sql-mode-hook     'turn-on-font-lock)
(add-hook 'python-mode-hook     'turn-on-font-lock)
(add-hook 'post-mode-hook     'turn-on-font-lock)
(add-hook 'metapost-mode-hook     'turn-on-font-lock)
(add-hook 'javascript-mode-hook     'turn-on-font-lock)
(add-hook 'org-mode-hook 'turn-on-font-lock) 
(add-hook 'wikipedia-mode-hook     'turn-on-font-lock)
(set-face-foreground 'font-lock-string-face "darkgreen")

;;(set-frame-font "Inconsolata-17" nil)
;;     "-apple-inconsolata-medium-r-normal--17-130-72-72-m-130-iso10646-1")
;;(setq line-spacing 2)

(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.
 '(blink-cursor-mode t)
 '(canlock-password "79214df57f8c9239a8b3ef1ad1785fa3e8277cc7")
 '(gud-gdb-command-name "gdb --annotate=1")
 '(large-file-warning-threshold nil)
 '(line-spacing 2)
 '(org-agenda-files (quote ("~/hp/scenarios.org" "~/hp/lei.org" "~/hp/vc.org" "~/tech/pipeline/pipeline.org" "~/hp/prg/amperexl.org" "~/hp/future.org" "~/hp/market.org" "~/hp/heads.org" "/Users/juanre/hp/hp.org" "~/cjr/cjr.org" "~/cjr/jac/jac.org" "~/hp/design.org" "~/hp/scitex.org" "~/hp/multilevel.org" "~/src/prj/phototag/phototag.org" "~/src/web/unarueda/org/unarueda.org" "~/cjr/write/write.org" "~/cjr/draft/draft.org")))
 '(org-format-latex-options (quote (:foreground default :background default :scale 1.1 :html-foreground "Black" :html-background "Transparent" :html-scale 1.07 :matchers ("begin" "$1" "$" "$$" "\\(" "\\["))))
 '(paren-match-face (quote paren-face-match-light))
 '(paren-sexp-mode t)
 '(ps-n-up-printing 2)
 '(ps-paper-type (quote a4))
 '(safe-local-variable-values (quote ((org-attach-directory . "~/tech/_doc/") (org-attach-directory . "~/tech/doc/") (Syntax . ANSI-Common-Lisp) (Base . 10) (org-export-html-postamble . "<center><font color='red'><b>HP Confidential</b></font></center>"))))
 '(visible-cursor t))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; diary - obsolete.  Use org-mode
;;;
;;; (setq calendar-week-start-day 1)
;;; (setq cal-tex-24 't)
;;; (setq mark-holidays-in-calendar 't)
;;; (setq european-calendar-style 't)
;;; (setq today-visible-calendar-hook 'calendar-mark-today)
;;; (diary)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; big brother database
;;;
;;; (add-to-list 'load-path "/usr/share/emacs/site-lisp/bbdb/lisp")
;;; (require 'bbdb)
;;; (bbdb-initialize)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Windows stuff
;;;
;;; (defvar mswindows-p (string-match "windows" (symbol-name system-type)))
;;; (require 'gnuserv)
;;; (gnuserv-start)

;;; Emacs 23 (from http://emacsformacosx.com/)
(setq mac-command-modifier 'meta
      mac-option-modifier 'none)
(set-cursor-color "black")
(setq-default cursor-type 'bar
              transient-mark-mode nil)

(setq initial-frame-alist '((top . 25) (left . 922)
                            (width . 90) (height . 62))
      default-frame-alist '((top . 25) (left . 330)
                            (width . 90) (height . 62)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Hidden backup files
(defun make-backup-file-name (filename)
  (defvar backups-dir "./.emacs-bu/")
  (make-directory backups-dir t)
  (expand-file-name (concat backups-dir (file-name-nondirectory filename) "~")
                    (file-name-directory filename)))

(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.
 '(default ((t (:stipple nil :background "white" :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 170 :width normal :foundry "apple" :family "Inconsolata"))))
 '(cursor ((t (:inverse-video nil))))
 '(org-meta-line ((t (:inherit font-lock-comment-face :foreground "gray"))))
 '(org-table ((((class color) (min-colors 88) (background light)) (:foreground "Medium Blue")))))