Repository navigation
Fix title editing mangling titles and block delimiters - #89
Merged
Merged
Conversation
adoc-title-descriptor decided whether a one-line title was enclosed (`== Title ==`) from match group 3, which also holds the line's trailing newline. Every title followed by a newline therefore looked enclosed, and promoting, demoting or adjusting it added a closing delimiter. Group 4 holds just the trailing delimiter. The existing specs only used titles at the end of the buffer, which hid this.
adoc-promote-title and adoc-demote-title are documented to treat a nil ARG as 1, but only the interactive spec supplied it, so a Lisp call without an argument either did nothing or signalled wrong-type-argument in `(- nil)'. Point not being on a title is the user's mistake, so report it with user-error.
Highlighting, heading navigation and imenu only recognise two-line (setext) titles when they're enabled, but adoc-title-descriptor, which the editing commands go through, always did. With the option off (the default) any line above a block delimiter passed for a title, so M-left on `.Example' above `----' rewrote the delimiter as `~~~~~~~~', and C-c C-t deleted it. The descriptor now skips two-line titles unless they're enabled, and C-c C-t refuses to create one while they're disabled, or deeper than the levels two-line titles have (which used to crash). A numeric adoc-enable-two-line-title is documented as the length of delimiter lines that are never title underlines, but fontification compared it against the title text. Both places now share one check on the underline length.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Promoting or demoting
== Sectionproduced=== Section ===whenever the title had a newline after it, and with two-line titles disabled (the default) the editing commands still took a line above----or====for a setext title and rewrote the delimiter.The editing commands now follow
adoc-enable-two-line-titlelike highlighting and navigation already do. That means converting a legacy setext title withC-c C-tneeds the option turned on first - nothing else in the mode sees those titles while it's off either.