From 8ffc9ba42958aa1cc8bce54e0191778008aeb92d Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 16 Nov 2020 19:27:54 -0500 Subject: [PATCH] Disable so-long if visual-line-mode is enabled Long lines are very common in text modes where visual-line-mode is enabled. --- core/core-editor.el | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/core/core-editor.el b/core/core-editor.el index e8e768816..ad4596e7f 100644 --- a/core/core-editor.el +++ b/core/core-editor.el @@ -561,18 +561,19 @@ files, so we replace calls to `pp' with the much faster `prin1'." ;; HACK Fix #2183: `so-long-detected-long-line-p' tries to parse comment ;; syntax, but in some buffers comment state isn't initialized, ;; leading to a wrong-type-argument: stringp error. - (let ((so-long-skip-leading-comments (bound-and-true-p comment-use-syntax)) - ;; HACK If visual-line-mode is on, then false positives are more - ;; likely, so up the threshold. More so in text-mode, since long - ;; paragraphs are the norm. - (so-long-threshold - (if visual-line-mode - (* so-long-threshold - (if (derived-mode-p 'text-mode) - 4 - 2)) - so-long-threshold))) - (so-long-detected-long-line-p))) + (unless (bound-and-true-p visual-line-mode) + (let ((so-long-skip-leading-comments (bound-and-true-p comment-use-syntax)) + ;; HACK If visual-line-mode is on, then false positives are more + ;; likely, so up the threshold. More so in text-mode, since long + ;; paragraphs are the norm. + (so-long-threshold + (if visual-line-mode + (* so-long-threshold + (if (derived-mode-p 'text-mode) + 4 + 2)) + so-long-threshold))) + (so-long-detected-long-line-p)))) (setq so-long-predicate #'doom-buffer-has-long-lines-p))