all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* temp stop syntax coloring on region of mismatched quotes
@ 2008-12-04  2:58 Xah Lee
  2008-12-04 11:00 ` Paul R
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Xah Lee @ 2008-12-04  2:58 UTC (permalink / raw)
  To: help-gnu-emacs

sometimes in some source code, the double quote doesn't match and
makes the rest of the code from that point on syntax colored wrong.
Very annoying.

Is there anyway to make it not syntax color the region of text where
the quote becomes odd?

For example, i have this text in the middle of a html file:

<pre class="code">
&lt;img src="\([^"]+\)" alt="math surface" width="\([0-9]+\)" height="\
([0-9]+\)"&gt;
</pre>

and from this poitn on all syntax coloring gets wrong.
My usual workaround is to add a html comment

<!-- " -->

right after the line, but that's kinda a pain. I wish to temporarily
tell emacs to not do syntax coloring on the problematic region. Is
there a way?

Thanks.

  Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: temp stop syntax coloring on region of mismatched quotes
  2008-12-04  2:58 temp stop syntax coloring on region of mismatched quotes Xah Lee
@ 2008-12-04 11:00 ` Paul R
       [not found] ` <mailman.1910.1228388432.26697.help-gnu-emacs@gnu.org>
  2008-12-04 16:45 ` Drew Adams
  2 siblings, 0 replies; 5+ messages in thread
From: Paul R @ 2008-12-04 11:00 UTC (permalink / raw)
  To: Xah Lee; +Cc: help-gnu-emacs

Hi Xah,

Xah> sometimes in some source code, the double quote doesn't match and
Xah> makes the rest of the code from that point on syntax colored wrong.
Xah> Very annoying.

Xah> Is there anyway to make it not syntax color the region of text
Xah> where the quote becomes odd?

I also often face this problem. I don't know much of how to make
a syntax highlighting mode for emacs, but AFAIU fontlock only works on
current line. For that reason, modes often re-implement their own
search-forward based fontlock system for quoted strings.

I guess the major mode should be fixed to detect what is a quote for
quoting string and what is not. 
On Wed, 3 Dec 2008 18:58:10 -0800 (PST), Xah Lee <xahlee@gmail.com> said:

Xah> <pre class="code"> &lt;img src="\([^"]+\)" alt="math surface"
Xah> width="\([0-9]+\)" height="\ ([0-9]+\)"&gt; </pre>

BTW, is this XHTML compliant ?

-- 
  Paul




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

* Re: temp stop syntax coloring on region of mismatched quotes
       [not found] ` <mailman.1910.1228388432.26697.help-gnu-emacs@gnu.org>
@ 2008-12-04 11:09   ` Andreas Politz
  2008-12-04 16:43   ` Xah Lee
  1 sibling, 0 replies; 5+ messages in thread
From: Andreas Politz @ 2008-12-04 11:09 UTC (permalink / raw)
  To: help-gnu-emacs

Paul R wrote:
> Hi Xah,
> 
[...]
> 
> Xah> <pre class="code"> &lt;img src="\([^"]+\)" alt="math surface"
> Xah> width="\([0-9]+\)" height="\ ([0-9]+\)"&gt; </pre>
> 
> BTW, is this XHTML compliant ?
> 

Stop techgeeking ! ;-)

-ap


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

* Re: temp stop syntax coloring on region of mismatched quotes
       [not found] ` <mailman.1910.1228388432.26697.help-gnu-emacs@gnu.org>
  2008-12-04 11:09   ` Andreas Politz
@ 2008-12-04 16:43   ` Xah Lee
  1 sibling, 0 replies; 5+ messages in thread
From: Xah Lee @ 2008-12-04 16:43 UTC (permalink / raw)
  To: help-gnu-emacs

On Dec 4, 3:00 am, Paul R <paul.r...@gmail.com> wrote:
> Hi Xah,
>
> Xah> sometimes in some source code, the double quote doesn't match and
> Xah> makes the rest of the code from that point on syntax colored wrong.
> Xah> Very annoying.
>
> Xah> Is there anyway to make it not syntax color the region of text
> Xah> where the quote becomes odd?
>
> I also often face this problem. I don't know much of how to make
> a syntax highlighting mode for emacs, but AFAIU fontlock only works on
> current line. For that reason, modes often re-implement their own
> search-forward based fontlock system for quoted strings.
>
> I guess the major mode should be fixed to detect what is a quote for
> quoting string and what is not.
> On Wed, 3 Dec 2008 18:58:10 -0800 (PST), Xah Lee <xah...@gmail.com> said:
>
> Xah> <pre class="code"> &lt;img src="\([^"]+\)" alt="math surface"
> Xah> width="\([0-9]+\)" height="\ ([0-9]+\)"&gt; </pre>
>
> BTW, is this XHTML compliant ?

not sure, but is xhtml 4 strict valid. It's from:

• How To Add “alt=” To Image Tags With Emacs Lisp
  http://xahlee.org/emacs/lisp_update_image_tag.html

  Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: temp stop syntax coloring on region of mismatched quotes
  2008-12-04  2:58 temp stop syntax coloring on region of mismatched quotes Xah Lee
  2008-12-04 11:00 ` Paul R
       [not found] ` <mailman.1910.1228388432.26697.help-gnu-emacs@gnu.org>
@ 2008-12-04 16:45 ` Drew Adams
  2 siblings, 0 replies; 5+ messages in thread
From: Drew Adams @ 2008-12-04 16:45 UTC (permalink / raw)
  To: 'Xah Lee', help-gnu-emacs

> sometimes in some source code, the double quote doesn't match and
> makes the rest of the code from that point on syntax colored wrong.
> Very annoying.
> 
> Is there anyway to make it not syntax color the region of text where
> the quote becomes odd? For example, i have this text in the middle
> of a html file:
> 
> <pre class="code">
> &lt;img src="\([^"]+\)" alt="math surface" width="\([0-9]+\)" 
> height="\
> ([0-9]+\)"&gt;
> </pre>
> 
> and from this poitn on all syntax coloring gets wrong.
> My usual workaround is to add a html comment
> <!-- " -->
> right after the line, but that's kinda a pain. I wish to temporarily
> tell emacs to not do syntax coloring on the problematic region. Is
> there a way?

Temporarily? Yes: just insert another `"' character. Seriously. Remove it later,
or leave it in, in a comment, as you suggested. Typing `"' is the quickest way I
know of to handle this temporarily.

More than temporarily - e.g. for code that needs to have an unpaired `"' char:
no, not that I know of (except for adding a comment, if the code is not
read-only).

I agree about the annoyance, but this is likely to be a hard nut to crack in a
satisfactory and general way.

I highlight "..." (and `...') in Info, for instance, and the odd `"' throws off
highlighting for the rest of the current Info node (or until another odd `"').
Fortunately, this occurs rarely in Info, but it is annoying when it happens.

http://www.emacswiki.org/emacs/InfoPlus






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

end of thread, other threads:[~2008-12-04 16:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-04  2:58 temp stop syntax coloring on region of mismatched quotes Xah Lee
2008-12-04 11:00 ` Paul R
     [not found] ` <mailman.1910.1228388432.26697.help-gnu-emacs@gnu.org>
2008-12-04 11:09   ` Andreas Politz
2008-12-04 16:43   ` Xah Lee
2008-12-04 16:45 ` Drew Adams

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.