diff 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
line wrap: on
line diff
--- a/contrib/mercurial.el
+++ b/contrib/mercurial.el
@@ -283,13 +283,13 @@ XEmacs and GNU Emacs."
     (replace-regexp-in-string regexp newtext str nil literal)))
 
 (defsubst hg-strip (str)
-  "Strip leading and trailing white space from a string."
-  (hg-replace-in-string (hg-replace-in-string str "[ \t\r\n]+$" "")
-			"^[ \t\r\n]+" ""))
+  "Strip leading and trailing blank lines from a string."
+  (hg-replace-in-string (hg-replace-in-string str "[\r\n][ \t\r\n]*\\'" "")
+			"\\`[ \t\r\n]*[\r\n]" ""))
 
 (defsubst hg-chomp (str)
   "Strip trailing newlines from a string."
-  (hg-replace-in-string str "[\r\n]+$" ""))
+  (hg-replace-in-string str "[\r\n]+\'" ""))
 
 (defun hg-run-command (command &rest args)
   "Run the shell command COMMAND, returning (EXIT-CODE . COMMAND-OUTPUT).