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: How to test if the current line contains only white-spache? Date: Sat, 14 Nov 2015 17:11:22 +0100 Organization: Me Message-ID: <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 1447565124 31521 80.91.229.3 (15 Nov 2015 05:25:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 15 Nov 2015 05:25:24 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Nov 15 06:25:24 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 1ZxpoZ-00020F-3k for geh-help-gnu-emacs@m.gmane.org; Sun, 15 Nov 2015 06:25:23 +0100 Original-Received: from localhost ([::1]:40145 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxpoY-0002OF-FR for geh-help-gnu-emacs@m.gmane.org; Sun, 15 Nov 2015 00:25:22 -0500 Original-Path: usenet.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 26 Original-X-Trace: individual.net /xVHmWTSGihU4YSX5rZEdQMxbW1mq7MQmeRdUk9iNQHL07/nw= Cancel-Lock: sha1:Lh5ft+kaOFG6HrA6SXkwgyf/abI= sha1:AYTppw6KjSeGvr8ZHDQ1Y8tH8z0= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) Original-Xref: usenet.stanford.edu gnu.emacs.help:215780 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:108073 Archived-At: 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. rolf [1] "White-space characters" in this sense atm defines to just " " and "\t". Lets accept that for the context of the question, I know there are other definitions of white-space characters.