Advertisement
Guest User

Untitled

a guest
Mar 29th, 2015
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.39 KB | None | 0 0
  1. ;; Start server and set directory
  2. (setq server-socket-dir (format "/tmp/emacs1000"))
  3. ;; Not sure if (useruid) does anything or the difference between
  4. ;; (server-start) and '(server-mode t) in custom
  5. ;(setq server-socket-dir (format "/tmp/emacs1000" (user-uid)))
  6. ;(server-start)
  7.  
  8. ;; Package list M-x package-list-packages
  9. (require 'package)
  10. (add-to-list 'package-archives
  11. '("marmelade" . "http://marmalade-repo.org/packages/"))
  12. (add-to-list 'package-archives
  13. '("melpa" . "http://melpa.milkbox.net/packages/"))
  14. (add-to-list 'package-archives
  15. '("elpa" . "http://tromey.com/elpa/"))
  16.  
  17. ;; AucTex & RefTeX
  18. (add-to-list 'load-path "/usr/local/share/emacs/site-lisp/")
  19. (load "auctex.el" nil t t)
  20. (load "preview-latex.el" nil t t)
  21. (add-hook 'LaTeX-mode-hook 'turn-on-reftex)
  22. (setq reftex-plug-into-AUCTex t)
  23. (global-font-lock-mode t)
  24. (setq font-lock-maximum-decoration t)
  25. (setq TeX-auto-save t)
  26. (setq TeX-parse-self t)
  27. (setq-default TeX-master nil)
  28. (setq TeX-save-query nil)
  29.  
  30. ;; Copy and paste between Emac instances
  31. (setq x-select-enable-clipboard t)
  32. (setq interprogram-paste-function 'x-cut-buffer-or-selection-value)
  33.  
  34. ;; Disablin autosave
  35. (setq auto-save-default nil)
  36.  
  37. ;; Adjusting tab distance
  38. (setq-default indent-tabs-mode nil)
  39. (setq-default tab-width 2)
  40.  
  41. ;; Enable Line Numbering
  42. (setq line-number-mode t)
  43. (setq column-number-mode t)
  44.  
  45. ;; Set the fill column
  46. (setq default-fill-column 80)
  47.  
  48. ;; Turn on Auto Fill mode automatically in all modes
  49. ;; Auto-fill-mode the the automatic wrapping of lines and insertion of
  50. ;; newlines when the cursor goes over the column limit.
  51. ;; This should actually turn on auto-fill-mode by default in all major
  52. ;; modes. The other way to do this is to turn on the fill for specific modes
  53. ;; via hooks.
  54. (setq auto-fill-mode 1)
  55.  
  56. ;; Turn on visual line mode
  57. (global-visual-line-mode t)
  58.  
  59. ;; Prevent Emacs from making backup files
  60. (setq make-backup-files nil)
  61.  
  62. ;; Cleverref setup
  63. (eval-after-load
  64. "latex"
  65. '(TeX-add-style-hook
  66. "cleveref"
  67. (lambda ()
  68. (if (boundp 'reftex-ref-style-alist)
  69. (add-to-list
  70. 'reftex-ref-style-alist
  71. '("Cleveref" "cleveref"
  72. (("\cref" ?c) ("\Cref" ?C) ("\cpageref" ?d) ("\Cpageref" ?D)))))
  73. (add-to-list 'reftex-ref-style-default-list "Cleveref")
  74. (TeX-add-symbols
  75. '("cref" TeX-arg-ref)
  76. '("Cref" TeX-arg-ref)
  77. '("cpageref" TeX-arg-ref)
  78. '("Cpageref" TeX-arg-ref)))))
  79.  
  80. ;; Latexmk setup
  81. (defun run-latexmk ()
  82. (interactive)
  83. (let ((TeX-save-query nil)
  84. (TeX-process-asynchronous nil)
  85. (master-file (TeX-master-file)))
  86. (TeX-save-document "")
  87. (TeX-run-TeX "latexmk"
  88. (TeX-command-expand "latexmk -pdf %s" 'TeX-master-file)
  89. master-file))
  90. (if (plist-get TeX-error-report-switches (intern master-file))
  91. (TeX-next-error t)
  92. (progn
  93. (demolish-tex-help)
  94. (minibuffer-message "latexmk: done."))))
  95.  
  96. (add-hook 'LaTeX-mode-hook
  97. (lambda ()
  98. (push
  99. '("Latexmk" "latexmk -pdf %s" TeX-run-TeX nil t
  100. :help "Run Latexmk on file")
  101. TeX-command-list)))
  102.  
  103. ;; Set okular to open with C-c C-v view option
  104. (setq TeX-view-program-list
  105. '(("Okular" "okular --unique %u")))
  106. (setq TeX-view-program-selection '((output-pdf "Okular")))
  107.  
  108. ;; Paren checking
  109. (load "paren")
  110. (add-hook 'prog-mode-hook 'rainbow-delimiters-mode)
  111.  
  112. ;; Adaptive wrap
  113. ;(require 'adaptive-wrap)
  114.  
  115. (when (fboundp 'adaptive-wrap-prefix-mode)
  116. (defun my-activate-adaptive-wrap-prefix-mode ()
  117. "Toggle `visual-line-mode' and `adaptive-wrap-prefix-mode' simultaneously."
  118. (if visual-line-mode
  119. (adaptive-wrap-prefix-mode 1)
  120. (adaptive-wrap-prefix-mode -1)))
  121. (add-hook 'visual-line-mode-hook 'my-activate-adaptive-wrap-prefix-mode))
  122.  
  123. (custom-set-variables
  124. ;; custom-set-variables was added by Custom.
  125. ;; If you edit it by hand, you could mess it up, so be careful.
  126. ;; Your init file should contain only one such instance.
  127. ;; If there is more than one, they won't work right.
  128. '(LaTeX-indent-environment-list
  129. (quote
  130. (("verbatim" current-indentation)
  131. ("verbatim*" current-indentation)
  132. ("tabular" LaTeX-indent-tabular)
  133. ("tabular*" LaTeX-indent-tabular)
  134. ("align" LaTeX-indent-tabular)
  135. ("align*" LaTeX-indent-tabular)
  136. ("array" LaTeX-indent-tabular)
  137. ("eqnarray" LaTeX-indent-tabular)
  138. ("eqnarray*" LaTeX-indent-tabular)
  139. ("displaymath" current-indentation)
  140. ("equation")
  141. ("equation*")
  142. ("picture")
  143. ("tabbing")
  144. ("table")
  145. ("table*")
  146. ("cases" LaTeX-indent-tabular))))
  147. '(TeX-PDF-mode t)
  148. '(TeX-newline-function (quote newline-and-indent))
  149. '(TeX-show-compilation t)
  150. '(TeX-source-correlate-method (quote synctex))
  151. '(TeX-source-correlate-mode t)
  152. '(TeX-view-program-list (quote (("Okular" "okular -unique %o#src:%n%b"))))
  153. '(TeX-view-program-selection (quote ((output-pdf "Okular"))))
  154. '(compilation-auto-jump-to-first-error t)
  155. '(inhibit-startup-screen t)
  156. '(ispell-lazy-highlight nil)
  157. '(package-selected-packages (quote (rainbow-delimiters adaptive-wrap auto-indent-mode)))
  158. '(server-mode t))
  159. (custom-set-faces
  160. ;; custom-set-faces was added by Custom.
  161. ;; If you edit it by hand, you could mess it up, so be careful.
  162. ;; Your init file should contain only one such instance.
  163. ;; If there is more than one, they won't work right.
  164. )
  165.  
  166. $pdflatex = 'pdflatex --shell-escape -interaction=nonstopmode -file-line-error -synctex=1' %O %S;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement