unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* [cperl-mode] fontification problem with PODs
@ 2009-10-21 13:36 LanX
  2009-10-24  6:12 ` Ilya Zakharevich
  2009-12-07  0:12 ` Joseph Brenner
  0 siblings, 2 replies; 14+ messages in thread
From: LanX @ 2009-10-21 13:36 UTC (permalink / raw)
  To: help-gnu-emacs

Hi

I experienced a problem with the fontification of POD's.

In the following example the second line is not classified as pod but
the keyword "for" is considered part of a loop statement.

--------------------------
lanx@nc10-ubuntu:~/tmp$ cat perlpod.pm
for (1..9) {print}
=for comment

This B<document> is in Pod format.  To read this, use a Pod formatter,
like "perldoc perlpod".

=cut
---------------------------

which might be OK since there is an empty line missing between POD and
code.

So adding a newline at the second line should solve the problem, but
doesn't do so!!!


Strangely this problem is NOT present when calling emacs with -Q

---------------------------
lanx@nc10-ubuntu:~/tmp$ emacs -Q perlpod.pm -f cperl-mode
---------------------------

So adding the newline solves the problem!
And calling "M-x describe-text-properties" shows that the POD-text is
classified as such.

This emacs is bundled with cperl-mode.5.23.

Now I tried to figure out which cperl-mode version is causing the
problem, since I had 6.2 loaded in my configs.

---------------------------
lanx@nc10-ubuntu:~/tmp$ emacs -Q -l cperl-mode.el perlpod.pm -f cperl-
mode
lanx@nc10-ubuntu:~/tmp$ ll cperl-mode.el
lrwxrwxrwx 1 lanx lanx 18 2009-10-21 05:51 cperl-mode.el -> cperl-
mode.el.5.24
lanx@nc10-ubuntu:~/tmp$ ll cperl-mode.el*
lrwxrwxrwx 1 lanx lanx     18 2009-10-21 05:51 cperl-mode.el -> cperl-
mode.el.5.24
-r-------- 1 lanx lanx 399064 2009-10-21 05:48 cperl-mode.el.5.22
-r-------- 1 lanx lanx 395839 2009-10-21 05:32 cperl-mode.el.5.24
-r-------- 1 lanx lanx 402932 2009-10-21 05:32 cperl-mode.el.6.2
---------------------------

But it doesn't matter which version I'm loading the problem remains. I
also tried emacs23 instead of emacs22, without success.

It seems that loading another cperl-mode version causes conflicts with
the bundled version!

So effectively one has to stick with the bundled version ... :(

cheers
  Rolf


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

* Re: [cperl-mode] fontification problem with PODs
  2009-10-21 13:36 [cperl-mode] fontification problem with PODs LanX
@ 2009-10-24  6:12 ` Ilya Zakharevich
  2009-10-31  4:15   ` Will Willis
  2009-12-07  0:12 ` Joseph Brenner
  1 sibling, 1 reply; 14+ messages in thread
From: Ilya Zakharevich @ 2009-10-24  6:12 UTC (permalink / raw)
  To: help-gnu-emacs

On 2009-10-21, LanX <lanx.perl@googlemail.com> wrote:
> In the following example the second line is not classified as pod but
> the keyword "for" is considered part of a loop statement.

Since it is not POD, I do not see any problem

> --------------------------
> lanx@nc10-ubuntu:~/tmp$ cat perlpod.pm
> for (1..9) {print}
>=for comment

> It seems that loading another cperl-mode version causes conflicts with
> the bundled version!

This may happen if the buggy version is preloaded...  [I do not see
any problem with my version, both with emacs v19 and v21.]

> So effectively one has to stick with the bundled version ... :(

One may try to remove the buggy version from preloaded stuff (do not
remember how).

Yours,
Ilya


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

* Re: [cperl-mode] fontification problem with PODs
  2009-10-24  6:12 ` Ilya Zakharevich
@ 2009-10-31  4:15   ` Will Willis
  0 siblings, 0 replies; 14+ messages in thread
From: Will Willis @ 2009-10-31  4:15 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1213 bytes --]

over the years I've had to do alot of repeated M-x cperl-mode whilst coding
in perl scripts containing POD - as the syntax highlighting would get lost
or confused part-way down the file (usually turning everything into the
comment color). Just something I've dealt with and never really attempted to
fix.

I'm glad I'm not the only one having issues.

-Will

On Sat, Oct 24, 2009 at 1:12 AM, Ilya Zakharevich <nospam-abuse@ilyaz.org>wrote:

> On 2009-10-21, LanX <lanx.perl@googlemail.com> wrote:
> > In the following example the second line is not classified as pod but
> > the keyword "for" is considered part of a loop statement.
>
> Since it is not POD, I do not see any problem
>
> > --------------------------
> > lanx@nc10-ubuntu:~/tmp$ cat perlpod.pm
> > for (1..9) {print}
> >=for comment
>
> > It seems that loading another cperl-mode version causes conflicts with
> > the bundled version!
>
> This may happen if the buggy version is preloaded...  [I do not see
> any problem with my version, both with emacs v19 and v21.]
>
> > So effectively one has to stick with the bundled version ... :(
>
> One may try to remove the buggy version from preloaded stuff (do not
> remember how).
>
> Yours,
> Ilya
>

[-- Attachment #2: Type: text/html, Size: 1849 bytes --]

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

* Re: [cperl-mode] fontification problem with PODs
  2009-10-21 13:36 [cperl-mode] fontification problem with PODs LanX
  2009-10-24  6:12 ` Ilya Zakharevich
@ 2009-12-07  0:12 ` Joseph Brenner
  2009-12-09 12:49   ` LanX
  1 sibling, 1 reply; 14+ messages in thread
From: Joseph Brenner @ 2009-12-07  0:12 UTC (permalink / raw)
  To: help-gnu-emacs


LanX <lanx.perl@googlemail.com> writes:

> I experienced a problem with the fontification of POD's.
>
> In the following example the second line is not classified as pod but
> the keyword "for" is considered part of a loop statement.
>
> --------------------------
> lanx@nc10-ubuntu:~/tmp$ cat perlpod.pm
> for (1..9) {print}
> =for comment
>
> This B<document> is in Pod format.  To read this, use a Pod formatter,
> like "perldoc perlpod".
>
> =cut
> ---------------------------
>
> which might be OK since there is an empty line missing between POD and
> code.
>
> So adding a newline at the second line should solve the problem, but
> doesn't do so!!!

I was going to point out the same thing, but also, I recommend running
the "podchecker" program occasionally.

pod is cool, but very wasteful of vertical whitespace, and weirdly
enough it's whitespace sensitive: it wants completely empty blank lines
before and after the tags -- blank lines with spaces on them are not
good enough.

> Strangely this problem is NOT present when calling emacs with -Q
>
> ---------------------------
> lanx@nc10-ubuntu:~/tmp$ emacs -Q perlpod.pm -f cperl-mode
> ---------------------------
>
> So adding the newline solves the problem!
> And calling "M-x describe-text-properties" shows that the POD-text is
> classified as such.

This is indeed sounding pretty weird.

> It seems that loading another cperl-mode version causes conflicts with
> the bundled version!
>
> So effectively one has to stick with the bundled version ... :(

Well... I might suspect a conflict between something else you normally
load and cperl-mode.  It's difficult to say what... remember that emacs
has just one big global namespace, so hypothetically all sorts of
action-at-a-distance problems are possible with poorly written elisp.



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

* Re: fontification problem with PODs
  2009-12-07  0:12 ` Joseph Brenner
@ 2009-12-09 12:49   ` LanX
  2010-05-02  4:32     ` Ilya Zakharevich
  0 siblings, 1 reply; 14+ messages in thread
From: LanX @ 2009-12-09 12:49 UTC (permalink / raw)
  To: help-gnu-emacs

Hi Joe

What I learned in this thread is that one simply has to stick with the
bundled version of cperl-mode.

Loading another version causes conflicts...

So if you need a newer version of cperl better upgrade emacs, since
the newest version is in the repository now.

Cheers
  Rolf


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

* Re: fontification problem with PODs
  2009-12-09 12:49   ` LanX
@ 2010-05-02  4:32     ` Ilya Zakharevich
  2010-05-02 14:07       ` Alan Mackenzie
  0 siblings, 1 reply; 14+ messages in thread
From: Ilya Zakharevich @ 2010-05-02  4:32 UTC (permalink / raw)
  To: help-gnu-emacs

On 2009-12-09, LanX <lanx.perl@googlemail.com> wrote:
> Hi Joe
>
> What I learned in this thread is that one simply has to stick with the
> bundled version of cperl-mode.
>
> Loading another version causes conflicts...
>
> So if you need a newer version of cperl better upgrade emacs, since
> the newest version is in the repository now.

AFAIU, the question is not whether the version is "newer" or "older",
but whether it is mine or not.  My versions work.  Bundled do not.

Moreover, preloading a bundled version breaks something when somebody
loads mine version later.  Sorry, I cannot investigate it since
computers around do not have anything runnable which is newer than
v21 (which does not preload)...

Hope this helps,
Ilya


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

* Re: fontification problem with PODs
  2010-05-02  4:32     ` Ilya Zakharevich
@ 2010-05-02 14:07       ` Alan Mackenzie
  2010-05-04  3:33         ` Ilya Zakharevich
  0 siblings, 1 reply; 14+ messages in thread
From: Alan Mackenzie @ 2010-05-02 14:07 UTC (permalink / raw)
  To: help-gnu-emacs

Ilya Zakharevich <nospam-abuse@ilyaz.org> wrote:
> On 2009-12-09, LanX <lanx.perl@googlemail.com> wrote:
>> Hi Joe

>> What I learned in this thread is that one simply has to stick with the
>> bundled version of cperl-mode.

>> Loading another version causes conflicts...

>> So if you need a newer version of cperl better upgrade emacs, since
>> the newest version is in the repository now.

> AFAIU, the question is not whether the version is "newer" or "older",
> but whether it is mine or not.  My versions work.  Bundled do not.

And your version is available from which URL, please?

> Moreover, preloading a bundled version breaks something when somebody
> loads mine version later.  Sorry, I cannot investigate it since
> computers around do not have anything runnable which is newer than
> v21 (which does not preload)...

> Hope this helps,
> Ilya

-- 
Alan Mackenzie (Nuremberg, Germany).



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

* Re: fontification problem with PODs
  2010-05-02 14:07       ` Alan Mackenzie
@ 2010-05-04  3:33         ` Ilya Zakharevich
  2010-05-04 10:39           ` Alan Mackenzie
  0 siblings, 1 reply; 14+ messages in thread
From: Ilya Zakharevich @ 2010-05-04  3:33 UTC (permalink / raw)
  To: help-gnu-emacs

On 2010-05-02, Alan Mackenzie <acm@muc.de> wrote:
> Ilya Zakharevich <nospam-abuse@ilyaz.org> wrote:
>> On 2009-12-09, LanX <lanx.perl@googlemail.com> wrote:
>>> Hi Joe
>
>>> What I learned in this thread is that one simply has to stick with the
>>> bundled version of cperl-mode.
>
>>> Loading another version causes conflicts...
>
>>> So if you need a newer version of cperl better upgrade emacs, since
>>> the newest version is in the repository now.
>
>> AFAIU, the question is not whether the version is "newer" or "older",
>> but whether it is mine or not.  My versions work.  Bundled do not.
>
> And your version is available from which URL, please?

I think it is there in the file.  Should be in
   ilyaz.org/software/emacs/

 (But, as I said, with newer versions of Emacs I suspect one ALSO
  needs to prune all cperl-* symbols first - there is some
  contamination left from the bundled (pre-loaded!) version.)

Yours,
Ilya


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

* Re: fontification problem with PODs
  2010-05-04  3:33         ` Ilya Zakharevich
@ 2010-05-04 10:39           ` Alan Mackenzie
  2010-05-04 14:55             ` LanX
  2010-05-06 20:08             ` Ilya Zakharevich
  0 siblings, 2 replies; 14+ messages in thread
From: Alan Mackenzie @ 2010-05-04 10:39 UTC (permalink / raw)
  To: help-gnu-emacs

Ilya Zakharevich <nospam-abuse@ilyaz.org> wrote:
> On 2010-05-02, Alan Mackenzie <acm@muc.de> wrote:
>> Ilya Zakharevich <nospam-abuse@ilyaz.org> wrote:
>>> On 2009-12-09, LanX <lanx.perl@googlemail.com> wrote:
>>>> Hi Joe

>>>> What I learned in this thread is that one simply has to stick with the
>>>> bundled version of cperl-mode.

>>>> Loading another version causes conflicts...

>>>> So if you need a newer version of cperl better upgrade emacs, since
>>>> the newest version is in the repository now.

>>> AFAIU, the question is not whether the version is "newer" or "older",
>>> but whether it is mine or not.  My versions work.  Bundled do not.

>> And your version is available from which URL, please?

> I think it is there in the file.  Should be in
>   ilyaz.org/software/emacs/

Thanks.

> (But, as I said, with newer versions of Emacs I suspect one ALSO
>  needs to prune all cperl-* symbols first - there is some
>  contamination left from the bundled (pre-loaded!) version.)

Which is a way of saying that the initialisation for cperl-mode isn't
watertight.  ;-)

> Yours,
> Ilya

-- 
Alan Mackenzie (Nuremberg, Germany).



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

* Re: fontification problem with PODs
  2010-05-04 10:39           ` Alan Mackenzie
@ 2010-05-04 14:55             ` LanX
  2010-05-06 20:08             ` Ilya Zakharevich
  1 sibling, 0 replies; 14+ messages in thread
From: LanX @ 2010-05-04 14:55 UTC (permalink / raw)
  To: help-gnu-emacs


> Which is a way of saying that the initialisation for cperl-mode isn't
> watertight.  ;-)

no it's a way to say that emacs is not watertight.

There is no automatic testing system and every little incompatible
changes can easily break a complex mode like cperl.

I recently had a long discussion until the dev team admitted that they
screwed font locking in compilation buffer because they started
appending newlines to all regexes ...


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

* Re: fontification problem with PODs
  2010-05-04 10:39           ` Alan Mackenzie
  2010-05-04 14:55             ` LanX
@ 2010-05-06 20:08             ` Ilya Zakharevich
  2010-05-07  1:31               ` Juanma Barranquero
       [not found]               ` <mailman.29.1273195927.9285.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 14+ messages in thread
From: Ilya Zakharevich @ 2010-05-06 20:08 UTC (permalink / raw)
  To: help-gnu-emacs

On 2010-05-04, Alan Mackenzie <acm@muc.de> wrote:
>> (But, as I said, with newer versions of Emacs I suspect one ALSO
>>  needs to prune all cperl-* symbols first - there is some
>>  contamination left from the bundled (pre-loaded!) version.)
>
> Which is a way of saying that the initialisation for cperl-mode isn't
> watertight.  ;-)

Could you be more specific with your "watertight" adjective?  How
should a module writer deal with a possibility to have a buggy version
preloaded?

  [And keep in mind that I have no clue how `defvar' should work with
   preloaded modules]

Yours,
Ilya


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

* Re: fontification problem with PODs
  2010-05-06 20:08             ` Ilya Zakharevich
@ 2010-05-07  1:31               ` Juanma Barranquero
       [not found]               ` <mailman.29.1273195927.9285.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 14+ messages in thread
From: Juanma Barranquero @ 2010-05-07  1:31 UTC (permalink / raw)
  To: help-gnu-emacs

On Thu, May 6, 2010 at 22:08, Ilya Zakharevich <nospam-abuse@ilyaz.org> wrote:

> How
> should a module writer deal with a possibility to have a buggy version
> preloaded?

Assuming your version is loaded with `load' (because with `require' it
won't be loaded if the buggy version already is), perhaps some
variation of this:

(when (featurep 'cperl-mode)  ; or some other check
  (unload-feature 'cperl-mode)
  (require 'cperl-mode))

How effective that is depends on how well `unload-feature' deals with
cperl-mode. (Not very well, at the moment, but a
cperl-mode-unload-function could be added to standard Emacs.)

    Juanma




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

* Re: fontification problem with PODs
       [not found]               ` <mailman.29.1273195927.9285.help-gnu-emacs@gnu.org>
@ 2010-05-07  2:55                 ` Stefan Monnier
  2010-05-08 21:50                   ` Juanma Barranquero
  0 siblings, 1 reply; 14+ messages in thread
From: Stefan Monnier @ 2010-05-07  2:55 UTC (permalink / raw)
  To: help-gnu-emacs

>> How should a module writer deal with a possibility to have a buggy
>> version preloaded?

> Assuming your version is loaded with `load' (because with `require' it
> won't be loaded if the buggy version already is), perhaps some
> variation of this:

> (when (featurep 'cperl-mode)  ; or some other check
>   (unload-feature 'cperl-mode)
>   (require 'cperl-mode))

> How effective that is depends on how well `unload-feature' deals with
> cperl-mode. (Not very well, at the moment, but a
> cperl-mode-unload-function could be added to standard Emacs.)

Emacs's cperl-mode is not preloaded, so (featurep 'cperl-mode) should
pretty much always return nil.
If there are issues, they would come from the parts of Emacs's
cperl-mode.el that have a ;;;###autoload cookie.  Everything else should
have no effect.


        Stefan


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

* Re: fontification problem with PODs
  2010-05-07  2:55                 ` Stefan Monnier
@ 2010-05-08 21:50                   ` Juanma Barranquero
  0 siblings, 0 replies; 14+ messages in thread
From: Juanma Barranquero @ 2010-05-08 21:50 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: help-gnu-emacs

On Fri, May 7, 2010 at 04:55, Stefan Monnier <monnier@iro.umontreal.ca> wrote:

> Emacs's cperl-mode is not preloaded, so (featurep 'cperl-mode) should
> pretty much always return nil.

I took Ilya's "preloaded" as meaning "already loaded".

    Juanma




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

end of thread, other threads:[~2010-05-08 21:50 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-21 13:36 [cperl-mode] fontification problem with PODs LanX
2009-10-24  6:12 ` Ilya Zakharevich
2009-10-31  4:15   ` Will Willis
2009-12-07  0:12 ` Joseph Brenner
2009-12-09 12:49   ` LanX
2010-05-02  4:32     ` Ilya Zakharevich
2010-05-02 14:07       ` Alan Mackenzie
2010-05-04  3:33         ` Ilya Zakharevich
2010-05-04 10:39           ` Alan Mackenzie
2010-05-04 14:55             ` LanX
2010-05-06 20:08             ` Ilya Zakharevich
2010-05-07  1:31               ` Juanma Barranquero
     [not found]               ` <mailman.29.1273195927.9285.help-gnu-emacs@gnu.org>
2010-05-07  2:55                 ` Stefan Monnier
2010-05-08 21:50                   ` Juanma Barranquero

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