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

Hi,

I use Xemacs to write code in Perl, sometimes I forget to set ";" at the end of code

Somebody has a el code to check and to warn whether ";" is written, or not?

Thanks in advance

Murcia

20050219 Edit by castaway: Changed title from 'xemacs'

Replies are listed 'Best First'.
Re: xemacs el code to check for ";"
by rg0now (Chaplain) on Feb 14, 2005 at 11:37 UTC
    You mean you want to have (X)emacs to test for the ';' at the end of every line of your code or at the end of the file?

    By all means, a pretty straightforward way to test whether a line of code (or even an entire block) was syntactically correct is to start to type a new line by C-j (newline-and-indent) and check the indentation of the new line. If there were problems then the new line will be erroneously indented. It sorts of work for me...

    By the way, you use cperl-mode, don't you?

    Update: fixed typo

    rg0now

Re: xemacs el code to check for ";"
by borisz (Canon) on Feb 14, 2005 at 11:11 UTC
    I doubt el code can do that for you. El did not know where your statement end.
    Boris
Re: xemacs el code to check for ";"
by artist (Parson) on Feb 14, 2005 at 15:56 UTC
    Use cperl-mode. That is the best advice you can get. It automatically check the syntax (in most cases). It has syntax hilighting. So if you haven't typed ';' at the end, it will reflect in instant visibility.

    Read more at C-perl mode on emacs wiki.

Re: xemacs el code to check for ";"
by Akhasha (Scribe) on Feb 14, 2005 at 20:44 UTC
    I must agree that cperl-mode is worthwhile. Going beyond just checking for semicolons, while I used to check syntax with M-! perl -c <filename> now I use M-x cperl-check-syntax
    It gives a buffer with a line for each error that links directly to the line of code in question.