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: How to test if the current line contains only white-spache? Date: Sat, 21 Nov 2015 03:26:24 +0100 Message-ID: <87io4w84vj.fsf@debian.uxu> References: <87r3js7e8l.fsf@linux-qg7d.fritz.box> <874mgnystc.fsf@point.pointsman.de> <87d1v67nwo.fsf@linux-qg7d.fritz.box> <877fle6qnc.fsf@linux-qg7d.fritz.box> <87bnaqvwvx.fsf@mbork.pl> <87ziy9k0cl.fsf@debian.uxu> <87ziy9kxj8.fsf@mbork.pl> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1448072207 14882 80.91.229.3 (21 Nov 2015 02:16:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 21 Nov 2015 02:16:47 +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 Nov 21 03:16:36 2015 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 1ZzxjA-0001pw-4f for geh-help-gnu-emacs@m.gmane.org; Sat, 21 Nov 2015 03:16:36 +0100 Original-Received: from localhost ([::1]:50782 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zzxj9-00026b-H9 for geh-help-gnu-emacs@m.gmane.org; Fri, 20 Nov 2015 21:16:35 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41220) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zzxiz-00026H-DP for help-gnu-emacs@gnu.org; Fri, 20 Nov 2015 21:16:26 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zzxiw-00032a-6U for help-gnu-emacs@gnu.org; Fri, 20 Nov 2015 21:16:25 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:43852) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zzxiv-00032V-VZ for help-gnu-emacs@gnu.org; Fri, 20 Nov 2015 21:16:22 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Zzxit-0001HH-8R for help-gnu-emacs@gnu.org; Sat, 21 Nov 2015 03:16:19 +0100 Original-Received: from nl106-137-244.student.uu.se ([130.243.137.244]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 21 Nov 2015 03:16:19 +0100 Original-Received: from embe8573 by nl106-137-244.student.uu.se with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 21 Nov 2015 03:16:19 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Original-Lines: 56 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: nl106-137-244.student.uu.se Mail-Copies-To: never User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) Cancel-Lock: sha1:sJAPO4gOeIkPtD2sa7khlzNcjcw= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:108171 Archived-At: Marcin Borkowski writes: >> I don't think you can be categorical about it. > > Of course I can. Though maybe I shouldn't. ;-) "Ho ho ho" - I heard that one in the techno-incubator... >> (save-excursion (beginning-of-line) (point)) >> and >> (line-beginning-position) >> The code is easier and faster to write, read, and understand. > Is it really clear? I'm not sure. It consists of fewer letters and the words express the return value explicitly. With (save-excursion (beginning-of-line) (point)) you have a combination of three different forms/functions with Emacs-specific lingo at that, and that combination/lingo has to make sense to you. > Besides, I've just checked the /implementation/ of > `line-beginning-position', and I have some bad news > for you. I'm not fluent in C, nut AFAICT, it's even > uglier than the Elisp variant: there is no > `save-excursion' just a temporary variable for the > original position of point So it does move point? The help says "This function does not move point." - that might refer to the user experience and not the implementation tho. (So the user knows he doesn't have to enclose it with `save-excursion'.) > So, how is the C `line-beginning-position' better than > > (defun elisp-line-beginning-position () > (save-excursion (beginning-of-line) (point)))? > > (apart from being less general)? It is just /faster/, > but not more /elegant/ or /pure/. It is less general (i.e., more to the, eh, "point") - but it is also more general since it is included in the vanilla Emacs. As for elegance and purity those algorithms from the religio-mythical age are discontinued. -- underground experts united http://user.it.uu.se/~embe8573