help-gnu-emacs
[Top][All Lists]
Advanced

[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: Nicolas Richard
Subject: Re: How to test if the current line contains only white-spache?
Date: Wed, 25 Nov 2015 15:04:07 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Rolf Ade <rolf@pointsman.de> writes:
> 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)

FWIW I would do :
(save-excursion
  (beginning-of-line)
  (skip-chars-forward " \t")
  (eolp))

but IANAL(isper).

-- 
Nico.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]