equal
deleted
inserted
replaced
281 (if (fboundp 'replace-in-string) |
281 (if (fboundp 'replace-in-string) |
282 (replace-in-string str regexp newtext literal) |
282 (replace-in-string str regexp newtext literal) |
283 (replace-regexp-in-string regexp newtext str nil literal))) |
283 (replace-regexp-in-string regexp newtext str nil literal))) |
284 |
284 |
285 (defsubst hg-strip (str) |
285 (defsubst hg-strip (str) |
286 "Strip leading and trailing white space from a string." |
286 "Strip leading and trailing blank lines from a string." |
287 (hg-replace-in-string (hg-replace-in-string str "[ \t\r\n]+$" "") |
287 (hg-replace-in-string (hg-replace-in-string str "[\r\n][ \t\r\n]*\\'" "") |
288 "^[ \t\r\n]+" "")) |
288 "\\`[ \t\r\n]*[\r\n]" "")) |
289 |
289 |
290 (defsubst hg-chomp (str) |
290 (defsubst hg-chomp (str) |
291 "Strip trailing newlines from a string." |
291 "Strip trailing newlines from a string." |
292 (hg-replace-in-string str "[\r\n]+$" "")) |
292 (hg-replace-in-string str "[\r\n]+\'" "")) |
293 |
293 |
294 (defun hg-run-command (command &rest args) |
294 (defun hg-run-command (command &rest args) |
295 "Run the shell command COMMAND, returning (EXIT-CODE . COMMAND-OUTPUT). |
295 "Run the shell command COMMAND, returning (EXIT-CODE . COMMAND-OUTPUT). |
296 The list ARGS contains a list of arguments to pass to the command." |
296 The list ARGS contains a list of arguments to pass to the command." |
297 (let* (exit-code |
297 (let* (exit-code |