[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs and Perl syntax compile

From: Kevin Rodgers
Subject: Re: Emacs and Perl syntax compile
Date: Tue, 12 Aug 2003 10:37:31 -0600
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv: Gecko/20020406 Netscape6/6.2.2

address@hidden wrote:

I do this to set up C-c C-c to do the compile:

;;Compilation mode for perl files
(require 'compile)
(add-to-list 'compilation-error-regexp-alist
               '(".* \\([-a-zA-Z._/]+\\) line \\([0-9]+\\)." 1 2))

So far, so good.

(defun perl-compile (&optional prefix)
  "Compile perl file"
  (interactive "P")
(let* ((include-path (if (eq window-system 'w32) "-I%SP%" "-I$SP")) (compile-command (concat "perl "include-path " -cw "
         (compilation-read-command prefix))
    (call-interactively 'compile)))

Why not just:

(add-hook 'perl-mode-hook
          (lambda ()
            (set (make-local-variable 'compile-command)
                 (format "perl %s -cw %s"
                         (if (eq window-system 'w32) "-I%SP%" "-I$SP")
                         (file-name-nondirectory buffer-file-name)))))

(require 'perl-mode)
(require 'cperl-mode)

Can perl-mode and cperl-mode be used simultaneously?

(define-key perl-mode-map "\C-c\C-c" 'perl-compile)
(define-key cperl-mode-map "\C-c\C-c" 'perl-compile)

When compile-command is buffer local, you can just bind a key to the
normal compile command.

Kevin Rodgers

reply via email to

[Prev in Thread] Current Thread [Next in Thread]