Skip to content

fix: regex in transient-init-value to include newlines#433

Open
Zoybean wants to merge 1 commit intomagit:mainfrom
Zoybean:multiline-init-value
Open

fix: regex in transient-init-value to include newlines#433
Zoybean wants to merge 1 commit intomagit:mainfrom
Zoybean:multiline-init-value

Conversation

@Zoybean
Copy link

@Zoybean Zoybean commented Mar 12, 2026

Allow transient-init-value to respect multiline string values, rather than truncating them to the first line.

.* does not match multiline strings because the . pattern matches any character besides a line terminator. Emacs regex syntax uses the [^z-a] pattern to match any character including line terminators.

Fixes #432

@tarsius
Copy link
Member

tarsius commented Mar 12, 2026

Please format the commit summary like other commit summaries are formatted for in this project, and include the information from the pr description in the commit message.

Also include the rx examples. While I don't use that myself it still is useful to be able to quickly verify that "anychar" is indeed represented like that.

If you plan to open a pull-request anyway, then you don't have to open a issue first. At least if the change is so small that it wouldn't be a waste of your time, if I ended up rejecting it.

Allow `transient-init-value' to respect multiline string values, rather
than truncating them to the first line.

As a regex pattern, ".*" does not match multiline strings because the
"." pattern matches any character besides a line terminator. Emacs regex
syntax uses the "[^z-a]" pattern to match any character including line
terminators. This distinction is represented by `(rx (* nonl))' vs`(rx
(* anychar))' in the `rx' macro syntax, and the expression implemented
here is as produced by `(rx string-start (literal "%s") (group
(* anychar)) string-end)'.

Fixes magit#432
@Zoybean Zoybean force-pushed the multiline-init-value branch from c3fd768 to 25fbf25 Compare March 14, 2026 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

transient-init-value trims multiline arguments

2 participants