Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;; Start server and set directory
- (setq server-socket-dir (format "/tmp/emacs1000"))
- ;; Not sure if (useruid) does anything or the difference between
- ;; (server-start) and '(server-mode t) in custom
- ;(setq server-socket-dir (format "/tmp/emacs1000" (user-uid)))
- ;(server-start)
- ;; Package list M-x package-list-packages
- (require 'package)
- (add-to-list 'package-archives
- '("marmelade" . "http://marmalade-repo.org/packages/"))
- (add-to-list 'package-archives
- '("melpa" . "http://melpa.milkbox.net/packages/"))
- (add-to-list 'package-archives
- '("elpa" . "http://tromey.com/elpa/"))
- ;; AucTex & RefTeX
- (add-to-list 'load-path "/usr/local/share/emacs/site-lisp/")
- (load "auctex.el" nil t t)
- (load "preview-latex.el" nil t t)
- (add-hook 'LaTeX-mode-hook 'turn-on-reftex)
- (setq reftex-plug-into-AUCTex t)
- (global-font-lock-mode t)
- (setq font-lock-maximum-decoration t)
- (setq TeX-auto-save t)
- (setq TeX-parse-self t)
- (setq-default TeX-master nil)
- (setq TeX-save-query nil)
- ;; Copy and paste between Emac instances
- (setq x-select-enable-clipboard t)
- (setq interprogram-paste-function 'x-cut-buffer-or-selection-value)
- ;; Disablin autosave
- (setq auto-save-default nil)
- ;; Adjusting tab distance
- (setq-default indent-tabs-mode nil)
- (setq-default tab-width 2)
- ;; Enable Line Numbering
- (setq line-number-mode t)
- (setq column-number-mode t)
- ;; Set the fill column
- (setq default-fill-column 80)
- ;; Turn on Auto Fill mode automatically in all modes
- ;; Auto-fill-mode the the automatic wrapping of lines and insertion of
- ;; newlines when the cursor goes over the column limit.
- ;; This should actually turn on auto-fill-mode by default in all major
- ;; modes. The other way to do this is to turn on the fill for specific modes
- ;; via hooks.
- (setq auto-fill-mode 1)
- ;; Turn on visual line mode
- (global-visual-line-mode t)
- ;; Prevent Emacs from making backup files
- (setq make-backup-files nil)
- ;; Cleverref setup
- (eval-after-load
- "latex"
- '(TeX-add-style-hook
- "cleveref"
- (lambda ()
- (if (boundp 'reftex-ref-style-alist)
- (add-to-list
- 'reftex-ref-style-alist
- '("Cleveref" "cleveref"
- (("\cref" ?c) ("\Cref" ?C) ("\cpageref" ?d) ("\Cpageref" ?D)))))
- (add-to-list 'reftex-ref-style-default-list "Cleveref")
- (TeX-add-symbols
- '("cref" TeX-arg-ref)
- '("Cref" TeX-arg-ref)
- '("cpageref" TeX-arg-ref)
- '("Cpageref" TeX-arg-ref)))))
- ;; Latexmk setup
- (defun run-latexmk ()
- (interactive)
- (let ((TeX-save-query nil)
- (TeX-process-asynchronous nil)
- (master-file (TeX-master-file)))
- (TeX-save-document "")
- (TeX-run-TeX "latexmk"
- (TeX-command-expand "latexmk -pdf %s" 'TeX-master-file)
- master-file))
- (if (plist-get TeX-error-report-switches (intern master-file))
- (TeX-next-error t)
- (progn
- (demolish-tex-help)
- (minibuffer-message "latexmk: done."))))
- (add-hook 'LaTeX-mode-hook
- (lambda ()
- (push
- '("Latexmk" "latexmk -pdf %s" TeX-run-TeX nil t
- :help "Run Latexmk on file")
- TeX-command-list)))
- ;; Set okular to open with C-c C-v view option
- (setq TeX-view-program-list
- '(("Okular" "okular --unique %u")))
- (setq TeX-view-program-selection '((output-pdf "Okular")))
- ;; Paren checking
- (load "paren")
- (add-hook 'prog-mode-hook 'rainbow-delimiters-mode)
- ;; Adaptive wrap
- ;(require 'adaptive-wrap)
- (when (fboundp 'adaptive-wrap-prefix-mode)
- (defun my-activate-adaptive-wrap-prefix-mode ()
- "Toggle `visual-line-mode' and `adaptive-wrap-prefix-mode' simultaneously."
- (if visual-line-mode
- (adaptive-wrap-prefix-mode 1)
- (adaptive-wrap-prefix-mode -1)))
- (add-hook 'visual-line-mode-hook 'my-activate-adaptive-wrap-prefix-mode))
- (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.
- '(LaTeX-indent-environment-list
- (quote
- (("verbatim" current-indentation)
- ("verbatim*" current-indentation)
- ("tabular" LaTeX-indent-tabular)
- ("tabular*" LaTeX-indent-tabular)
- ("align" LaTeX-indent-tabular)
- ("align*" LaTeX-indent-tabular)
- ("array" LaTeX-indent-tabular)
- ("eqnarray" LaTeX-indent-tabular)
- ("eqnarray*" LaTeX-indent-tabular)
- ("displaymath" current-indentation)
- ("equation")
- ("equation*")
- ("picture")
- ("tabbing")
- ("table")
- ("table*")
- ("cases" LaTeX-indent-tabular))))
- '(TeX-PDF-mode t)
- '(TeX-newline-function (quote newline-and-indent))
- '(TeX-show-compilation t)
- '(TeX-source-correlate-method (quote synctex))
- '(TeX-source-correlate-mode t)
- '(TeX-view-program-list (quote (("Okular" "okular -unique %o#src:%n%b"))))
- '(TeX-view-program-selection (quote ((output-pdf "Okular"))))
- '(compilation-auto-jump-to-first-error t)
- '(inhibit-startup-screen t)
- '(ispell-lazy-highlight nil)
- '(package-selected-packages (quote (rainbow-delimiters adaptive-wrap auto-indent-mode)))
- '(server-mode t))
- (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.
- )
- $pdflatex = 'pdflatex --shell-escape -interaction=nonstopmode -file-line-error -synctex=1' %O %S;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement