comparison contrib/mercurial.el @ 1178:a7abffa4b19f

Adjust hg-strip and hg-chomp regexps.
author jdc@uwo.ca
date Wed, 31 Aug 2005 11:56:58 -0700
parents 7e909ceeb36a
children 8acf62f579d8
comparison
equal deleted inserted replaced
1177:862f53c1d0f9 1178:a7abffa4b19f
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