From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xah Newsgroups: gmane.emacs.help Subject: Re: What does 'run' do in cperl-mode? Date: Fri, 25 Jul 2008 07:55:29 -0700 (PDT) Organization: http://groups.google.com Message-ID: <0ded5ecd-f5f6-4a8e-9d19-f61bf0401022@v39g2000pro.googlegroups.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1217000555 9004 80.91.229.12 (25 Jul 2008 15:42:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 25 Jul 2008 15:42:35 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jul 25 17:43:23 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KMPQu-0006kY-E3 for geh-help-gnu-emacs@m.gmane.org; Fri, 25 Jul 2008 17:42:16 +0200 Original-Received: from localhost ([127.0.0.1]:42455 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KMPQ0-0007v5-O3 for geh-help-gnu-emacs@m.gmane.org; Fri, 25 Jul 2008 11:41:20 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!v39g2000pro.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 62 Original-NNTP-Posting-Host: 24.6.97.120 Original-X-Trace: posting.google.com 1216997730 6743 127.0.0.1 (25 Jul 2008 14:55:30 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Fri, 25 Jul 2008 14:55:30 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: v39g2000pro.googlegroups.com; posting-host=24.6.97.120; posting-account=bRPKjQoAAACxZsR8_VPXCX27T2YcsyMA User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_4_11; en) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.22, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:160588 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:55935 Archived-At: On Jul 24, 10:36 am, formido 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 =E2=80=9Cperl =E2=80=B9filename=E2=80=BA=E2=80= =9D. 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 =E2=80=9Cperl x.pl=E2=80=9D 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 "") '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 =E2=88=91 http://xahlee.org/ =E2=98=84