GNU bug report logs -
#13844
[PATCH] Fix html-mode quotes syntax in text
Previous Next
Reported by: Dale <dale <at> codefu.org>
Date: Fri, 1 Mar 2013 01:50:01 UTC
Severity: normal
Tags: fixed, patch
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 13844 in the body.
You can then email your comments to 13844 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13844
; Package
emacs
.
(Fri, 01 Mar 2013 01:50:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Dale <dale <at> codefu.org>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 01 Mar 2013 01:50:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hi,
I noticed Emacs was colorizing the following sample wrong in
html-mode:
~~~~~~
<pre>
" Dangling quote makes the closing tag get highlighted as a string
</pre>
" Highlighting now fixed: <hr />
Additionally, if you have apostrophe in sgml-specials, this more common
usage will break:
Dave's bar
Now this tag will have incorrect highlighting:
<br />
~~~~~~
I believe I've tracked this down to two problems:
1. sgml-syntax-propertize-function is already prepared to correctly set
the syntax on " (double quotes) within text, but returns "." for the
syntax-table property value. That's not a valid value for syntax-table
propertize. It needs to use (string-to-syntax ".").
2. sgml-syntax-propertize-function doesn't account for the fact that you
could have set ' (apostrophe) in sgml-specials, which causes apostrophe
to be set as string syntax in the syntax table, just like " is by
default.
The patch below hopefully fixes both problems.
I believe I have filed my copyright assignment with the FSF for
Emacs already.
ChangeLog entry:
~~~~~~
2013-02-28 Dale Sedivec <dale <at> codefu.org>
* textmodes/sgml-mode.el (sgml-syntax-propertize-function):
Return valid syntax-table property value when converting
quotes within text from string syntax to punctuation syntax.
Also perform this adjustment when apostrophe (?') is in
sgml-specials.
~~~~~~
Patch against Git master follows.
Dale
*** /var/folders/l1/l_tpw26n35zbm0fp4x22_vjh0000kk/T//85VjC0_sgml-mode.el 2013-02-28 19:00:02.000000000 -0600
--- lisp/textmodes/sgml-mode.el 2013-02-28 18:54:52.000000000 -0600
***************
*** 312,328 ****
(defconst sgml-syntax-propertize-function
(syntax-propertize-rules
! ;; Use the `b' style of comments to avoid interference with the -- ... --
! ;; comments recognized when `sgml-specials' includes ?-.
! ;; FIXME: beware of <!--> blabla <!--> !!
("\\(<\\)!--" (1 "< b"))
! ("--[ \t\n]*\\(>\\)" (1 "> b"))
! ;; Double quotes outside of tags should not introduce strings.
! ;; Be careful to call `syntax-ppss' on a position before the one we're
! ;; going to change, so as not to need to flush the data we just computed.
! ("\"" (0 (if (prog1 (zerop (car (syntax-ppss (match-beginning 0))))
! (goto-char (match-end 0)))
! "."))))
"Syntactic keywords for `sgml-mode'.")
;; internal
--- 312,335 ----
(defconst sgml-syntax-propertize-function
(syntax-propertize-rules
! ;; Use the `b' style of comments to avoid interference with the -- ... --
! ;; comments recognized when `sgml-specials' includes ?-.
! ;; FIXME: beware of <!--> blabla <!--> !!
("\\(<\\)!--" (1 "< b"))
! ("--[ \t\n]*\\(>\\)" (1 "> b"))
! ;; Quotes (single or double) outside of tags should not introduce
! ;; strings. Be careful to call `syntax-ppss' on a position before
! ;; the one we're going to change, so as not to need to flush the
! ;; data we just computed.
! ((let (string-delimiters)
! (when (memq ?\" sgml-specials)
! (setq string-delimiters (cons ?\" string-delimiters)))
! (when (memq ?' sgml-specials)
! (setq string-delimiters (cons ?' string-delimiters)))
! (regexp-opt-charset string-delimiters))
! (0 (if (prog1 (zerop (car (syntax-ppss (match-beginning 0))))
! (goto-char (match-end 0)))
! (string-to-syntax ".")))))
"Syntactic keywords for `sgml-mode'.")
;; internal
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13844
; Package
emacs
.
(Fri, 01 Mar 2013 03:47:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 13844 <at> debbugs.gnu.org (full text, mbox):
> The patch below hopefully fixes both problems.
> I believe I have filed my copyright assignment with the FSF for
> Emacs already.
Thanks. I installed the first part, but the second breaks compilation
(because the regexp is computed during compilation, at which point
sgml-specials is not yet defined).
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13844
; Package
emacs
.
(Wed, 24 Feb 2016 05:44:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 13844 <at> debbugs.gnu.org (full text, mbox):
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>> The patch below hopefully fixes both problems.
>> I believe I have filed my copyright assignment with the FSF for
>> Emacs already.
>
> Thanks. I installed the first part, but the second breaks compilation
> (because the regexp is computed during compilation, at which point
> sgml-specials is not yet defined).
---
Additionally, if you have apostrophe in sgml-specials, this more common
usage will break:
Dave's bar
Now this tag will have incorrect highlighting:
<br />
---
This is now done correctly in the Emacs trunk, apparently, so I'm
closing this bug report.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Added tag(s) fixed.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Wed, 24 Feb 2016 05:44:02 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
13844 <at> debbugs.gnu.org and Dale <dale <at> codefu.org>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Wed, 24 Feb 2016 05:44:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 23 Mar 2016 11:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 9 years and 146 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.