Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Emacs and Perl syntax compile

2 views
Skip to first unread message

Harter, Douglas

unread,
Aug 1, 2003, 8:17:28 AM8/1/03
to Help Emacs (E-mail)
I am creating a good many Perl scripts on a Unix using emacs.

Can someone tell me what I need in my .emacs to do Perl syntax compiles from
emacs and allow compilation mode to handle the errors?

.


.


Kai Großjohann

unread,
Aug 1, 2003, 4:42:26 PM8/1/03
to
"Harter, Douglas" <dha...@state.pa.us> writes:

> Can someone tell me what I need in my .emacs to do Perl syntax compiles from
> emacs and allow compilation mode to handle the errors?

Perl syntax compiles?

Do you mean perl -c? It ought to be sufficient to set the variable
compile-command, perhaps from a mode hook:

(defun douglas-perl-setup ()
(setq compile-command (format "perl -c %s" (buffer-file-name))))
(add-hook 'perl-mode-hook 'douglas-perl-setup)

If you use cperl mode instead of perl mode, replace perl-mode-hook
with cperl-mode-hook.
--
~/.signature

andrew....@ps.ge.com

unread,
Aug 7, 2003, 9:42:21 AM8/7/03
to help-gn...@gnu.org
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))
(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 "
(buffer-file-name)))
(compilation-read-command prefix))
(call-interactively 'compile)))
(require 'perl-mode)
(require 'cperl-mode)
(define-key perl-mode-map "\C-c\C-c" 'perl-compile)
(define-key cperl-mode-map "\C-c\C-c" 'perl-compile)


> -----Original Message-----
> From: Harter, Douglas [mailto:dha...@state.pa.us]
> Sent: 01 August 2003 13:17
> To: Help Emacs (E-mail)
> Subject: Emacs and Perl syntax compile
>
>
> I am creating a good many Perl scripts on a Unix using emacs.
>

> Can someone tell me what I need in my .emacs to do Perl
> syntax compiles from
> emacs and allow compilation mode to handle the errors?
>
>
>

> .
>
>
> .
>
>
> _______________________________________________
> Help-gnu-emacs mailing list
> Help-gn...@gnu.org
> http://mail.gnu.org/mailman/listinfo/help-gnu-emacs
>


Kevin Rodgers

unread,
Aug 12, 2003, 12:37:31 PM8/12/03
to
andrew....@ps.ge.com 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 "
> (buffer-file-name)))
> (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

Stefan Monnier

unread,
Aug 12, 2003, 12:58:17 PM8/12/03
to
>> (require 'perl-mode)
>> (require 'cperl-mode)
> Can perl-mode and cperl-mode be used simultaneously?

At least in Emacs-CVS they can.


Stefan

Janusz S. Bień

unread,
Aug 21, 2003, 8:57:38 AM8/21/03
to help-gn...@gnu.org
"Harter, Douglas" <dha...@state.pa.us> writes:

> Can someone tell me what I need in my .emacs to do Perl syntax compiles from
> emacs and allow compilation mode to handle the errors?

There is `mode-compile.el', now at version 2.28 of 2003/04/01,
available from

http://www.tls.cena.fr/~boubaker/Emacs/

I haven't tried it yet, but it is mentioned in cperl-mode
documentation:

Note that to enable Compile choices in the menu you need to install
mode-compile.el.

Regards

Janusz

--
,
dr hab. Janusz S. Bien, prof. UW
Prof. Janusz S. Bien, Warsaw Uniwersity
jsb...@mimuw.edu.pl, jsb...@uw.edu.pl
http://www.orient.uw.edu.pl/~jsbien/
http://www.mimuw.edu.pl/~jsbien/


0 new messages