emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/yaml-mode 78b3ba5 095/124: fill while in a comment should


From: ELPA Syncer
Subject: [nongnu] elpa/yaml-mode 78b3ba5 095/124: fill while in a comment should behave as in text modes
Date: Sun, 29 Aug 2021 11:36:20 -0400 (EDT)

branch: elpa/yaml-mode
commit 78b3ba579f56f8a984c9cdaa56f3e730230840e9
Author: Tim Showalter <tjs@psaux.com>
Commit: Tim Showalter <tjs@psaux.com>

    fill while in a comment should behave as in text modes
    
    This fixes a bug in fill-paragraph that made adaptive fill not work
    while in a comment (probably the only time it matters in yaml-mode).
    
    This change does what lisp-mode does: first, try fill-comment-paragraph.
    If fill-comment-paragraph does the fill, great; we're in a comment, and
    the right thing happens.  If it returns nil, it can't do the fill, and
    we can fall back to the previous method.
    
    Without this change, a paragraph break inside a comment, or other things
    that adaptive fill would generally detect, are not respected.
---
 yaml-mode.el | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/yaml-mode.el b/yaml-mode.el
index c3416dd..9f76c38 100644
--- a/yaml-mode.el
+++ b/yaml-mode.el
@@ -438,13 +438,15 @@ otherwise do nothing."
 
 (defun yaml-fill-paragraph (&optional justify region)
   "Fill paragraph.
-This behaves as `fill-paragraph' except that filling does not
-cross boundaries of block literals."
+Outside of comments, this behaves as `fill-paragraph' except that
+filling does not cross boundaries of block literals.  Inside comments,
+this will do usual adaptive fill behaviors."
   (interactive "*P")
   (save-restriction
     (yaml-narrow-to-block-literal)
     (let ((fill-paragraph-function nil))
-      (fill-paragraph justify region))))
+      (or (fill-comment-paragraph justify)
+          (fill-paragraph justify region)))))
 
 (defun yaml-set-imenu-generic-expression ()
   (make-local-variable 'imenu-generic-expression)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]