Emacs config utilizing prelude as a base
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
2.7 KiB

13 years ago
  1. ;;; prelude-latex.el --- Emacs Prelude: Sane setup for LaTeX writers.
  2. ;;
  3. ;; Copyright © 2011-2013 Bozhidar Batsov
  4. ;;
  5. ;; Author: Bozhidar Batsov <bozhidar@batsov.com>
  6. ;; URL: https://github.com/bbatsov/prelude
  7. ;; Version: 1.0.0
  8. ;; Keywords: convenience
  9. ;; This file is not part of GNU Emacs.
  10. ;;; Commentary:
  11. ;; Nice defaults for the premium LaTeX editing mode auctex.
  12. ;;; License:
  13. ;; This program is free software; you can redistribute it and/or
  14. ;; modify it under the terms of the GNU General Public License
  15. ;; as published by the Free Software Foundation; either version 3
  16. ;; of the License, or (at your option) any later version.
  17. ;;
  18. ;; This program is distributed in the hope that it will be useful,
  19. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. ;; GNU General Public License for more details.
  22. ;;
  23. ;; You should have received a copy of the GNU General Public License
  24. ;; along with GNU Emacs; see the file COPYING. If not, write to the
  25. ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  26. ;; Boston, MA 02110-1301, USA.
  27. ;;; Code:
  28. (prelude-require-packages '(auctex cdlatex))
  29. (require 'smartparens-latex)
  30. ;; for case
  31. (require 'cl)
  32. (eval-after-load "company"
  33. '(progn
  34. (prelude-require-packages '(company-auctex))
  35. (company-auctex-init)))
  36. (defcustom prelude-latex-fast-math-entry 'LaTeX-math-mode
  37. "Method used for fast math symbol entry in LaTeX."
  38. :link '(function-link :tag "AUCTeX Math Mode" LaTeX-math-mode)
  39. :link '(emacs-commentary-link :tag "CDLaTeX" "cdlatex.el")
  40. :group 'prelude
  41. :type '(choice (const :tag "None" nil)
  42. (const :tag "AUCTeX Math Mode" LaTeX-math-mode)
  43. (const :tag "CDLaTeX" cdlatex)))
  44. ;; AUCTeX configuration
  45. (setq TeX-auto-save t)
  46. (setq TeX-parse-self t)
  47. (setq-default TeX-master nil)
  48. ;; use pdflatex
  49. (setq TeX-PDF-mode t)
  50. ;; sensible defaults for OS X, other OSes should be covered out-of-the-box
  51. (when (eq system-type 'darwin)
  52. (setq TeX-view-program-selection
  53. '((output-dvi "DVI Viewer")
  54. (output-pdf "PDF Viewer")
  55. (output-html "HTML Viewer")))
  56. (setq TeX-view-program-list
  57. '(("DVI Viewer" "open %o")
  58. ("PDF Viewer" "open %o")
  59. ("HTML Viewer" "open %o"))))
  60. (defun prelude-latex-mode-defaults ()
  61. "Default Prelude hook for `LaTeX-mode'."
  62. (turn-on-auto-fill)
  63. (abbrev-mode +1)
  64. (smartparens-mode +1)
  65. (case prelude-latex-fast-math-entry
  66. (LaTeX-math-mode (LaTeX-math-mode 1))
  67. (cdlatex (turn-on-cdlatex))))
  68. (setq prelude-latex-mode-hook 'prelude-latex-mode-defaults)
  69. (add-hook 'LaTeX-mode-hook (lambda ()
  70. (run-hooks 'prelude-latex-mode-hook)))
  71. (provide 'prelude-latex)
  72. ;;; prelude-latex.el ends here