[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to test if the current line contains only white-spache?
From: |
Barry Margolin |
Subject: |
Re: How to test if the current line contains only white-spache? |
Date: |
Sat, 14 Nov 2015 13:42:46 -0500 |
User-agent: |
MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) |
In article <87r3js7e8l.fsf@linux-qg7d.fritz.box>,
Rolf Ade <rolf@pointsman.de> 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]*$"))
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
- How to test if the current line contains only white-spache?, Rolf Ade, 2015/11/15
- Re: How to test if the current line contains only white-spache?,
Barry Margolin <=
- Re: How to test if the current line contains only white-spache?, Marcin Borkowski, 2015/11/16
- Re: How to test if the current line contains only white-spache?, Philipp Stephani, 2015/11/16
- looking-at-p slower than looking-at, Nicolas Richard, 2015/11/25
- Re: looking-at-p slower than looking-at, Marcin Borkowski, 2015/11/25
- Re: looking-at-p slower than looking-at, Michael Heerdegen, 2015/11/25
- Re: looking-at-p slower than looking-at, Marcin Borkowski, 2015/11/25
- Re: looking-at-p slower than looking-at, Nicolas Richard, 2015/11/26
- Re: looking-at-p slower than looking-at, Emanuel Berg, 2015/11/25
- Re: looking-at-p slower than looking-at, Nicolas Richard, 2015/11/26
- Message not available
- Re: looking-at-p slower than looking-at, Barry Margolin, 2015/11/25