Merge remote-tracking branch 'savannah/master' into native-comp

This commit is contained in:
Andrea Corallo 2021-03-25 16:29:07 +01:00
commit c6c7b30e4b
180 changed files with 1982 additions and 1977 deletions

View file

@ -2811,9 +2811,9 @@ This function is used by the `interactive' code letter `n'."
(when default1
(setq prompt
(if (string-match "\\(\\):[ \t]*\\'" prompt)
(replace-match (format " (default %s)" default1) t t prompt 1)
(replace-match (format minibuffer-default-prompt-format default1) t t prompt 1)
(replace-regexp-in-string "[ \t]*\\'"
(format " (default %s) " default1)
(format minibuffer-default-prompt-format default1)
prompt t t))))
(while
(progn
@ -6205,6 +6205,28 @@ returned list are in the same order as in TREE.
;; for discoverability:
(defalias 'flatten-list #'flatten-tree)
(defun string-trim-left (string &optional regexp)
"Trim STRING of leading string matching REGEXP.
REGEXP defaults to \"[ \\t\\n\\r]+\"."
(if (string-match (concat "\\`\\(?:" (or regexp "[ \t\n\r]+") "\\)") string)
(substring string (match-end 0))
string))
(defun string-trim-right (string &optional regexp)
"Trim STRING of trailing string matching REGEXP.
REGEXP defaults to \"[ \\t\\n\\r]+\"."
(let ((i (string-match-p (concat "\\(?:" (or regexp "[ \t\n\r]+") "\\)\\'")
string)))
(if i (substring string 0 i) string)))
(defun string-trim (string &optional trim-left trim-right)
"Trim STRING of leading and trailing strings matching TRIM-LEFT and TRIM-RIGHT.
TRIM-LEFT and TRIM-RIGHT default to \"[ \\t\\n\\r]+\"."
(string-trim-left (string-trim-right string trim-right) trim-left))
;; The initial anchoring is for better performance in searching matches.
(defconst regexp-unmatchable "\\`a\\`"
"Standard regexp guaranteed not to match any string at all.")