GNU bug report logs - #68226
[PATCH] Improve block_node handling for yaml-ts-mode fill-paragraph

Previous Next

Package: emacs;

Reported by: Graham Marlow <graham <at> mgmarlow.com>

Date: Tue, 2 Jan 2024 22:12:02 UTC

Severity: normal

Tags: patch

Done: Yuan Fu <casouri <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Graham Marlow <graham <at> mgmarlow.com>
To: 68226 <at> debbugs.gnu.org
Subject: bug#68226: [PATCH] Improve block_node handling for yaml-ts-mode fill-paragraph
Date: Tue, 2 Jan 2024 14:10:53 -0800
[Message part 1 (text/plain, inline)]
Hello Emacs maintainers,

I noticed that the yaml-ts-mode fill-paragraph function doesn't play 
nicely with block nodes, making it difficult to tidy paragraphs. For 
example,

foo: |
  line-one
  line-two

Becomes

foo: | line-one line-two

Effectively undoing the block.

My proposed changes (see attached patch) fixes this behavior so that 
block nodes remain formatted correctly:

foo: |
  line-one line-two

It also plays nicely with longer pieces of text and multiple paragraphs.

I tried to base my changes off of the fill-paragraph function from 
c-ts-common, though the YAML version is much simpler since it doesn't 
need to account for comment insertion. I've not written a fill-paragraph 
function before so I'm sure I messed something up.

What do you think?
[0001-Improve-block_node-handling-for-yaml-ts-mode-fill-pa.patch (text/x-patch, attachment)]

This bug report was last modified 1 year and 136 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.