kgoess has asked for the wisdom of the Perl Monks concerning the following question:

Hi, all,
I don't use emacs, but the guy sitting next to me is learning to program in the Linux environment and doing it with emacs. Unfortunately, he's complaining that single quotes inside my embedded POD is screwing up the way emacs color-codes the rest of the script. Is there a standard solution to this? If it keeps up, I may have to wrestle him to the ground to keep him from moving all my POD to the bottom of the scripts.
=pod It's a single quote that does it. =cut ...highlighting down here is all fubared.

Replies are listed 'Best First'.
Re: emacs and quotes in pod
by ysth (Canon) on Nov 02, 2004 at 01:27 UTC
Re: emacs and quotes in pod
by Zaxo (Archbishop) on Nov 02, 2004 at 01:29 UTC

    I suspect your friend is using perl-mode, which is rather simple-minded. Have him try cperl-mode instead. It is known to understand POD sections.

    After Compline,
    Zaxo

Re: emacs and quotes in pod
by Old_Gray_Bear (Bishop) on Nov 02, 2004 at 01:20 UTC
    At the risk of precipitating a Holy War, this sounds like an emacs configuration problem. Perhaps your friend should consult with an emacs-guru, or perhaps you can convince him, since he wants to edit the code, to just expand the contractions (it's => it is, don't => do not, etc) rather than move the POD around. It will, after all, be less error prone to add a few characters than to do wholesale cun'n'paste.

    ----
    I Go Back to Sleep, Now.

    OGB

Re: emacs and quotes in pod
by diotalevi (Canon) on Nov 02, 2004 at 01:19 UTC
    Perhaps its his version. I'm using GNU Emacs 21.3.50.1 on Windows and both cperl-mode and perl-mode handle your test case.
Re: emacs and quotes in pod
by perlcapt (Pilgrim) on Nov 02, 2004 at 01:27 UTC
    I have had the same problem, both in emacs and with Eclipse/EPIC with the editor. I was able to work around by adding a comment (outside of the POD) with a single quote to balance the other, as in #'

    Just a workaround.

    perlcapt
    -ben
Re: emacs and quotes in pod
by demerphq (Chancellor) on Nov 02, 2004 at 11:45 UTC

    Use a for block:

    =pod It's a single quote that does it. =for borked_emacs_perlmode ' =cut

    Or use a comment:

    =pod It's a single quote that does it. =cut #' without this emacs w/borked perlmode gets upset

    I also like the regex version of this problem. If you want to match a simple quoted string many people would do: /(["'])((?:(?!\1).)+)\1/s but /([""''])((?:(?!\1).)+)(\1)/s does the same thing and doesn't cause highlighting editors problems.

    BTW, personally I would include the snide comments. IMO it will needle your colleague enough that he fixes the real problem, that his highlighting is b0rked. :-)

    ---
    demerphq

Re: emacs and quotes in pod
by ChaCha (Initiate) on Nov 02, 2004 at 18:42 UTC
    Yes. I would be the colleague in question. Thank you for your words of wisdom. Now as for his wrestling abilities, I am doubtful...