From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Stephen J. Turnbull" Newsgroups: gmane.emacs.devel Subject: Re: Raw strings (experimental patches inside) Date: Fri, 10 Aug 2012 14:08:39 +0900 Message-ID: <87wr1749m0.fsf@uwakimon.sk.tsukuba.ac.jp> References: <651F6603-F798-4381-929E-7D86A28DBC4D@gmail.com> <502464D6.4000103@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 X-Trace: dough.gmane.org 1344575335 17855 80.91.229.3 (10 Aug 2012 05:08:55 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 10 Aug 2012 05:08:55 +0000 (UTC) Cc: Emacs development discussions To: Vr Rm Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Aug 10 07:08:54 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SzhSv-0007N6-IM for ged-emacs-devel@m.gmane.org; Fri, 10 Aug 2012 07:08:53 +0200 Original-Received: from localhost ([::1]:48995 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SzhSu-0006QZ-N5 for ged-emacs-devel@m.gmane.org; Fri, 10 Aug 2012 01:08:52 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:47364) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SzhSr-0006QQ-3l for emacs-devel@gnu.org; Fri, 10 Aug 2012 01:08:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SzhSq-0002SM-11 for emacs-devel@gnu.org; Fri, 10 Aug 2012 01:08:49 -0400 Original-Received: from mgmt2.sk.tsukuba.ac.jp ([130.158.97.224]:55653) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SzhSp-0002RR-Gv for emacs-devel@gnu.org; Fri, 10 Aug 2012 01:08:47 -0400 Original-Received: from uwakimon.sk.tsukuba.ac.jp (uwakimon.sk.tsukuba.ac.jp [130.158.99.156]) by mgmt2.sk.tsukuba.ac.jp (Postfix) with ESMTP id 0FB2F970894; Fri, 10 Aug 2012 14:08:40 +0900 (JST) Original-Received: by uwakimon.sk.tsukuba.ac.jp (Postfix, from userid 1000) id CBC581A30B4; Fri, 10 Aug 2012 14:08:39 +0900 (JST) In-Reply-To: <502464D6.4000103@gmail.com> X-Mailer: VM 8.0.12-devo-585 under 21.5 (beta31) "ginger" b4715fcbe001 XEmacs Lucid (x86_64-unknown-linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 130.158.97.224 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:152394 Archived-At: Vr Rm writes: > But the difficulty in using Emacs regular expressions shouldn't be > underestimated, especially for those of us on the dim side of the > superhuman spectrum. Nothing personal, but if you can't even search for tabs (C-s C-q TAB will do), of course you're going to find regexps difficult. It's hard to see how they can be simplified -- as used in all languages I know, regexps are extremely compact notation. Such notation is going to be non-trivial if you can't remember to use C-q to insert command characters literally, and I don't think raw strings are going to help. (A sane assignment of character classes such that punctuation is always an operator, as in Perl or Python, would be much more mnemonic help, I think.) You're going to have to appeal from a somewhat more proficient level; Emacsen are designed to be used with a vocabulary of editing gestures that is only about one order of magnitude smaller than the English language. That said, > > That is not a problem significant enough to warrant the > > introduction of something like raw-strings. Oh, come on, Stefan. That's just elitism. If insults won't persuade you, here are some real benefits. raw-strings are a huge convenience when writing.[1] They correspond to the way you enter a regexp to isearch, and to the documentation. They are a big win for readability, both because of the greatly increased S/N in long complex regexps, and because they reduce the number of line-breaks needed for medium-complexity regexps in search functions and the like. The costs are about as small as they get. Raw strings are extremely easy to implement directly in the reader (OK, you'll probably duplicate some of the code in regular string lexing, but really...), if you use #r"" as XEmacsen do they can't break working code, and the implementation is highly localized and therefore subject to refactoring if later you decide to do it terms of a generic reader macro rather than C code in the lexer. And if that doesn't work, how about "S?XEmacs has them and Emacs doesn't, nyaaah, nyaaah, nyaaah!"? At least think one more time about it. And maybe about a syntax for PCRE regexps. (Why a syntax? Because wrapping them in a function is more unnecessary verbosity, as would be duplicating all regexp-using functions with pcre- versions.) Footnotes: [1] One could bind ?\\ to (lambda () (interactive) (insert "\\")), but that would require a mode switch on entry and exit which is a PITA itself, and not as visible to the author as a raw string syntax.