From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.help Subject: Re: replace-regexp, the byte-compiler, docstrings, and suggestions Date: Sat, 18 Oct 2014 00:52:08 +0200 Organization: Aioe.org NNTP Server Message-ID: <87vbnigvhj.fsf@debian.uxu> References: <874mv9uopo.fsf@debian.uxu> <87tx336042.fsf@debian.uxu> <87zjcua4vn.fsf@debian.uxu> <87k33ya3lg.fsf@debian.uxu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1413586535 1171 80.91.229.3 (17 Oct 2014 22:55:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 17 Oct 2014 22:55:35 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Oct 18 00:55:29 2014 Return-path: Envelope-to: geh-help-gnu-emacs@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 1XfGQb-0005dk-Fy for geh-help-gnu-emacs@m.gmane.org; Sat, 18 Oct 2014 00:55:21 +0200 Original-Received: from localhost ([::1]:34892 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XfGQb-0003hh-7J for geh-help-gnu-emacs@m.gmane.org; Fri, 17 Oct 2014 18:55:21 -0400 Original-Path: usenet.stanford.edu!news.kjsl.com!feeder.erje.net!eu.feeder.erje.net!news.etla.org!aioe.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 58 Original-NNTP-Posting-Host: feB02bRejf23rfBm51Mt7Q.user.speranza.aioe.org Original-X-Complaints-To: abuse@aioe.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-Notice: Filtered by postfilter v. 0.8.2 Cancel-Lock: sha1:hY2e1OBaHo5VdsHvhWLkPO4JQXk= Mail-Copies-To: never Original-Xref: usenet.stanford.edu gnu.emacs.help:208211 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:100487 Archived-At: Stefan Monnier writes: >> Yeah, probably. I tried in the Linux VT and in X >> (with xterm), with and without tmux on both: in the >> console C-4 just inserts a "4", in X C-4 is C-\. I >> only have emacs-nox installed but I'm happy with >> `C-u N' so this doesn't bother me. > > You can also use M-N, BTW, which should work also in > text terminals. True! OK, so I won't suggest a "block cite" function as there is one, perhaps two, already. Still, any comments on: - instead of offering Elisp in the help, give a function that does exactly that - have the byte-compiler give this reference as well (optimally the same information as in the help, so no need to compile and then check out the help) - could this be optimized transparently? (perhaps a bit risky? with a very small gain at that - no, I'm happy with what I originally proposed) - even as it stands, the reason the "interactive" `replace-regexp' shouldn't be used is: This function is usually the wrong thing to use in a Lisp program. What you probably want is a loop like this: (while (re-search-forward REGEXP nil t) (replace-match TO-STRING nil nil)) which will run faster and will not set the mark or print anything. but the interface to `replace-regexp' is: (replace-regexp REGEXP TO-STRING &optional DELIMITED START END) So we offer a function. When someone uses it the compiler complains. Because the compiler doesn't say much, the user has to check out the help where he is given the code. But the code doesn't even cover the interface of the "forbidden" `replace-regexp'. So he has to figure out the missing parts. By this time frustration will run high especially because `replace-regexp' - the incorrect use - probably worked just fine. I'm telling you. It is not a big deal. It is a detail. But it is the details that make the big picture. -- underground experts united