Skip to content

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

Merged
tarsius merged 1 commit intomagit:mainfrom
Zoybean:multiline-init-value
Mar 17, 2026
Merged

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

Conversation

@Zoybean
Copy link
Contributor

@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.

@Zoybean Zoybean force-pushed the multiline-init-value branch from c3fd768 to 25fbf25 Compare March 14, 2026 06:45
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
@tarsius tarsius force-pushed the multiline-init-value branch from 25fbf25 to c8e4251 Compare March 17, 2026 14:12
@tarsius tarsius merged commit c8e4251 into magit:main Mar 17, 2026
2 checks passed
@tarsius
Copy link
Member

tarsius commented Mar 17, 2026

Thanks!

(I didn't see the update until now because github doesn't send any notifications for 👍.)

@Zoybean
Copy link
Contributor Author

Zoybean commented Mar 18, 2026

ah. did it send a notification for the commit? If not, I will make a habit of following up with a message.

@Zoybean Zoybean deleted the multiline-init-value branch March 18, 2026 09:20
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