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

[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 22:50:51 +0200


> Sent: Tuesday, May 18, 2021 at 8:56 PM
> From: "Jean Louis" <bugs@gnu.support>
> To: "Eric Abrahamsen" <eric@ericabrahamsen.net>
> Cc: "Skip Montanaro" <skip.montanaro@gmail.com>, "Help Gnu Emacs" 
> <help-gnu-emacs@gnu.org>, michael-franzese@gmx.com
> Subject: Re: Determining existence of text following point
>
> * Eric Abrahamsen <eric@ericabrahamsen.net> [2021-05-18 03:09]:
> > michael-franzese@gmx.com writes:
> >
> > > But if there are only empty spaces it is ok too.
>
> (defun my-insert-on-empty-end-of-line (s)
>   (let ((line-cut (buffer-substring-no-properties (point) 
> (line-end-position))))
>     (when (or (not (string-match "[^[:blank:]]" line-cut)) (eolp))
>       (insert s))))

Found out that I would need to extend this some more because if the text is ";;"
followed by space followed by either a series of ";" or "+", or "-", then the
insertion is allowed.  So not just only blanks.

For instance, if the text in a commented string as follows, I will go ahead with
the insertion.

;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; ++++++++++++++++++++++++++++++++++

;; -------------------------------




>
> --
> Jean
>
> Take action in Free Software Foundation campaigns:
> https://www.fsf.org/campaigns
>
> Sign an open letter in support of Richard M. Stallman
> https://stallmansupport.org/
> https://rms-support-letter.github.io/
>
>
>



reply via email to

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