unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [Emacs-diffs] trunk r116779: Restore compatibility with legacy comment-start-skip values
       [not found] <E1WPRLY-0001sI-LW@vcs.savannah.gnu.org>
@ 2014-03-17 15:50 ` Stefan
  2014-03-17 16:14   ` Dmitry Gutov
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan @ 2014-03-17 15:50 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: emacs-devel

> +                      ;; Some older modes use regexps that check the
> +                      ;; char before the comment for quoting.  (Bug#16971)
> +                      (save-excursion
> +                        (forward-char -1)
> +                        (looking-at comment-start-skip)))

This needs to additionally check that (match-end 1) points to what we
thought was the comment start.


        Stefan



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Emacs-diffs] trunk r116779: Restore compatibility with legacy comment-start-skip values
  2014-03-17 15:50 ` [Emacs-diffs] trunk r116779: Restore compatibility with legacy comment-start-skip values Stefan
@ 2014-03-17 16:14   ` Dmitry Gutov
  2014-03-17 18:14     ` Stefan
  0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Gutov @ 2014-03-17 16:14 UTC (permalink / raw)
  To: Stefan; +Cc: emacs-devel

On 17.03.2014 17:50, Stefan wrote:
>> +                      ;; Some older modes use regexps that check the
>> +                      ;; char before the comment for quoting.  (Bug#16971)

In light of your latest message on #16971, I'll probably have to change 
this comment.

>> +                      (save-excursion
>> +                        (forward-char -1)
>> +                        (looking-at comment-start-skip)))
>
> This needs to additionally check that (match-end 1) points to what we
> thought was the comment start.

Can you think of a situation when that's not true?

And suppose it doesn't, then what?



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Emacs-diffs] trunk r116779: Restore compatibility with legacy comment-start-skip values
  2014-03-17 16:14   ` Dmitry Gutov
@ 2014-03-17 18:14     ` Stefan
  2014-03-17 19:44       ` Dmitry Gutov
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan @ 2014-03-17 18:14 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: emacs-devel

>>> +                      (save-excursion
>>> +                        (forward-char -1)
>>> +                        (looking-at comment-start-skip)))
>> This needs to additionally check that (match-end 1) points to what we
>> thought was the comment start.
> Can you think of a situation when that's not true?

"Think of", no.  But I can make one up, if you want ;-)

BTW, the new code still will fail to match the ";hello" comment in

   foo\\;hello

Maybe we should use narrow-to-region to get the ^ part of the regexp to
match at point.

> And suppose it doesn't, then what?

Admittedly, I'm not sure how to handle the more general case where
comment-start-skip uses sub-group 1 for something more significant than
to rule out an escape char.


        Stefan



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Emacs-diffs] trunk r116779: Restore compatibility with legacy comment-start-skip values
  2014-03-17 18:14     ` Stefan
@ 2014-03-17 19:44       ` Dmitry Gutov
  2014-03-17 23:32         ` Stefan
  0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Gutov @ 2014-03-17 19:44 UTC (permalink / raw)
  To: Stefan; +Cc: emacs-devel

On 17.03.2014 20:14, Stefan wrote:

> BTW, the new code still will fail to match the ";hello" comment in
>
>     foo\\;hello
>
> Maybe we should use narrow-to-region to get the ^ part of the regexp to
> match at point.

Yes, good point. Yet another handy `narrow-to-region' hack. :)

>> And suppose it doesn't, then what?
>
> Admittedly, I'm not sure how to handle the more general case where
> comment-start-skip uses sub-group 1 for something more significant than
> to rule out an escape char.

I can simply imagine a misconfigured mode where `comment-start-skip' 
doesn't ever match the start of a comment. So the question is, do we 
raise an error, simply don't move point, or do something like 
(skip-syntax-forward "-<")?

By the way, we might want to replace all the matching shenanigans with 
the last option.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Emacs-diffs] trunk r116779: Restore compatibility with legacy comment-start-skip values
  2014-03-17 19:44       ` Dmitry Gutov
@ 2014-03-17 23:32         ` Stefan
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan @ 2014-03-17 23:32 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: emacs-devel

> So the question is, do we raise an error, simply don't move point, or
> do something like (skip-syntax-forward "-<")?

Let's not worry about it for now.

> By the way, we might want to replace all the matching shenanigans with the
> last option.

That won't work for /*...*/ and many other situations.


        Stefan



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-03-17 23:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <E1WPRLY-0001sI-LW@vcs.savannah.gnu.org>
2014-03-17 15:50 ` [Emacs-diffs] trunk r116779: Restore compatibility with legacy comment-start-skip values Stefan
2014-03-17 16:14   ` Dmitry Gutov
2014-03-17 18:14     ` Stefan
2014-03-17 19:44       ` Dmitry Gutov
2014-03-17 23:32         ` Stefan

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).