From: Michael O. <mw...@gn...> - 2006-03-25 18:16:12
|
boj...@dd... (Johan Bockg=C3=A5rd) writes: > Jorgen Schaefer <fo...@fo...> writes: > >> I know I'm not really involved anymore and such, but IIRC we made >> that regexp specifically like this if anyone ever wanted to send >> leading whitespace to the server - it's a _QUOTE_ command after >> all, and meant not to meddle with the arguments. But I guess some >> people think some meddling is ok, so that's mostly a matter of >> taste. > > What forcer said. > > I like this variant: > > (string-match "^ ?\\(.*\\)" line) > > If there is a leading space character it is removed. Anything else, > like tabs, is left alone. That works. I'm not very fond of initial whitespace being sent, but I'll go with the consensus. I'm using a slight variant: (string-match "^ ?\\(.+\\)" line) because the user probably doesn't want a line with only one space to be turned into an empty string -- better to not send anything in that case. =2D-=20 Michael Olson -- FSF Associate Member #652 -- http://www.mwolson.org/ Interests: Emacs Lisp, text markup, protocols -- Muse, Planner, ERC, EMMS /` |\ | | | IRC: mwolson on freenode.net: #hcoop, #muse, #PurdueLUG |_] | \| |_| Jabber: mwolson_at_hcoop.net |