* compile perl file, specify current buffer, using help effectively
@ 2006-05-03 2:04 David Schneider
2006-05-03 8:40 ` Eli Zaretskii
2006-05-03 10:39 ` David Hansen
0 siblings, 2 replies; 7+ messages in thread
From: David Schneider @ 2006-05-03 2:04 UTC (permalink / raw)
I am trying to use emacs as an IDE for perl development. I think it
would be useful to have a compile command that runs perl on the
current buffer I am editing. The compile command defaults to make -k.
I want to change it to perl xx where xx is the name of the current
buffer - is there some variable or special syntax I can use to get the
current filename? More important then the answer, is how do I figure
this out from the help. I have been using C-h a to try to search the
help. This gives me lists of commands or variables which may be
related - but I frequently find my questions are still unanswered.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: compile perl file, specify current buffer, using help effectively
2006-05-03 2:04 compile perl file, specify current buffer, using help effectively David Schneider
@ 2006-05-03 8:40 ` Eli Zaretskii
2006-05-03 10:39 ` David Hansen
1 sibling, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2006-05-03 8:40 UTC (permalink / raw)
> Date: Tue, 2 May 2006 22:04:56 -0400
> From: "David Schneider" <goedelsch@gmail.com>
>
> More important then the answer, is how do I figure this out from the
> help.
Using the index search of the Emacs manual is one of the most
efficient and powerful ways. Get to the Emacs manual (by typing
"C-h i" then "m Emacs RET", or select the Emacs manual from the
menu-bar's "Help" menu), then type "i TOPIC RET", where TOPIC is any
word or phrase that seems to be related to what you are looking for,
and Emacs will land you on the place in the manual where that topic is
discussed.
In this case, "i compile RET" lands me in a section where I find this
paragraph:
The default for the compilation command is normally `make -k', which
is correct most of the time for nontrivial programs. (*Note Make:
(make)Top.) If you have done `M-x compile' before, the default each
time is the command you used the previous time. `compile' stores this
command in the variable `compile-command', so setting that variable
specifies the default for the next use of `M-x compile'. If a file
specifies a file local value for `compile-command', that provides the
default when you type `M-x compile' in that file's buffer. *Note File
Variables::.
Would this paragraph tell you what you wanted to know?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: compile perl file, specify current buffer, using help effectively
2006-05-03 2:04 compile perl file, specify current buffer, using help effectively David Schneider
2006-05-03 8:40 ` Eli Zaretskii
@ 2006-05-03 10:39 ` David Hansen
2006-05-03 17:04 ` Kevin Rodgers
1 sibling, 1 reply; 7+ messages in thread
From: David Hansen @ 2006-05-03 10:39 UTC (permalink / raw)
On Tue, 2 May 2006 22:04:56 -0400 David Schneider wrote:
> I am trying to use emacs as an IDE for perl development. I think it
> would be useful to have a compile command that runs perl on the
> current buffer I am editing. The compile command defaults to make -k.
> I want to change it to perl xx where xx is the name of the current
> buffer - is there some variable or special syntax I can use to get the
> current filename? More important then the answer, is how do I figure
> this out from the help. I have been using C-h a to try to search the
> help. This gives me lists of commands or variables which may be
> related - but I frequently find my questions are still unanswered.
Not tested:
(add-hook 'perl-mode-hook
(lambda ()
(set (make-local-variable 'compile-command)
(concat "perl -w " (buffer-file-name)))))
Anyway i doub't that the compile mode will recognize the
perl errors and warnings.
David
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: compile perl file, specify current buffer, using help effectively
2006-05-03 10:39 ` David Hansen
@ 2006-05-03 17:04 ` Kevin Rodgers
0 siblings, 0 replies; 7+ messages in thread
From: Kevin Rodgers @ 2006-05-03 17:04 UTC (permalink / raw)
David Hansen wrote:
> On Tue, 2 May 2006 22:04:56 -0400 David Schneider wrote:
>> I am trying to use emacs as an IDE for perl development. I think it
>> would be useful to have a compile command that runs perl on the
>> current buffer I am editing. The compile command defaults to make -k.
>> I want to change it to perl xx where xx is the name of the current
>> buffer - is there some variable or special syntax I can use to get the
>> current filename? More important then the answer, is how do I figure
>> this out from the help. I have been using C-h a to try to search the
>> help. This gives me lists of commands or variables which may be
>> related - but I frequently find my questions are still unanswered.
`C-h a' is for commands. `C-h f' is for functions. `C-h v' is for
variables.
`C-h v compile-command' has a C mode example that David has converted
to Perl mode for you:
> Not tested:
>
> (add-hook 'perl-mode-hook
> (lambda ()
> (set (make-local-variable 'compile-command)
> (concat "perl -w " (buffer-file-name)))))
>
> Anyway i doub't that the compile mode will recognize the
> perl errors and warnings.
See compilation-error-regexp-alist:
;; Perl -w:
;; syntax error at automake line 922, near "':'"
;; Perl debugging traces
;; store::odrecall('File_A', 'x2') called at store.pm line 90
(".* at \\([^ \n]+\\) line \\([0-9]+\\)[,.\n]" 1 2)
--
Kevin
^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <mailman.1251.1146630892.9609.help-gnu-emacs@gnu.org>]
* Re: compile perl file, specify current buffer, using help effectively
[not found] <mailman.1251.1146630892.9609.help-gnu-emacs@gnu.org>
@ 2006-05-03 5:12 ` Stefan Monnier
2006-05-03 5:26 ` Burton Samograd
2006-05-03 13:54 ` yoorobot
2 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2006-05-03 5:12 UTC (permalink / raw)
> I am trying to use emacs as an IDE for perl development. I think it
> would be useful to have a compile command that runs perl on the
> current buffer I am editing. The compile command defaults to make -k.
> I want to change it to perl xx where xx is the name of the current
> buffer - is there some variable or special syntax I can use to get the
> current filename? More important then the answer, is how do I figure
> this out from the help.
Try C-h f compile RET (which will give you the online doc about the
`compile' command). It comes with an example of exactly what you want
to do.
Stefan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: compile perl file, specify current buffer, using help effectively
[not found] <mailman.1251.1146630892.9609.help-gnu-emacs@gnu.org>
2006-05-03 5:12 ` Stefan Monnier
@ 2006-05-03 5:26 ` Burton Samograd
2006-05-03 13:54 ` yoorobot
2 siblings, 0 replies; 7+ messages in thread
From: Burton Samograd @ 2006-05-03 5:26 UTC (permalink / raw)
"David Schneider" <goedelsch@gmail.com> writes:
> I am trying to use emacs as an IDE for perl development. I think it
> would be useful to have a compile command that runs perl on the
> current buffer I am editing. The compile command defaults to make -k.
> I want to change it to perl xx where xx is the name of the current
> buffer - is there some variable or special syntax I can use to get the
> current filename?
In your ~/.emacs you can put:
(setq compile-command "perl xx")
or you can just change the command name when it asks and then it will
use whatever you set it to for subsiquent compiles.
A handy binding in your .emacs is:
(global-set-key "\C-cc" 'compile)
Which calls compile when you hit Control c and then c.
> More important then the answer, is how do I figure
> this out from the help. I have been using C-h a to try to search the
> help. This gives me lists of commands or variables which may be
> related - but I frequently find my questions are still unanswered.
That is just something that takes time to learn. Emacs is big and
takes a *long* time to master. Asking questions (like you are doing)
is one of the best ways to get quick answers. You can then learn more
by taking the answer and exploring emacs more. Try looking at the
compile-command variable documentation using C-h v
(describe-variable). Another useful one is C-h f (describe-function),
which you can use to describe the compile function (where you can find
out about the compile-command variable, 5th paragraph).
--
burton samograd kruhft .at. gmail
kruhft.blogspot.com www.myspace.com/kruhft metashell.blogspot.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: compile perl file, specify current buffer, using help effectively
[not found] <mailman.1251.1146630892.9609.help-gnu-emacs@gnu.org>
2006-05-03 5:12 ` Stefan Monnier
2006-05-03 5:26 ` Burton Samograd
@ 2006-05-03 13:54 ` yoorobot
2 siblings, 0 replies; 7+ messages in thread
From: yoorobot @ 2006-05-03 13:54 UTC (permalink / raw)
this may be anathema, but I use viper-mode when I am editing *code*
(including perl) and so I can use the vi/vim style command mode:
<ESC>:!perl %
executes a shell program and feeds the current buffer as input.
- James
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2006-05-03 17:04 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-03 2:04 compile perl file, specify current buffer, using help effectively David Schneider
2006-05-03 8:40 ` Eli Zaretskii
2006-05-03 10:39 ` David Hansen
2006-05-03 17:04 ` Kevin Rodgers
[not found] <mailman.1251.1146630892.9609.help-gnu-emacs@gnu.org>
2006-05-03 5:12 ` Stefan Monnier
2006-05-03 5:26 ` Burton Samograd
2006-05-03 13:54 ` yoorobot
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.