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

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

bug#43242: [PATCH] Fix CSS completion bug


From: Philip K.
Subject: bug#43242: [PATCH] Fix CSS completion bug
Date: Sun, 06 Sep 2020 23:55:43 +0200

Lars Ingebrigtsen <larsi@gnus.org> writes:

> "Philip K." <philipk@posteo.net> writes:
>
>> Well, it's being used in the next line in the member call to extract the
>> record from css-property-ids.
>
> I think there may be a slight misunderstanding about what the point of
> save-match-data is.  Here's the code:
>
> +         (save-match-data
> +           (and (looking-back "\\([[:alnum:]-]+\\):[^/][^;]*"
> +                              (line-beginning-position) t)
> +                (car (member (match-string-no-properties 1)
> +                             css-property-ids))))))
>
> The regexp operators set a global match state, but is you use
> save-match-data, the previous global state is restored after the form
> ends.  So save-match-data is used to preserve the global state -- it's
> not necessary if you don't care about overwriting it, and overwriting it
> is the norm.

Oh, I wasn't familiar with that convention. I always save the match data
to avoid bugs bugs down the line. If it's wished for, I can resubmit the
patch without the save-match-data.

-- 
        Philip K.





reply via email to

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