;;my after-save-hook to cperl (defun myperl-check-syntax () (interactive) (if (not (equal mode-name "CPerl")) ;;ignore () ;;get the full path of this file (setq source-full-path (buffer-file-name)) ;;clear the buffer of earlier error (set-buffer (get-buffer-create "perlsyn")) (erase-buffer) ;;set the perl5lib (setenv "PERL5LIB" "/usr/lib/perl5") ;;execute perl -wc (call-process "perl" nil "perlsyn" nil "-wc" source-full-path) ;;execute podchecker ;; (call-process "podchecker" nil "perlsyn" nil ;; source-full-path) ;; checks if perl returned a syntax OK string (if (not (equal (substring (buffer-string) -3 -1) "OK")) (switch-to-buffer "perlsyn"))) ) (add-hook 'after-save-hook 'myperl-check-syntax)
In reply to check syntax of perl code and pod in emacs by InfiniteLoop
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |