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 19:10:59 +0200 Message-ID: <4C73FD23.8020302@online.de> References: <4C72BD0A.8090104@online.de> <4C735C02.70804@online.de> <87y6bw5sb8.fsf@uwakimon.sk.tsukuba.ac.jp> <4C738D6D.5040805@online.de> <87sk245i5v.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 1282669932 5431 80.91.229.12 (24 Aug 2010 17:12:12 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 24 Aug 2010 17:12:12 +0000 (UTC) Cc: "Stephen J. Turnbull" , Andreas Schwab To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 24 19:12:10 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 1Onx2f-0004Nz-Bn for ged-emacs-devel@m.gmane.org; Tue, 24 Aug 2010 19:12:09 +0200 Original-Received: from localhost ([127.0.0.1]:37094 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Onx2e-0004tn-Ug for ged-emacs-devel@m.gmane.org; Tue, 24 Aug 2010 13:12:08 -0400 Original-Received: from [140.186.70.92] (port=46394 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Onx2Z-0004td-QN for emacs-devel@gnu.org; Tue, 24 Aug 2010 13:12:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Onx2Y-00009x-Dl for emacs-devel@gnu.org; Tue, 24 Aug 2010 13:12:03 -0400 Original-Received: from moutng.kundenserver.de ([212.227.17.9]:53758) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Onx2X-00009l-Uq for emacs-devel@gnu.org; Tue, 24 Aug 2010 13:12:02 -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 0MLi3n-1On7xG03GN-0011nv; Tue, 24 Aug 2010 19:11:41 +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: <87sk245i5v.fsf@uwakimon.sk.tsukuba.ac.jp> X-Provags-ID: V02:K0:mjEZvd4d4CJZMGDZmBWQZKHrSUZs37qRbHL2FPChwwc RG4Msvfk7RnZHJWR2pJqFGykBIwXpO7ofB6xdZSrrhWodgjd1j 4cZQUStsTHPsPWzK8nvn0jEvuBJ5jh/91dLWzebWgnYXF4q+YN BTWVXbhcvWWA7wK7VkbZnOz28rWFEKP8s0RPCxv5LlstaUJYtr 71rIC7ag9zaXFUUpZ7/+zSXA4qm8OfEvgaj1v/zxP0= 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:129163 Archived-At: Am 24.08.2010 14:06, schrieb Stephen J. Turnbull: > Andreas Röhler writes: > > 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, > > Of course that doesn't speak to me; that's the function you propose to > change. > > > maybe have a look into > > > > bounds-of-thing-at-point . > > `forward-paragraph' is a command. `bounds-of-thing-at-point' is not. > There's a big difference. > > > Forms like > > (let > > (beg > > (progn > > (funcall > > (or (get thing 'beginning-op) > > (lambda () (forward-thing thing -1)))) > > (point)))) > > I doubt that form appears anywhere in Emacs. The style is nauseating, > not to mention that `progn' is a very unusual choice for a variable > you are let-binding. ;-) Please give *real* examples, it is, just the var is called real-beg, which make things still more confusion and has been let aside here as an example was the concern (real-beg (progn (funcall (or (get thing 'beginning-op) (lambda () (forward-thing thing -1)))) (point)))) Also you may see ;; If that brings us all the way back to ORIG, ;; it worked. But END may not be the real end. ;; So find the real end that corresponds to BEG. (let ((real-end (progn (funcall (or (get thing 'end-op) (lambda () (forward-thing thing 1)))) (point)))) > or if you're > going to simplify real code to make your point, say that's what you're > doing. Please stop insinuations. > And do it correctly, even for a fragment like this. > > > 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. > > Er, because otherwise `search-forward' does not return nil, but rather > signals an error? You need to specify additional arguments to get it > to return nil. There's a reason for this interface, related to the > fact that `search-forward' is a command, as is `forward-paragraph'. > > > The gain will be for newly written code. For writers first, who > > must not learn function by function the return value. > > A common convention might be a good idea. It's a better idea for > non-commands than it is for commands, though. > > > 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. > > Maybe. But in fact, this is a (broken) copy of (part of) the > implementation of `bounds-of-thing-at-point'. At least in XEmacs, > that function has *much* bigger problems than the return value of > forward-thing. Same in Emacs. But for the reasons just started to discuss. It's simply not written to the end, not thought through. Or it's author had to leave in the middle of his work. I wonder what happened, as it's a great set-out, a fine idea. For me one of the most interesting stuff in Emacs. Thanks BTW. Andreas > Also, since the return value of `forward-thing' is > undocumented (and probably rather unreliable), you could change that, > or define an internal function for the use of functions defun'ed in > thingatpt.el. > > The issue with forward-paragraph is quite different, because it is > documented and it is a command. > > >