(require 'cc-styles) (require 'cc-cmds) (require 'cl) (require 'semantic) (require 'imenu) (require 'latex)
(require 'font-latex)
(require 'hideshow)
(setq c-style-variables-are-local-p nil)
(defun nix-setup-c-mode ()
"Set up C, C++ and Java mode.
This is run in the C-mode-common-hook to set up indentation and other
parameters on creation of buffers managed by cc-mode.el for Nix's personal coding style."
(c-add-style "nix" '((c-basic-offset . 1) (c-recognize-knr-p . nil) (c-comment-only-line-offset . (0 . 0)) (c-block-comment-prefix . "") (c-indent-comments-syntactically-p . t) (c-cleanup-list . (space-before-funcall compact-empty-funcall)) (c-electric-pound-behavior . 'alignleft) (defun-prompt-regexp . " ") (c-offsets-alist . ((defun-open . +)
(defun-close . 0)
(class-open . +)
(class-close . +)
(block-open . +)
(block-close . 0)
(case-label . +)
(statement-case-intro . +)
(inline-open . 3)
(inline-close . 0)
(extern-lang-open . +)
(extern-lang-close . +)
(access-label . 0)
(substatement-open . +)
(statement-cont . c-lineup-math)
(do-while-closure . 0)
(else-clause . 0))))))
(defun nix-clean-up-common-hook ()
"Clean up the common hook.
Removes the other style setup functions from the hook, so that they
only get run once, rather than repeatedly."
(remove-hook 'c-mode-common-hook 'nix-setup-c-mode)
(remove-hook 'c-mode-common-hook 'nix-clean-up-common-hook))
(defun nix-setup-this-c-mode-buffer ()
"Set up this buffer for C mode.
Things (like auto-hungry-state setting and style setting) that should not
be removed from the `c-mode-common-hook' after the first call by
`nix-clean-up-c-common-hook', but which should rather take effect
separately for each buffer."
(if (gawd-personal-code-p)
(progn
(c-make-styles-buffer-local t) (c-toggle-hungry-state 1)
(c-set-style "nix"))))
(add-hook 'c-mode-common-hook 'nix-setup-c-mode t)
(add-hook 'c-mode-common-hook 'nix-clean-up-common-hook t)
(add-hook 'c-mode-common-hook 'nix-setup-this-c-mode-buffer t)
(setq gawd-personal-code-regexp (concat "^" (getenv "HOME") "/src/"))
(setq-default fill-column 132 comment-column 48)
(if (not (memq 'comment-column desktop-locals-to-save))
(setq-default desktop-locals-to-save (append desktop-locals-to-save '(comment-column))))
(add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
(add-hook 'lisp-interaction-mode-hook 'turn-on-eldoc-mode)
(add-hook 'ielm-mode-hook 'turn-on-eldoc-mode)
(defvar nix-auto-htmlize-alist
`((,(concat (regexp-quote (expand-file-name "~/")) "/lisp/emacs/personal/.*\\.el$") . "/home/nix/public_html/emacs/personal/")
,(concat (regexp-quote (expand-file-name "~/")) "/lisp/emacs/site-wide/.*\\.el$") . "/home/nix/public_html/emacs/site-wide/")
"An alist stating what files to automatically HTMLize as they are saved.
It maps from regexps matching the names of files, to directories to put the
files in. A copy of the original file is saved there, too.")
(setq ediff-auto-refine-limit 100000)
(setq TeX-auto-save t
TeX-parse-self t
LaTeX-item-indent -6
TeX-style-private (list (expand-file-name "~/Docs/LaTeX/Styles/auto"))
TeX-debug-bad-boxes t
TeX-debug-warnings t
LaTeX-section-hook '(LaTeX-section-heading
LaTeX-section-title
LaTeX-section-toc
LaTeX-section-section
LaTeX-section-label))
(setq-default TeX-master nil)
(setq gawd-key-bind-alist
(nconc gawd-key-bind-alist
`((,hs-minor-mode-map
("A-h" . hs-hide-block)
("A-s" . 'hs-show-block)
("A-H" . 'hs-hide-all)
("A-S" . 'hs-show-all)
("A-R" . 'hs-show-region)))))
(provide 'init-prog-modes)