(defun goto-last-edit-point () "Go to the last point where editing occurred." (interactive) (let ((undos buffer-undo-list)) (when (listp undos) (while (and undos (let ((pos (or (cdr-safe (car undos)) (car undos)))) (not (and (integerp pos) (goto-char (abs pos)))))) (setq undos (cdr undos)))))) ;;(global-set-key (kbd "C-c SPC") 'goto-last-edit-point) (global-set-key (kbd "C-q") 'goto-last-edit-point) (setq load-path (cons "/home/chengtie/Scripts/ocaml.emacs" load-path)) (setq load-path (cons "/home/chengtie/Scripts/tuareg-2.0.6" load-path)) (setq auto-mode-alist (cons '("\\.v$" . coq-mode) auto-mode-alist)) (autoload 'coq-mode "coq" "Major mode for editing Coq vernacular." t) (setq auto-mode-alist (cons '("\\.ml[iylp]?" . caml-mode) auto-mode-alist)) ;; for if;; (autoload 'caml-mode "ocaml" (interactive) "Major mode for editing Caml code." t) ;; for if;; (autoload 'run-caml "inf-caml" "Run an inferior Caml process." t) ;; for if;; (if window-system (require 'caml-font)) (autoload 'camldebug "camldebug" (interactive) "Run the Caml debugger" t) (autoload 'tuareg-mode "tuareg" "Major mode for editing Caml code" t) ;; for if;; (setq auto-mode-alist (cons '("\\.ml\\w?" . tuareg-mode) auto-mode-alist)) ;; for if;; (autoload 'tuareg-mode "tuareg" "Major mode for editing Caml code" t) (setq inhibit-startup-message t) (setq inhibit-startup-screen t) (setq inhibit-splash-screen t) (setq tuareg-in-indent 0) (setq TeX-auto-save t) (setq TeX-parse-self t) (setq TeX-save-query nil) (setq-default TeX-master nil) ;;http://inthearmchair.wordpress.com/2010/09/02/latex-inverse-pdf-search-with-emacs/ C-c C-c LaTex, then C-c C-v for 1st time and afterwords begin (require 'server) (or (server-running-p) (server-start)) (add-hook 'LaTeX-mode-hook 'TeX-PDF-mode) ;;;'(LaTeX-command "latex -synctex=1") ;;; Okular as default. (defun pdf-with-okular () (add-to-list 'TeX-output-view-style (quote ("^pdf$" "." "okular %o %(outpage)")))) (add-hook 'LaTeX-mode-hook 'pdf-with-okular t) ;; end ;; begin to set okular by default of C-c C-c Command View, then change to okular spread.pdf, then C-c C-c Command LaTeX works repeatly afterwords (setq TeX-view-program-list '(("Okular" "okular %o"))) (setq TeX-view-program-selection '((output-pdf "Okular") (output-dvi "Okular"))) ;; end ;; begin http://stackoverflow.com/questions/3300497/using-minted-source-code-latex-package-with-emacs-auctex (eval-after-load "tex" '(setcdr (assoc "LaTeX" TeX-command-list) '("%`%l%(mode) -shell-escape%' %t" TeX-run-TeX nil (latex-mode doctex-mode) :help "Run LaTeX") ) ) ;; end (setq x-select-enable-clipboard t) (load-library "paren") (show-paren-mode 1) (setq flyspell-issue-welcome-flag nil) ;; fix for Ubuntu 10.10 problem ;;(windmove-default-keybindings) (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-command "latex -synctex=1") '(cua-mode t nil (cua-base)) '(show-paren-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. '(default ((t (:inherit nil :stipple nil :background "white" :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 113 :width normal :foundry "unknown" :family "DejaVu Sans Mono"))))) (setenv "OCAMLRUNPARAM" "b") (defun caml-change-error-alist-for-backtraces () "Hook to change the compilation-error-regexp-alist variable, to search the ocaml backtraces for error locations" (interactive) (progn (setq compilation-error-regexp-alist-alist (append '((caml-backtrace "^ *\\(?:Raised at\\|Called from\\) file \\(\"?\\)\\([^,\" \n\t<>]+\\)\\1,\ lines? \\([0-9]+\\)-?\\([0-9]+\\)?\\(?:$\\|,\ \\(?: characters? \\([0-9]+\\)-?\\([0-9]+\\)?:?\\)?\\)" 2 (3 . 4) (5 . 6))) compilation-error-regexp-alist-alist)) (setq compilation-error-regexp-alist (append compilation-error-regexp-alist '(caml-backtrace))))) (add-hook 'caml-mode-hook 'caml-change-error-alist-for-backtraces) (add-hook 'tuareg-mode-hook 'caml-change-error-alist-for-backtraces) (defun caml-change-error-alist-for-assert-failure () "Hook to change the compilation-error-regexp-alist variable, to search the assert failure messages for error locations" (interactive) (progn (setq compilation-error-regexp-alist-alist (append '((caml-assert-failure "Assert_failure(\"\\([^,\" \n\t<>]+\\)\", \\([0-9]+\\), \\([0-9]+\\))" 1 2 3)) compilation-error-regexp-alist-alist)) (setq compilation-error-regexp-alist (append compilation-error-regexp-alist '(caml-assert-failure))))) (add-hook 'caml-mode-hook 'caml-change-error-alist-for-assert-failure) (add-hook 'tuareg-mode-hook 'caml-change-error-alist-for-assert-failure)