From: Xah <xahlee@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: What does 'run' do in cperl-mode?
Date: Fri, 25 Jul 2008 07:55:29 -0700 (PDT) [thread overview]
Message-ID: <0ded5ecd-f5f6-4a8e-9d19-f61bf0401022@v39g2000pro.googlegroups.com> (raw)
In-Reply-To: eb1c6159-4816-48b0-9431-4ca0edff3c9c@v1g2000pra.googlegroups.com
On Jul 24, 10:36 am, formido <form...@gmail.com> wrote:
> So, I've got:
>
> print "Hello World\n";
>
> ... in the buffer and it's saved. I can use the debugger command to
> run it. Strangely to me, 'run' is disabled. What does 'run' do? In
> other IDEs I've used, I type some code, then I either compile or don't
> depending on the language, and then I run. What's different here?
I don't know. But you can run it by typing Alt+x shell-command
(shortcut Alt+x !) then type “perl ‹filename›”.
Or, you can write a short elisp so that pressing a key will run the
program in current buffer.
(defun run-current-file ()
"Execute or compile the current file.
For example, if the current buffer is the file x.pl,
then it'll call “perl x.pl” in a shell.
The file can be php, perl, python, bash, java.
File suffix is used to determine what program to run."
(interactive)
(let (ext-map file-name file-ext prog-name cmd-str)
; get the file name
; get the program name
; run it
(setq ext-map
'(
("php" . "php")
("pl" . "perl")
("py" . "python")
("sh" . "bash")
("java" . "javac")
)
)
(setq file-name (buffer-file-name))
(setq file-ext (file-name-extension file-name))
(setq prog-name (cdr (assoc file-ext ext-map)))
(setq cmd-str (concat prog-name " " file-name))
(shell-command cmd-str)))
(global-set-key (kbd "<f7>") 'run-current-file)
for detail, see:
http://xahlee.org/emacs/elisp_run_current_file.html
> More generally, when confronted by a menu command, how can I easily go
> to its definition?
Type Alt+x describe-key, then pull the menu. Then, you'll get the
command name run by that menu. Then, type Alt+x describe-function.
It'll pop up the online doc of the function with link to the source
code where the function is defined.
Xah
∑ http://xahlee.org/
☄
next prev parent reply other threads:[~2008-07-25 14:55 UTC|newest]
Thread overview: 86+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-24 17:36 What does 'run' do in cperl-mode? formido
2008-07-25 3:02 ` formido
2008-07-25 14:55 ` Xah [this message]
2008-07-25 16:41 ` Ted Zlatanov
2008-07-25 21:55 ` Xah
2008-07-26 0:05 ` Florian Beck
2008-07-26 2:04 ` Xah
2008-07-26 0:33 ` Lennart Borgman (gmail)
[not found] ` <mailman.15432.1217032437.18990.help-gnu-emacs@gnu.org>
2008-07-26 1:41 ` Xah
2008-07-28 11:42 ` Nikolaj Schumacher
2008-07-28 11:58 ` Thien-Thi Nguyen
2008-07-28 13:39 ` Ted Zlatanov
2008-07-28 15:02 ` Xah Lee
2008-07-28 16:34 ` Lennart Borgman (gmail)
[not found] ` <mailman.15504.1217262880.18990.help-gnu-emacs@gnu.org>
2008-07-28 17:42 ` Xah Lee
2008-07-28 22:44 ` Lennart Borgman (gmail)
2008-07-28 19:57 ` Ted Zlatanov
2008-07-28 20:28 ` Xah Lee
2008-07-28 21:31 ` Ted Zlatanov
2008-07-28 22:09 ` Xah Lee
2008-07-29 14:33 ` Ted Zlatanov
2008-07-29 23:20 ` Xah
[not found] ` <mailman.15488.1217245359.18990.help-gnu-emacs@gnu.org>
2008-07-28 15:22 ` Xah Lee
2008-07-28 22:14 ` Nikolaj Schumacher
[not found] ` <mailman.15520.1217283300.18990.help-gnu-emacs@gnu.org>
2008-07-28 22:54 ` Xah Lee
2008-07-29 3:32 ` Eli Zaretskii
[not found] ` <mailman.15531.1217302334.18990.help-gnu-emacs@gnu.org>
2008-07-29 7:25 ` Xah
2008-07-29 7:46 ` Juanma Barranquero
[not found] ` <mailman.15537.1217317612.18990.help-gnu-emacs@gnu.org>
2008-07-29 8:41 ` Xah
2008-07-29 12:56 ` Juanma Barranquero
2008-07-29 13:34 ` William Case
2008-07-29 9:39 ` Phil Carmody
2008-07-29 12:55 ` Juanma Barranquero
2008-07-29 18:19 ` Colin S. Miller
2008-07-30 12:29 ` David Hansen
2008-07-30 13:34 ` Juanma Barranquero
2008-07-29 19:33 ` Eli Zaretskii
2008-07-29 22:25 ` Andreas Eder
2008-07-29 23:35 ` Xah
2008-07-30 8:47 ` Andreas Eder
2008-07-30 9:49 ` Xah
2008-07-30 17:58 ` Eli Zaretskii
[not found] ` <mailman.15606.1217440713.18990.help-gnu-emacs@gnu.org>
2008-07-30 18:17 ` David Kastrup
[not found] ` <mailman.15565.1217360044.18990.help-gnu-emacs@gnu.org>
2008-07-29 19:45 ` Joost Diepenmaat
2008-07-29 21:16 ` Xah
2008-07-30 3:34 ` Eli Zaretskii
[not found] ` <mailman.15577.1217388899.18990.help-gnu-emacs@gnu.org>
2008-07-30 3:55 ` Xah
2008-07-30 18:06 ` Eli Zaretskii
[not found] ` <mailman.15607.1217441187.18990.help-gnu-emacs@gnu.org>
2008-07-30 18:37 ` Xah
2008-08-23 21:22 ` David Combs
2008-08-23 21:41 ` Barry Margolin
2008-08-24 0:15 ` origin of the Meta key Xah
2008-08-24 3:38 ` Barry Margolin
2008-08-26 12:19 ` Allan Gottlieb
2008-07-29 11:13 ` What does 'run' do in cperl-mode? Nikolaj Schumacher
2008-07-29 11:52 ` Alan Mackenzie
[not found] ` <mailman.15542.1217330058.18990.help-gnu-emacs@gnu.org>
2008-07-29 12:05 ` Xah
2008-07-29 21:55 ` David Kastrup
[not found] ` <mailman.15545.1217332445.18990.help-gnu-emacs@gnu.org>
2008-07-29 12:44 ` Xah
2008-07-29 15:16 ` Nikolaj Schumacher
2008-07-29 18:27 ` Alan Mackenzie
[not found] ` <mailman.15550.1217344626.18990.help-gnu-emacs@gnu.org>
2008-07-29 21:32 ` Xah
2008-07-29 23:06 ` Nikolaj Schumacher
[not found] ` <mailman.15574.1217372768.18990.help-gnu-emacs@gnu.org>
2008-07-29 23:29 ` Xah
2008-07-31 19:07 ` Ted Zlatanov
2008-08-01 3:34 ` Xah
2008-08-01 7:18 ` Eli Zaretskii
[not found] ` <mailman.15688.1217575142.18990.help-gnu-emacs@gnu.org>
2008-08-01 8:00 ` Xah
2008-08-01 8:12 ` Nikolaj Schumacher
2008-08-01 15:17 ` Ted Zlatanov
2008-08-06 22:42 ` Harry Putnam
[not found] ` <mailman.15964.1218062567.18990.help-gnu-emacs@gnu.org>
2008-08-06 23:22 ` Xah
2008-08-07 6:39 ` David Kastrup
2008-08-07 8:24 ` Xah
[not found] ` <mailman.15564.1217356016.18990.help-gnu-emacs@gnu.org>
2008-07-29 22:50 ` Xah
2008-07-30 15:15 ` Alan Mackenzie
[not found] ` <mailman.15602.1217430872.18990.help-gnu-emacs@gnu.org>
2008-07-30 17:32 ` Xah
2008-07-30 17:45 ` Joost Kremers
2008-07-30 18:33 ` Xah
2008-07-30 19:40 ` Bastien
2008-07-30 0:28 ` namekuseijin
2008-07-27 3:05 ` formido
2008-07-27 11:36 ` Lennart Borgman (gmail)
2008-07-27 11:56 ` Thierry Volpiatto
-- strict thread matches above, loose matches on Subject: below --
2008-08-06 23:27 Xah
2008-08-07 14:27 ` Harry Putnam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0ded5ecd-f5f6-4a8e-9d19-f61bf0401022@v39g2000pro.googlegroups.com \
--to=xahlee@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.