[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Determining existence of text following point
From: |
michael-franzese |
Subject: |
Re: Determining existence of text following point |
Date: |
Tue, 18 May 2021 10:24:20 +0200 |
Would like to set a function which I could then use with an if statement
Have constructed something as follows. But naturally the name of the function
is
the reverse of having no text (including empty spaces)
(defun looking-at-text ()
"todo"
(looking-at-p "\\([[:blank:]]+\\)?\\(\n\\|\\'\\)")
)
Then my condition for inserting my string would be
(unless (looking-at-text)
(delete-region (point) (line-end-position))
(save-excursion (insert s)) )
> Sent: Tuesday, May 18, 2021 at 12:09 PM
> From: "Eric Abrahamsen" <eric@ericabrahamsen.net>
> To: michael-franzese@gmx.com
> Cc: "Skip Montanaro" <skip.montanaro@gmail.com>, "Help Gnu Emacs"
> <help-gnu-emacs@gnu.org>
> Subject: Re: Determining existence of text following point
>
> michael-franzese@gmx.com writes:
>
> > But if there are only empty spaces it is ok too.
>
> Ah, then Skip's looking-at is a fine solution:
>
> (looking-at-p "\\([[:blank:]]+\\)?\\(\n\\|\\'\\)")
>
> That's as a test. Or you could use a single `replace-regexp' invocation,
> to detect and replace the whitespace in one go.
>
- Determining existence of text following point, michael-franzese, 2021/05/17
- Re: Determining existence of text following point, Skip Montanaro, 2021/05/17
- Re: Determining existence of text following point, michael-franzese, 2021/05/17
- Re: Determining existence of text following point, Eric Abrahamsen, 2021/05/17
- Re: Determining existence of text following point, michael-franzese, 2021/05/17
- Re: Determining existence of text following point, Skip Montanaro, 2021/05/17
- Re: Determining existence of text following point, Eric Abrahamsen, 2021/05/17
- Re: Determining existence of text following point, michael-franzese, 2021/05/17
- Re: Determining existence of text following point,
michael-franzese <=
- Re: Determining existence of text following point, Jean Louis, 2021/05/18
- Determining existence of text following point, Christopher Dimech, 2021/05/18
- Re: Determining existence of text following point, Jean Louis, 2021/05/18
- Re: Determining existence of text following point, Jean Louis, 2021/05/18
- Re: Determining existence of text following point, Christopher Dimech, 2021/05/18
- Re: Determining existence of text following point, tomas, 2021/05/18
- Re: Determining existence of text following point, Christopher Dimech, 2021/05/18
- Re: Determining existence of text following point, Jean Louis, 2021/05/18
- Re: Determining existence of text following point, Christopher Dimech, 2021/05/18
- Re: Determining existence of text following point, tomas, 2021/05/18