Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you are using AUCTeX (you should be) then you may want to check out <code>LaTeX-indent-environment-list</code>. Adding an environment to this variable will make it so that (among other things) M-q doesn't refill the paragraph. Unfortunately it doesn't seem work for auto-fill-mode. The following largely untested code added to <code>LaTeX-mode-hook</code> might do what you want. </p> <pre><code>(setq auto-fill-function (lambda () (unless (&gt; (save-excursion (or (search-backward "%%% BEGIN NO FILL" (point-min) t) 0)) (save-excursion (or (search-backward "%%% END NO FILL" (point-min) t) 0))) (do-auto-fill)))) </code></pre> <p>It's very stupid and inefficient, but seems to be fast enough on my machine. It doesn't allow nesting, and requires that you manually mark up all sections that you don't want filled. What I am thinking of adding to my .emacs (until I read your question I didn't realize how much this bugged me) is below which keys off of the current environment so there is no need for special markup (though it only looks at the innermost environment (I'm not sure how much of a problem that will cause in practice)). Combining the two is left as an exercise to the interested reader.</p> <pre><code>;; You can use the following to unset the variables and play around with them ;; (makunbound 'auto-fill-ignore-environments) ;; (makunbound 'auto-fill-ignore-environments-regexp) (defcustom auto-fill-ignore-environments (mapcar 'car LaTeX-indent-environment-list) "List of environments for which `auto-fill-mode' should be disabled. Used to generate `auto-fill-ignore-environments-regexp'." :type '(sexp) ) (defcustom auto-fill-ignore-environments-regexp (regexp-opt auto-fill-ignore-environments) "Regexp matching LaTeX environments for which `auto-fill-mode' should be disabled. If not set, automatically generated from `auto-fill-ignore-environments'" :type '(string) :set-after '(auto-fill-ignore-environments) ) (add-hook 'LaTeX-mode-hook (lambda () (setq auto-fill-function (lambda () (unless (string-match auto-fill-ignore-environments-regexp (LaTeX-current-environment)) (do-auto-fill)))))) </code></pre> <p>I have never used defcustom before so I'm sure that part could be improved quite a bit.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload