branch: externals/auctex commit d4059b8f49c2609369d694a8250d1df8641161c3 Author: Tassilo Horn <t...@gnu.org> Commit: Tassilo Horn <t...@gnu.org>
Improve line wrap removal heuristics. * tex-buf.el (TeX-format-filter): Remove linebreaks at columns 79 and also column 80. Also remove linebreaks preceded by a period that are followed by a word character to remove linebreaks in file names that are wrapped just after the period starting the file name extension. --- tex-buf.el | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) diff --git a/tex-buf.el b/tex-buf.el index c2c3ba6..e64c3a2 100644 --- a/tex-buf.el +++ b/tex-buf.el @@ -1176,15 +1176,17 @@ command." (goto-char pt) (insert-before-markers string) (set-marker (process-mark process) (point)) - ;; Remove line breaks at column 79 + ;; Remove line breaks at columns 79 and 80 (while (> (point) pt) (end-of-line 0) - (when (and (= (- (point) (line-beginning-position)) 79) - ;; Heuristic: Don't delete the linebreak if the - ;; next line is empty or starts with an opening - ;; parenthesis or if point is located after a period. + (when (and (memql (- (point) (line-beginning-position)) '(79 80)) + ;; Heuristic: Don't delete the linebreak if the next line + ;; is empty or starts with an opening parenthesis, or if + ;; point is located after a period and in the next line no + ;; word char follows. (not (memq (char-after (1+ (point))) '(?\n ?\())) - (not (eq (char-before) ?.))) + (not (and (eq (char-before) ?.) + (not (eq ?w (char-syntax (char-after (1+ (point))))))))) (delete-char 1))) (goto-char (marker-position (process-mark process))) ;; Determine current page