[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: |
Rolf Ade |
Subject: |
Re: How to test if the current line contains only white-spache? |
Date: |
Sun, 15 Nov 2015 20:18:55 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Barry Margolin <barmar@alum.mit.edu> writes:
> 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]*$"))
Works fine and is much simpler. Thanks.
- Re: How to test if the current line contains only white-spache?, (continued)
- 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
- Re: looking-at-p slower than looking-at, Marcin Borkowski, 2015/11/25
Re: How to test if the current line contains only white-spache?,
Rolf Ade <=
Message not availableRe: How to test if the current line contains only white-spache?, Rolf Ade, 2015/11/18
Re: How to test if the current line contains only white-spache?, Stefan Monnier, 2015/11/18
Re: How to test if the current line contains only white-spache?, Emanuel Berg, 2015/11/18
Re: How to test if the current line contains only white-spache?, Emanuel Berg, 2015/11/18
Message not availableRe: How to test if the current line contains only white-spache?, Rolf Ade, 2015/11/19
Re: How to test if the current line contains only white-spache?, Marcin Borkowski, 2015/11/19
Re: How to test if the current line contains only white-spache?, Emanuel Berg, 2015/11/19
Re: How to test if the current line contains only white-spache?, Marcin Borkowski, 2015/11/20