Advertisement
Guest User

Untitled

a guest
Dec 18th, 2012
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.13 KB | None | 0 0
  1. (defun goto-last-edit-point ()
  2. "Go to the last point where editing occurred."
  3. (interactive)
  4. (let ((undos buffer-undo-list))
  5. (when (listp undos)
  6. (while (and undos
  7. (let ((pos (or (cdr-safe (car undos))
  8. (car undos))))
  9. (not (and (integerp pos)
  10. (goto-char (abs pos))))))
  11. (setq undos (cdr undos))))))
  12. ;;(global-set-key (kbd "C-c SPC") 'goto-last-edit-point)
  13. (global-set-key (kbd "C-q") 'goto-last-edit-point)
  14.  
  15. (setq load-path (cons "/home/chengtie/Scripts/ocaml.emacs" load-path))
  16. (setq load-path (cons "/home/chengtie/Scripts/tuareg-2.0.6" load-path))
  17.  
  18. (setq auto-mode-alist (cons '("\\.v$" . coq-mode) auto-mode-alist))
  19. (autoload 'coq-mode "coq" "Major mode for editing Coq vernacular." t)
  20.  
  21. (setq auto-mode-alist (cons '("\\.ml[iylp]?" . caml-mode) auto-mode-alist)) ;; for if;;
  22. (autoload 'caml-mode "ocaml" (interactive) "Major mode for editing Caml code." t) ;; for if;;
  23. (autoload 'run-caml "inf-caml" "Run an inferior Caml process." t) ;; for if;;
  24. (if window-system (require 'caml-font))
  25. (autoload 'camldebug "camldebug" (interactive) "Run the Caml debugger" t)
  26.  
  27. (autoload 'tuareg-mode "tuareg" "Major mode for editing Caml code" t)
  28. ;; for if;; (setq auto-mode-alist (cons '("\\.ml\\w?" . tuareg-mode) auto-mode-alist))
  29. ;; for if;; (autoload 'tuareg-mode "tuareg" "Major mode for editing Caml code" t)
  30.  
  31. (setq inhibit-startup-message t)
  32. (setq inhibit-startup-screen t)
  33. (setq inhibit-splash-screen t)
  34. (setq tuareg-in-indent 0)
  35.  
  36. (setq TeX-auto-save t)
  37. (setq TeX-parse-self t)
  38. (setq TeX-save-query nil)
  39. (setq-default TeX-master nil)
  40.  
  41. ;;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
  42. (require 'server)
  43. (or (server-running-p)
  44. (server-start))
  45. (add-hook 'LaTeX-mode-hook 'TeX-PDF-mode)
  46. ;;;'(LaTeX-command "latex -synctex=1")
  47. ;;; Okular as default.
  48. (defun pdf-with-okular ()
  49. (add-to-list 'TeX-output-view-style
  50. (quote ("^pdf$" "." "okular %o %(outpage)"))))
  51. (add-hook 'LaTeX-mode-hook 'pdf-with-okular t)
  52. ;; end
  53. ;; 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
  54. (setq TeX-view-program-list '(("Okular" "okular %o")))
  55. (setq TeX-view-program-selection '((output-pdf "Okular") (output-dvi "Okular")))
  56. ;; end
  57.  
  58. ;; begin http://stackoverflow.com/questions/3300497/using-minted-source-code-latex-package-with-emacs-auctex
  59. (eval-after-load "tex"
  60. '(setcdr (assoc "LaTeX" TeX-command-list)
  61. '("%`%l%(mode) -shell-escape%' %t"
  62. TeX-run-TeX nil (latex-mode doctex-mode) :help "Run LaTeX")
  63. )
  64. )
  65. ;; end
  66.  
  67. (setq x-select-enable-clipboard t)
  68.  
  69. (load-library "paren")
  70. (show-paren-mode 1)
  71.  
  72. (setq flyspell-issue-welcome-flag nil) ;; fix for Ubuntu 10.10 problem
  73.  
  74. ;;(windmove-default-keybindings)
  75.  
  76. (custom-set-variables
  77. ;; custom-set-variables was added by Custom.
  78. ;; If you edit it by hand, you could mess it up, so be careful.
  79. ;; Your init file should contain only one such instance.
  80. ;; If there is more than one, they won't work right.
  81. '(LaTeX-command "latex -synctex=1")
  82. '(cua-mode t nil (cua-base))
  83. '(show-paren-mode t))
  84. (custom-set-faces
  85. ;; custom-set-faces was added by Custom.
  86. ;; If you edit it by hand, you could mess it up, so be careful.
  87. ;; Your init file should contain only one such instance.
  88. ;; If there is more than one, they won't work right.
  89. '(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")))))
  90.  
  91. (setenv "OCAMLRUNPARAM" "b")
  92. (defun caml-change-error-alist-for-backtraces ()
  93. "Hook to change the compilation-error-regexp-alist variable, to
  94. search the ocaml backtraces for error locations"
  95. (interactive)
  96. (progn
  97. (setq compilation-error-regexp-alist-alist
  98. (append
  99. '((caml-backtrace
  100. "^ *\\(?:Raised at\\|Called from\\) file \\(\"?\\)\\([^,\" \n\t<>]+\\)\\1,\
  101. lines? \\([0-9]+\\)-?\\([0-9]+\\)?\\(?:$\\|,\
  102. \\(?: characters? \\([0-9]+\\)-?\\([0-9]+\\)?:?\\)?\\)"
  103. 2 (3 . 4) (5 . 6)))
  104. compilation-error-regexp-alist-alist))
  105. (setq compilation-error-regexp-alist
  106. (append compilation-error-regexp-alist '(caml-backtrace)))))
  107.  
  108. (add-hook 'caml-mode-hook 'caml-change-error-alist-for-backtraces)
  109. (add-hook 'tuareg-mode-hook 'caml-change-error-alist-for-backtraces)
  110.  
  111. (defun caml-change-error-alist-for-assert-failure ()
  112. "Hook to change the compilation-error-regexp-alist variable, to
  113. search the assert failure messages for error locations"
  114. (interactive)
  115. (progn
  116. (setq compilation-error-regexp-alist-alist
  117. (append
  118. '((caml-assert-failure
  119. "Assert_failure(\"\\([^,\" \n\t<>]+\\)\", \\([0-9]+\\), \\([0-9]+\\))"
  120. 1 2 3))
  121. compilation-error-regexp-alist-alist))
  122. (setq compilation-error-regexp-alist
  123. (append compilation-error-regexp-alist '(caml-assert-failure)))))
  124.  
  125. (add-hook 'caml-mode-hook 'caml-change-error-alist-for-assert-failure)
  126. (add-hook 'tuareg-mode-hook 'caml-change-error-alist-for-assert-failure)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement