From 3cf02c1afad15130731cb56088fda141a6069cdf Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Sun, 1 Nov 2009 14:36:47 -0500 Subject: [PATCH] org-babel: allow regexp to be supplied in org-babel-trim, as per docstring. --- contrib/babel/lisp/org-babel.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/contrib/babel/lisp/org-babel.el b/contrib/babel/lisp/org-babel.el index a333b9766..fd4dff099 100644 --- a/contrib/babel/lisp/org-babel.el +++ b/contrib/babel/lisp/org-babel.el @@ -852,9 +852,10 @@ the table is trivial, then return it as a scalar." "Remove any trailing space or carriage returns characters from STRING. Default regexp used is \"[ \f\t\n\r\v]\" but can be overwritten by specifying a regexp as a second argument." - (while (and (> (length string) 0) (string-match "[ \f\t\n\r\v]" (substring string -1))) - (setq string (substring string 0 -1))) - string) + (let ((regexp (or regexp "[ \f\t\n\r\v]"))) + (while (and (> (length string) 0) (string-match regexp (substring string -1))) + (setq string (substring string 0 -1))) + string)) (defun org-babel-trim (string &optional regexp) "Like `org-babel-chomp' only it runs on both the front and back of the string"