From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-1?Q?Andreas_R=F6hler?= Newsgroups: gmane.emacs.devel Subject: Re: forward-paragraph return value Date: Tue, 24 Aug 2010 11:14:21 +0200 Message-ID: <4C738D6D.5040805@online.de> References: <4C72BD0A.8090104@online.de> <4C735C02.70804@online.de> <87y6bw5sb8.fsf@uwakimon.sk.tsukuba.ac.jp> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1282641341 10366 80.91.229.12 (24 Aug 2010 09:15:41 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 24 Aug 2010 09:15:41 +0000 (UTC) Cc: Andreas Schwab , Emacs developers To: "Stephen J. Turnbull" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 24 11:15:40 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OnpbW-0005bF-0o for ged-emacs-devel@m.gmane.org; Tue, 24 Aug 2010 11:15:38 +0200 Original-Received: from localhost ([127.0.0.1]:36193 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OnpbU-0000Lx-Pv for ged-emacs-devel@m.gmane.org; Tue, 24 Aug 2010 05:15:36 -0400 Original-Received: from [140.186.70.92] (port=43886 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OnpbF-0000J5-8i for emacs-devel@gnu.org; Tue, 24 Aug 2010 05:15:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OnpbD-0008Mt-Ro for emacs-devel@gnu.org; Tue, 24 Aug 2010 05:15:21 -0400 Original-Received: from moutng.kundenserver.de ([212.227.17.8]:53318) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OnpbD-0008MW-Ez for emacs-devel@gnu.org; Tue, 24 Aug 2010 05:15:19 -0400 Original-Received: from [192.168.178.27] (brln-4db9c4ae.pool.mediaWays.net [77.185.196.174]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0M34kR-1P5dIV3O6B-00sqfy; Tue, 24 Aug 2010 11:15:05 +0200 User-Agent: Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.1.11) Gecko/20100711 Thunderbird/3.0.6 In-Reply-To: <87y6bw5sb8.fsf@uwakimon.sk.tsukuba.ac.jp> X-Provags-ID: V02:K0:OAhYobi/KXaYoHMf4eqitH0u977rhaWsBdkJCnO9e+J szq+geut82/+f8d4a1o4HguFNnNXxMyCsBoHtvyhpv5ces3lpu 4k0Z1hvDzSUZjbvLanFLLZsulcN948cLzLJWZbDyzx1VzBQMj/ mFwr9L6TRITKGLIju7u6fhdyr2mCdP5Of4cycK9ENdTTHwDirh D7qF36OdIwMNFPADYss7A9r2cL5hYFi3IGnrSosn7c= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:129122 Archived-At: Am 24.08.2010 10:27, schrieb Stephen J. Turnbull: > Andreas Röhler writes: > > > Then people may write functions taking already the return value. > > Sure. But will they? Show us examples of existing functions > (preferably already in Emacs) that would benefit from this change. > Didn't I point to? If a look in forward-paragraph doesn't speak to you, maybe have a look into bounds-of-thing-at-point . Forms like (let (beg (progn (funcall (or (get thing 'beginning-op) (lambda () (forward-thing thing -1)))) (point)))) Thats bug-sourcing BTW, as it returns point in any case, even if move failed. Why not make implementation of return value from search-forward canonical instead, returning the position if succesful, nil otherwise. The gain will be for newly written code. For writers first, who must not learn function by function the return value. In the example above we could write (let (beg (funcall (or (get thing 'beginning-op) (lambda () (forward-thing thing -1)))))) Its clean and much more reliable, as beg will be nil, if nothing was found. > An easy example would be functions which look like > > ;; some code here > (forward-paragraph count) > (foo (point) other args) > ;; more code > > But it's not clear to me that > > ;; some code here > (foo (forward-paragraph count) other args) > ;; more code > > is going to be more readable without seeing examples. Since point has > a byte code, it's not particularly costly to use point. > >