From: "Stephen J. Turnbull" <turnbull@sk.tsukuba.ac.jp>
To: Jambunathan K <kjambunathan@gmail.com>
Cc: rms@gnu.org, emacs-devel@gnu.org
Subject: Re: Bug in some calls to split-string.
Date: Sat, 20 Jul 2013 17:36:46 +0900 [thread overview]
Message-ID: <87d2qdr5k1.fsf@uwakimon.sk.tsukuba.ac.jp> (raw)
In-Reply-To: <878v11ekbn.fsf@gmail.com>
Jambunathan K writes:
> "Stephen J. Turnbull" <stephen@xemacs.org> 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.
next prev parent reply other threads:[~2013-07-20 8:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-19 19:09 Bug in some calls to split-string Richard Stallman
2013-07-20 7:34 ` Stephen J. Turnbull
2013-07-20 7:56 ` Jambunathan K
2013-07-20 8:36 ` Stephen J. Turnbull [this message]
2013-07-20 13:35 ` Richard Stallman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87d2qdr5k1.fsf@uwakimon.sk.tsukuba.ac.jp \
--to=turnbull@sk.tsukuba.ac.jp \
--cc=emacs-devel@gnu.org \
--cc=kjambunathan@gmail.com \
--cc=rms@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.