unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [Emacs-diffs] /srv/bzr/emacs/trunk r111958: * lisp/progmodes/ruby-mode.el (ruby-syntax-propertize-function): Only
       [not found] <E1UDJq5-0007SO-Pc@vcs.savannah.gnu.org>
@ 2013-03-09  1:41 ` Stefan Monnier
  2013-03-09  1:45   ` Dmitry Gutov
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2013-03-09  1:41 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: emacs-devel

>              ;; The regular expression itself.
>              "\\(/\\)[^/\n\\\\]*\\(?:\\\\.[^/\n\\\\]*\\)*\\(/\\)")
> -           (2 (string-to-syntax "\"/"))
> -           (3 (string-to-syntax "\"/")))
> +           (3 (unless (nth 3 (syntax-ppss (match-beginning 2)))
> +                (put-text-property (match-beginning 2) (match-end 2)
> +                                   'syntax-table (string-to-syntax "\"/"))
> +                (string-to-syntax "\"/"))))

If match n°2 is not inside a string, I think we should not skip all
that's matched by the regexp (since it's not a string and may hence
contain other things that need to be syntax-propertized).  I.e. The
`unless' should be turned into an `if' and in the non-string case it
should move point back to (match-end 2).


        Stefan



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

* Re: [Emacs-diffs] /srv/bzr/emacs/trunk r111958: * lisp/progmodes/ruby-mode.el (ruby-syntax-propertize-function): Only
  2013-03-09  1:41 ` [Emacs-diffs] /srv/bzr/emacs/trunk r111958: * lisp/progmodes/ruby-mode.el (ruby-syntax-propertize-function): Only Stefan Monnier
@ 2013-03-09  1:45   ` Dmitry Gutov
  2013-03-09  3:22     ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Gutov @ 2013-03-09  1:45 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

On 09.03.2013 5:41, Stefan Monnier wrote:
>>               ;; The regular expression itself.
>>               "\\(/\\)[^/\n\\\\]*\\(?:\\\\.[^/\n\\\\]*\\)*\\(/\\)")
>> -           (2 (string-to-syntax "\"/"))
>> -           (3 (string-to-syntax "\"/")))
>> +           (3 (unless (nth 3 (syntax-ppss (match-beginning 2)))
>> +                (put-text-property (match-beginning 2) (match-end 2)
>> +                                   'syntax-table (string-to-syntax "\"/"))
>> +                (string-to-syntax "\"/"))))
>
> If match n°2 is not inside a string, I think we should not skip all
> that's matched by the regexp (since it's not a string and may hence
> contain other things that need to be syntax-propertized).  I.e. The
> `unless' should be turned into an `if' and in the non-string case it
> should move point back to (match-end 2).

`syntax-ppss' moves point, so that's taken care of. See the second test 
in the same commit.

I agree that that's not obvious from reading the code, though.



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

* Re: [Emacs-diffs] /srv/bzr/emacs/trunk r111958: * lisp/progmodes/ruby-mode.el (ruby-syntax-propertize-function): Only
  2013-03-09  1:45   ` Dmitry Gutov
@ 2013-03-09  3:22     ` Stefan Monnier
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2013-03-09  3:22 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: emacs-devel

> `syntax-ppss' moves point, so that's taken care of. See the second test in
> the same commit.

Oh, right, good catch, sorry 'bout the noise.


        Stefan



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

end of thread, other threads:[~2013-03-09  3:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <E1UDJq5-0007SO-Pc@vcs.savannah.gnu.org>
2013-03-09  1:41 ` [Emacs-diffs] /srv/bzr/emacs/trunk r111958: * lisp/progmodes/ruby-mode.el (ruby-syntax-propertize-function): Only Stefan Monnier
2013-03-09  1:45   ` Dmitry Gutov
2013-03-09  3:22     ` Stefan Monnier

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).