Function: vc--subject-to-file-name
vc--subject-to-file-name is a byte-compiled function defined in
vc.el.gz.
Signature
(vc--subject-to-file-name SUBJECT)
Documentation
Generate a file name for a patch with subject line SUBJECT.
The resulting filename is similar to the names generated by "git format-patch", but without the leading patch sequence number "0001-". Any leading "[PATCH 1/1]" style strings, and any text properties are removed from SUBJECT prior to conversion.
Source Code
;; Defined in /usr/src/emacs/lisp/vc/vc.el.gz
(defun vc--subject-to-file-name (subject)
"Generate a file name for a patch with subject line SUBJECT.
The resulting filename is similar to the names generated by \"git
format-patch\", but without the leading patch sequence number \"0001-\".
Any leading \"[PATCH 1/1]\" style strings, and any text properties are
removed from SUBJECT prior to conversion."
(let* ((stripped
(replace-regexp-in-string "\\`\\[[^][]*PATCH[^][]*]\\s-*" ""
subject))
(truncated (substring-no-properties stripped
0 (min (length stripped) 50))))
(concat
(string-trim (replace-regexp-in-string "\\W+" "-" truncated)
"-+" "-+")
".patch")))