On my primary computer, I have the following set up for emacs and everything works like a charm. I use emacs cvs, auctex cvs, and latexmk on a Ubuntu 14.04. However, I just put the same set up on another computer running Ubuntu 14.04 but LaTeX files are opened in fundamental-mode
.
In my init I have:
;; 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/"))
;; Package initialize
(package-initialize)
;; 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-to-list 'load-path "~/.emacs.d/elpa/rainbow-delimiters-20150320.17")
(require 'rainbow-delimiters)
(global-rainbow-delimiters-mode)
(add-hook 'prog-mode-hook 'rainbow-delimiters-mode)
;; Adaptive wrap
(add-to-list 'load-path "~/.emacs.d/elpa/adaptive-wrap-0.5")
(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.
'(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"))) t)
'(TeX-view-program-selection (quote ((output-pdf "Okular"))) t)
'(compilation-auto-jump-to-first-error t)
'(inhibit-startup-screen t)
'(ispell-lazy-highlight nil)
'(server-mode t))
In my latexmkrc, I have
$pdflatex = 'pdflatex --shell-escape -interaction=nonstopmode %O %S
-file-line-error -synctex=1';
In my bash_aliases, I have the following
alias emacs='emacsclient -t -s server --alternate-editor='
alias ipython='ipython3'
Considering both set ups are identical running the same software, why wont this work on a different computer? I run into this problem every time I have to set back up emacs on any of my computers.
Messages received from C-h e
:
Loading paren...done
Starting Emacs daemon.
File mode specification error: (void-function pushnew)
File local-variables error: (void-function pushnew)
When done with a buffer, type C-x #
auctex.el
in your init file. If the problem is related to the AucTex mode being absent, I'd start by trying to locate auctex.el, which I suspect is absent from another computer. – wvxvw Mar 23 '15 at 8:30emacsclient
and thus Server (3) You havevisual-line-mode
enabled and thus Wrap. – Kaushal Modi Mar 23 '15 at 15:39C-h e
. Does that buffer list error or warning messages? If so, can you update your question with a list of those errors/warnings? – Kaushal Modi Mar 23 '15 at 15:55(load "auctex.el" nil t t)
has theNOERROR
argument asnil
. So Dustin should be seeing package loading errors ifauctex.el
(andpreview-latex.el
) are not found. – Kaushal Modi Mar 23 '15 at 15:56