Last active
June 19, 2018 08:53
-
-
Save takaxp/fd8b1d7028856587bdd64d583f26e8d0 to your computer and use it in GitHub Desktop.
Suppress annoying messages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (with-eval-after-load "yatex" | |
| (put 'YaTeX-insert-braces 'begend-guide 2) | |
| (defun advice:YaTeX-insert-begin-end (env region-mode) | |
| "Insert \\begin{mode-name} and \\end{mode-name}. | |
| This works also for other defined begin/end tokens to define the structure." | |
| (setq YaTeX-current-completion-type 'begin) | |
| (let*((ccol (current-column)) beg beg2 exchange | |
| (_arg region-mode) ;for old compatibility | |
| (indent-column (+ ccol YaTeX-environment-indent))(_i 1) _func) | |
| (if (and region-mode (> (point) (mark))) | |
| (progn (exchange-point-and-mark) | |
| (setq exchange t | |
| ccol (current-column) | |
| indent-column (+ ccol YaTeX-environment-indent)))) | |
| ;;VER2 (insert "\\begin{" env "}" (YaTeX-addin env)) | |
| (setq beg (point)) | |
| (YaTeX-insert-struc 'begin env) | |
| (setq beg2 (point)) | |
| (insert "\n") | |
| (indent-to indent-column) | |
| (save-excursion | |
| ;;indent optional argument of \begin{env}, if any | |
| (while (> (point-beginning-of-line) beg) | |
| (skip-chars-forward "\\s " (point-end-of-line)) | |
| (indent-to indent-column) | |
| (forward-line -1))) | |
| (require 'yatexenv) | |
| (if region-mode | |
| ;;if region-mode, indent all text in the region | |
| (save-excursion | |
| (if (fboundp (intern-soft (concat "YaTeX-enclose-" env))) | |
| (funcall (intern-soft (concat "YaTeX-enclose-" env)) | |
| (point) (mark)) | |
| (while (< (progn (forward-line 1) (point)) (mark)) | |
| (if (eolp) nil | |
| (skip-chars-forward " \t\n") | |
| (indent-to indent-column)))))) | |
| (if region-mode (exchange-point-and-mark)) | |
| (indent-to ccol) | |
| ;;VER2 (insert "\\end{" env "}\n") | |
| (YaTeX-insert-struc 'end env) | |
| (YaTeX-reindent ccol) | |
| (if region-mode | |
| (progn | |
| (insert "\n") | |
| (or exchange (exchange-point-and-mark))) | |
| (goto-char beg2) | |
| (YaTeX-intelligent-newline nil) | |
| (YaTeX-indent-line)) | |
| (YaTeX-package-auto-usepackage env 'env) | |
| (if YaTeX-current-position-register | |
| (point-to-register YaTeX-current-position-register)))) | |
| (advice-add 'YaTeX-insert-begin-end | |
| :override #'advice:YaTeX-insert-begin-end)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment