From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Rolf Ade Newsgroups: gmane.emacs.help Subject: Re: How to test if the current line contains only white-spache? Date: Sun, 15 Nov 2015 20:18:55 +0100 Organization: Me, myself and I Message-ID: <874mgnystc.fsf@point.pointsman.de> References: <87r3js7e8l.fsf@linux-qg7d.fritz.box> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1447704694 16467 80.91.229.3 (16 Nov 2015 20:11:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 16 Nov 2015 20:11:34 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Nov 16 21:11:32 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 1ZyQ7g-00038g-CS for geh-help-gnu-emacs@m.gmane.org; Mon, 16 Nov 2015 21:11:32 +0100 Original-Received: from localhost ([::1]:48619 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZyQ7f-0005La-QR for geh-help-gnu-emacs@m.gmane.org; Mon, 16 Nov 2015 15:11:31 -0500 Original-Path: usenet.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 27 Original-X-Trace: individual.net a4LF3/tVZc3CbIjRkS92TA0526Qy646dUuc3icDoXzFtynsCs= Cancel-Lock: sha1:atZkuslCIqI+k3Exd9lP0tkKENM= sha1:o5VzA9isB7UMTOneq40b8aEcbuI= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) Original-Xref: usenet.stanford.edu gnu.emacs.help:215793 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:108090 Archived-At: Barry Margolin writes: > Rolf Ade wrote: > >> For some random minor elisp code I need to know, if the current line >> contains only white-space characters[1]. >> >> I came up with this somewhat convoluted code: >> >> (beginning-of-line) >> (skip-chars-forward " \t") >> (let ((text-start (current-column))) >> (end-of-line) >> (if (= text-start (current-column)) >> t >> nil) >> >> (and that is, obviously, without saving point position and wrapping >> into and a defun and maybe other bells and whistles). >> >> I wonder, what much simpler and more elegant solution I'm missing. > > (save-excursion > (beginning-of-line) > (looking-at "[ \t]*$")) Works fine and is much simpler. Thanks.