parent
495561982d
commit
f4dbbea943
|
@ -2,6 +2,13 @@
|
|||
;; FUNCTIONS
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defun add-hook-and-eval (hook function)
|
||||
"Add FUNCTION to HOOK and evaluate it.
|
||||
This can be useful when called from a hooked function to make
|
||||
sure it gets executed."
|
||||
(add-hook hook function)
|
||||
(funcall function))
|
||||
|
||||
(defun call-process-to-string (program &rest args)
|
||||
"Call PROGRAM with ARGS and return output."
|
||||
(with-output-to-string
|
||||
|
|
|
@ -89,7 +89,9 @@ restored."
|
|||
(local-set-key (kbd "C-M-e") (lambda () (interactive) (c-beginning-of-defun -1))))))
|
||||
'(c-mode-hook c++-mode-hook))
|
||||
|
||||
;; Note: cc-modes do not need to run hooks for first buffer, since their hook are run twice already.
|
||||
;; WARNING: cc-modes do not need to run hooks for first buffer, since their hook
|
||||
;; are run twice already. This behaviour may change in future Emacs version, in
|
||||
;; which case we need to use add-hook-and-eval instead.
|
||||
|
||||
;;==============================================================================
|
||||
;; Qt semantic support
|
||||
|
|
|
@ -39,49 +39,33 @@
|
|||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; LaTeX setup
|
||||
|
||||
(add-hook
|
||||
(add-hook-and-eval
|
||||
'latex-mode-hook
|
||||
(lambda ()
|
||||
(setq tex-extension-list
|
||||
'("aux" "glg" "glo" "gls" "idx" "ilg" "ind" "lof" "log" "nav" "out" "snm" "synctex" "synctex.gz" "tns" "toc" "xdy"))
|
||||
(setq tex-default-compiler "pdflatex")
|
||||
(tex-set-compiler)
|
||||
(local-set-key (kbd "M-RET") 'latex-itemize)
|
||||
(local-set-key (kbd "C-c C-a") 'latex-article)
|
||||
(local-set-key (kbd "C-c C-e") 'latex-emph)
|
||||
(local-set-key (kbd "C-c C-s") 'latex-section)
|
||||
(local-set-key (kbd "C-c C-p") 'latex-paragraph)
|
||||
(local-set-key (kbd "C-c C-l") 'latex-slanted)
|
||||
(turn-on-orgtbl)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; The magnificent latex-math-preview mode!
|
||||
;; TODO: some symbols are not generated properly.
|
||||
(autoload 'latex-math-preview-expression "latex-math-preview" nil t)
|
||||
(autoload 'latex-math-preview-insert-symbol "latex-math-preview" nil t)
|
||||
(autoload 'latex-math-preview-save-image-file "latex-math-preview" nil t)
|
||||
(autoload 'latex-math-preview-beamer-frame "latex-math-preview" nil t)
|
||||
(autoload 'latex-math-preview-text-symbol-datasets "latex-math-preview" nil t)
|
||||
|
||||
(setq latex-math-preview-cache-directory-for-insertion
|
||||
(concat emacs-cache-folder "latex-math-preview-cache"))
|
||||
|
||||
;; Extra for latex-math-preview-mode.
|
||||
;; TODO: latex-math-preview-mode extra does not work.
|
||||
(require 'latex-math-preview-extra-data nil t)
|
||||
(add-hook
|
||||
'latex-mode-hook
|
||||
(lambda ()
|
||||
;; (local-set-key (kbd "C-c p") 'latex-math-preview-expression)
|
||||
;; (local-set-key (kbd "C-c C-p") 'latex-math-preview-save-image-file)
|
||||
(local-set-key (kbd "C-c j") 'latex-math-preview-insert-symbol)
|
||||
(local-set-key (kbd "C-c C-j") 'latex-math-preview-last-symbol-again)
|
||||
;; (local-set-key (kbd "C-c C-b") 'latex-math-preview-beamer-frame)
|
||||
;; (add-to-list 'latex-math-preview-text-symbol-datasets
|
||||
;; latex-math-preview-textcomp-symbol-data)
|
||||
;; (add-to-list 'latex-math-preview-text-symbol-datasets
|
||||
;; latex-math-preview-pifont-zapf-dingbats-symbol-data)
|
||||
;; (add-to-list 'latex-math-preview-text-symbol-datasets
|
||||
;; latex-math-preview-pifont-symbol-fonts-symbol-data)))
|
||||
))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Skeletons
|
||||
|
||||
(define-skeleton latex-emph "Insert emph command." nil "\\emph{" _ "}")
|
||||
(define-skeleton latex-slanted "Insert textsl command." nil "\\textsl{" _ "}")
|
||||
|
||||
(define-skeleton latex-paragraph "Insert paragraph command." nil "\\paragraph{" _ "}" \n)
|
||||
(define-skeleton latex-subparagraph "Insert subparagraph command." nil "\\subparagraph{" _ "}" \n)
|
||||
|
||||
(define-skeleton latex-section "Insert section command." nil "\\section{" _ "}" \n)
|
||||
(define-skeleton latex-subsection "Insert section command." nil "\\subsection{" _ "}" \n)
|
||||
(define-skeleton latex-subsubsection "Insert section command." nil "\\subsubsection{" _ "}" \n)
|
||||
|
||||
(define-skeleton latex-article
|
||||
"Insert article template."
|
||||
|
@ -265,5 +249,35 @@
|
|||
\\newcommand{\\includecode}[2][custom]{
|
||||
\\lstinputlisting[caption=#2, escapechar=, style=#1]{#2}}" \n)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; The magnificent latex-math-preview mode!
|
||||
;; TODO: some symbols are not generated properly.
|
||||
(autoload 'latex-math-preview-expression "latex-math-preview" nil t)
|
||||
(autoload 'latex-math-preview-insert-symbol "latex-math-preview" nil t)
|
||||
(autoload 'latex-math-preview-save-image-file "latex-math-preview" nil t)
|
||||
(autoload 'latex-math-preview-beamer-frame "latex-math-preview" nil t)
|
||||
(autoload 'latex-math-preview-text-symbol-datasets "latex-math-preview" nil t)
|
||||
|
||||
(setq latex-math-preview-cache-directory-for-insertion
|
||||
(concat emacs-cache-folder "latex-math-preview-cache"))
|
||||
|
||||
;; Extra for latex-math-preview-mode.
|
||||
;; TODO: latex-math-preview-mode extra does not work.
|
||||
(require 'latex-math-preview-extra-data nil t)
|
||||
(add-hook
|
||||
'latex-mode-hook
|
||||
(lambda ()
|
||||
;; (local-set-key (kbd "C-c p") 'latex-math-preview-expression)
|
||||
;; (local-set-key (kbd "C-c C-p") 'latex-math-preview-save-image-file)
|
||||
(local-set-key (kbd "C-c j") 'latex-math-preview-insert-symbol)
|
||||
(local-set-key (kbd "C-c C-j") 'latex-math-preview-last-symbol-again)
|
||||
;; (local-set-key (kbd "C-c C-b") 'latex-math-preview-beamer-frame)
|
||||
;; (add-to-list 'latex-math-preview-text-symbol-datasets
|
||||
;; latex-math-preview-textcomp-symbol-data)
|
||||
;; (add-to-list 'latex-math-preview-text-symbol-datasets
|
||||
;; latex-math-preview-pifont-zapf-dingbats-symbol-data)
|
||||
;; (add-to-list 'latex-math-preview-text-symbol-datasets
|
||||
;; latex-math-preview-pifont-symbol-fonts-symbol-data)))
|
||||
))
|
||||
|
||||
(provide 'mode-latex)
|
||||
|
|
|
@ -7,13 +7,11 @@
|
|||
;; Allow comment indentation.
|
||||
(setq sh-indent-comment t)
|
||||
|
||||
(add-hook
|
||||
(add-hook-and-eval
|
||||
'sh-mode-hook
|
||||
(lambda ()
|
||||
(set (make-local-variable 'compile-command) (concat sh-shell-file " " buffer-file-name))) )
|
||||
|
||||
(run-mode-hooks 'sh-mode-hook)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(define-skeleton sh-for
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
"This is the name of the executable called upon TeX compilations.
|
||||
Examples: pdftex, pdflatex, xetex, xelatex, luatex, lualatex...
|
||||
|
||||
If value is nil, the compiler will be tex-default-compiler for
|
||||
If value is nil, the compiler will be `tex-default-compiler' for
|
||||
TeX mode, and latex-default-compiler for LaTeX mode."
|
||||
:safe 'stringp)
|
||||
|
||||
|
@ -47,6 +47,7 @@ Note that -shell-escape can also be toggled with universal
|
|||
argument."
|
||||
:safe 'stringp)
|
||||
|
||||
;; TODO: test tex-startcommands.
|
||||
(defcustom tex-startcommands ""
|
||||
"You can call a TeX compiler upon a string instead of a file.
|
||||
This is actually useful if you want to customize your
|
||||
|
@ -81,9 +82,9 @@ empty.")
|
|||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; FUNCTIONS
|
||||
(defun tex-set-compiler ()
|
||||
"Use compile to process your TeX-based document. Use a prefix
|
||||
argument to call the compiler along the '-shell-escape'
|
||||
option. This will enable the use of '\write18{<external
|
||||
"Set `compile-command' for TeX-based document.
|
||||
Use a prefix argument to append the '-shell-escape' option to the
|
||||
compile options. This will enable the use of '\write18{<external
|
||||
command>}' from within TeX documents, which need to allow
|
||||
external application to be called from TeX.
|
||||
|
||||
|
@ -138,6 +139,7 @@ but there is no warranty."
|
|||
(defun tex-pdf-compress ()
|
||||
"Use `masterfile' variable as default value for `pdf-compress'."
|
||||
(interactive)
|
||||
(require 'tool-pdf)
|
||||
(hack-local-variables)
|
||||
(let ((local-master (if (not masterfile) buffer-file-name masterfile)))
|
||||
(pdf-compress local-master)))
|
||||
|
@ -145,6 +147,7 @@ but there is no warranty."
|
|||
(defun tex-pdf-view ()
|
||||
"Use `masterfile' variable as default value for `pdf-view'."
|
||||
(interactive)
|
||||
(require 'tool-pdf)
|
||||
(hack-local-variables)
|
||||
(let ((local-master (if (not masterfile) buffer-file-name masterfile)))
|
||||
(pdf-view local-master)))
|
||||
|
@ -152,7 +155,7 @@ but there is no warranty."
|
|||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; TeX setup
|
||||
|
||||
(add-hook
|
||||
(add-hook-and-eval
|
||||
'tex-mode-hook
|
||||
(lambda ()
|
||||
(dolist (key '("\C-c\C-f" "\C-c\C-b"))
|
||||
|
@ -166,7 +169,4 @@ but there is no warranty."
|
|||
(local-set-key (kbd "<f9>") 'tex-pdf-view)
|
||||
(tex-set-compiler)))
|
||||
|
||||
;; TODO: why is run-hooks needed for tex-mode only?
|
||||
;; (run-hooks 'tex-mode-hook)
|
||||
|
||||
(provide 'mode-tex)
|
||||
|
|
Loading…
Reference in New Issue