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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to test if the current line contains only white-spache?


From: Rolf Ade
Subject: How to test if the current line contains only white-spache?
Date: Sat, 14 Nov 2015 17:11:22 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

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.



reply via email to

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