emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug in some calls to split-string.


From: Stephen J. Turnbull
Subject: Re: Bug in some calls to split-string.
Date: 2013年7月20日 17:36:46 +0900

Jambunathan K writes:
 > "Stephen J. Turnbull" <address@hidden> writes:
 >
 > > Trimming leading and trailing whitespace is a generally useful
 > > function.
 >
 > Org-mode's usage of `org-trim' gives this proposal 100+ upvotes.
 >
 > (defun org-trim (s)
 > "Remove whitespace at beginning and end of string."
 > (if (string-match "\\`[ \t\n\r]+" s) (setq s (replace-match "" t t s)))
 > (if (string-match "[ \t\n\r]+\\'" s) (setq s (replace-match "" t t s)))
 > s)
Gah. Of course I should have used \` and \'.
org-trim probably ought to use \s- instead of the explicit character
class. I would at least add NBSP (U+00A0) to that class.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]

AltStyle によって変換されたページ (->オリジナル) /