all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* launching a perl script
@ 2011-09-21 12:54 Mart Zirnask
  2011-09-21 13:01 ` Mart Zirnask
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Mart Zirnask @ 2011-09-21 12:54 UTC (permalink / raw)
  To: help-gnu-emacs

Hello everybody,

Probably an issue not very complicated: when I try to launch an
external Perl script ("tags#.pl") from Emacs, providing it with the
current buffer name, the editor freezes.

I'm on Windows and here's what I have in my .emacs:

--------------------------------------------------------------------
;; Perl tagcloud
(global-set-key (kbd "<f2>")
                      (lambda ()
                        (interactive)
                        (shell-command (concat "perl
~/.emacs.d/tags#.pl " buffer-file-name))))
--------------------------------------------------------------------

I'm not a programmer and I started using Emacs for text editing only
recently. What's wrong?

Thanks for any help,
best,
Mart Zirnask,
from Estonia



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: launching a perl script
  2011-09-21 12:54 launching a perl script Mart Zirnask
@ 2011-09-21 13:01 ` Mart Zirnask
  2011-09-22  4:40   ` XeCycle
  2011-09-22  8:05 ` Andreas Röhler
  2011-09-22 14:46 ` PJ Weisberg
  2 siblings, 1 reply; 7+ messages in thread
From: Mart Zirnask @ 2011-09-21 13:01 UTC (permalink / raw)
  To: help-gnu-emacs

Sorry for spamming,
I actually provided the file name as "c:/tags#.pl" but this gave the
same effect -- Emacs freezes.

Thanks for help,
Best,
MZ

2011/9/21 Mart Zirnask <martzirnask@gmail.com>:
> Hello everybody,
>
> Probably an issue not very complicated: when I try to launch an
> external Perl script ("tags#.pl") from Emacs, providing it with the
> current buffer name, the editor freezes.
>
> I'm on Windows and here's what I have in my .emacs:
>
> --------------------------------------------------------------------
> ;; Perl tagcloud
> (global-set-key (kbd "<f2>")
>                      (lambda ()
>                        (interactive)
>                        (shell-command (concat "perl
> ~/.emacs.d/tags#.pl " buffer-file-name))))
> --------------------------------------------------------------------
>
> I'm not a programmer and I started using Emacs for text editing only
> recently. What's wrong?
>
> Thanks for any help,
> best,
> Mart Zirnask,
> from Estonia
>



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: launching a perl script
  2011-09-21 13:01 ` Mart Zirnask
@ 2011-09-22  4:40   ` XeCycle
  0 siblings, 0 replies; 7+ messages in thread
From: XeCycle @ 2011-09-22  4:40 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1407 bytes --]

Mart Zirnask <martzirnask@gmail.com> writes:

> Sorry for spamming,
> I actually provided the file name as "c:/tags#.pl" but this gave the
> same effect -- Emacs freezes.
>
> Thanks for help,
> Best,
> MZ
>
> 2011/9/21 Mart Zirnask <martzirnask@gmail.com>:
>> Hello everybody,
>>
>> Probably an issue not very complicated: when I try to launch an
>> external Perl script ("tags#.pl") from Emacs, providing it with the
>> current buffer name, the editor freezes.
>>
>> I'm on Windows and here's what I have in my .emacs:
>>
>> --------------------------------------------------------------------
>> ;; Perl tagcloud
>> (global-set-key (kbd "<f2>")
>>                      (lambda ()
>>                        (interactive)
>>                        (shell-command (concat "perl
>> ~/.emacs.d/tags#.pl " buffer-file-name))))
>> --------------------------------------------------------------------
>>
>> I'm not a programmer and I started using Emacs for text editing only
>> recently. What's wrong?
>>
>> Thanks for any help,
>> best,
>> Mart Zirnask,
>> from Estonia

Does that script reads any standard input?  To interact with a
subprocess, see comint-mode.

-- 
Carl Lei (XeCycle)
Department of Physics, Shanghai Jiao Tong University
OpenPGP public key: 7795E591
Fingerprint: 1FB6 7F1F D45D F681 C845 27F7 8D71 8EC4 7795 E591

[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: launching a perl script
  2011-09-21 12:54 launching a perl script Mart Zirnask
  2011-09-21 13:01 ` Mart Zirnask
@ 2011-09-22  8:05 ` Andreas Röhler
  2011-09-22 14:46 ` PJ Weisberg
  2 siblings, 0 replies; 7+ messages in thread
From: Andreas Röhler @ 2011-09-22  8:05 UTC (permalink / raw)
  To: help-gnu-emacs

Am 21.09.2011 14:54, schrieb Mart Zirnask:
> Hello everybody,
>
> Probably an issue not very complicated: when I try to launch an
> external Perl script ("tags#.pl") from Emacs, providing it with the
> current buffer name, the editor freezes.
>
> I'm on Windows and here's what I have in my .emacs:
>
> --------------------------------------------------------------------
> ;; Perl tagcloud
> (global-set-key (kbd "<f2>")
>                        (lambda ()
>                          (interactive)
>                          (shell-command (concat "perl
> ~/.emacs.d/tags#.pl " buffer-file-name))))
> --------------------------------------------------------------------
>
> I'm not a programmer and I started using Emacs for text editing only
> recently. What's wrong?
>
> Thanks for any help,
> best,
> Mart Zirnask,
> from Estonia
>
>

Hi,

assume the file is locked by your buffer, so if perl trys to change, it 
fails.

BTW open Emacs and try to access the file, see what happens.

If you want to change the current content, shell-command-on-region 
should DTRT.

HTH,

Andreas



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: launching a perl script
  2011-09-21 12:54 launching a perl script Mart Zirnask
  2011-09-21 13:01 ` Mart Zirnask
  2011-09-22  8:05 ` Andreas Röhler
@ 2011-09-22 14:46 ` PJ Weisberg
  2011-09-22 15:19   ` Mart Zirnask
  2 siblings, 1 reply; 7+ messages in thread
From: PJ Weisberg @ 2011-09-22 14:46 UTC (permalink / raw)
  To: Mart Zirnask; +Cc: help-gnu-emacs@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1057 bytes --]

Emacs isn't so much "frozen" as it is "waiting for the perl script to
finish".  If you just want to run the script in the background, put a " &"
at the end of the command string.

On Wednesday, September 21, 2011, Mart Zirnask <martzirnask@gmail.com>
wrote:
> Hello everybody,
>
> Probably an issue not very complicated: when I try to launch an
> external Perl script ("tags#.pl") from Emacs, providing it with the
> current buffer name, the editor freezes.
>
> I'm on Windows and here's what I have in my .emacs:
>
> --------------------------------------------------------------------
> ;; Perl tagcloud
> (global-set-key (kbd "<f2>")
>                      (lambda ()
>                        (interactive)
>                        (shell-command (concat "perl
> ~/.emacs.d/tags#.pl " buffer-file-name))))
> --------------------------------------------------------------------
>
> I'm not a programmer and I started using Emacs for text editing only
> recently. What's wrong?
>
> Thanks for any help,
> best,
> Mart Zirnask,
> from Estonia
>
>

-- 

-PJ

[-- Attachment #2: Type: text/html, Size: 1385 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: launching a perl script
  2011-09-22 14:46 ` PJ Weisberg
@ 2011-09-22 15:19   ` Mart Zirnask
  2011-09-22 16:02     ` Mart Zirnask
  0 siblings, 1 reply; 7+ messages in thread
From: Mart Zirnask @ 2011-09-22 15:19 UTC (permalink / raw)
  To: andreas.roehler, help-gnu-emacs

Hi,

Thanks for advice.
shell-command-on-region worked, but also provided the following in minibuffer:

-------------------
"tagcloud: Wrong number of arguments: #[(start end command &optional
output-buffer replace error-buffer display-error-buffer) "

 [error-buffer small-temporary-file-directory temporary-file-directory
exit-status error-file replace make-temp-file expand-file-name "scor"
nil ...] 9 1940772 (let (string) (unless (mark) (error "The mark is
not set now, so there is no region")) (setq string (read-shell-command
"Shell command on region: ")) (list (region-beginning) (region-end)
string current-prefix-arg current-prefix-arg
shell-command-default-error-buffer t))], 1
--------------------

Basically, what I want to do is to run this great script through
Emacs: http://perlmonks.org/?node_id=707360

Everything seems to work fine when I hand-type the command ("perl
tags#.pl current-buffer-filename.txt") in eshell or Windows native
shell launched through Emacs. But I'd like to assign  the script to a
hotkey (using the current buffer as input for Perl), and this is where
I'm facing problems at the moment. Might this somehow be related to
Windows' filenames (because they include spaces)?

However, a workaround would be binding my hotkey to the eshell
command. But I haven't found reference for doing this. So, what should
I put into my .emacs in order to launch the script via a hotkey using
eshell?

Thanks,

Mart,
in trouble, but still

-------------------------------------------------
Am 21.09.2011 14:54, schrieb Mart Zirnask:

    Hello everybody,

    Probably an issue not very complicated: when I try to launch an
    external Perl script ("tags#.pl") from Emacs, providing it with the
    current buffer name, the editor freezes.

    I'm on Windows and here's what I have in my .emacs:

    --------------------------------------------------------------------
    ;; Perl tagcloud
    (global-set-key (kbd "<f2>")
                           (lambda ()
                             (interactive)
                             (shell-command (concat "perl
    ~/.emacs.d/tags#.pl " buffer-file-name))))
    --------------------------------------------------------------------

    I'm not a programmer and I started using Emacs for text editing only
    recently. What's wrong?

    Thanks for any help,
    best,
    Mart Zirnask,
    from Estonia

-----------------------------

Hi,


assume the file is locked by your buffer, so if perl trys to change, it fails.

BTW open Emacs and try to access the file, see what happens.


If you want to change the current content, shell-command-on-region should DTRT.

HTH,

Andreas



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: launching a perl script
  2011-09-22 15:19   ` Mart Zirnask
@ 2011-09-22 16:02     ` Mart Zirnask
  0 siblings, 0 replies; 7+ messages in thread
From: Mart Zirnask @ 2011-09-22 16:02 UTC (permalink / raw)
  To: andreas.roehler, help-gnu-emacs

Okay,
I got everything working using "compile" instead :) Like this:

-----------------
;;; --- Perl tag-cloud --- ;;;
(defun tagcloud ()
(interactive)
(compile (concat "perl c:/tags.pl "  (shell-quote-argument
(buffer-file-name)) " &")))
(global-set-key (kbd "<f2>") 'tagcloud) ; hotkey: f2
-----------------

Now, a question: how could I assign the same hotkey (F2) to "refresh"
the compilaton when it's running?

Namely, the script generates a tag cloud based on a text file. But
when I happen to change something in the file, the cloud isn't updated
automatically. I need to kill the Perl process and start everything
anew in order to get a "fresh cloud". A workaround for this would be
great.

Thanks for your help!

I'm an absolute newbie but, really, Emacs rocks!
Best,
Mart



2011/9/22 Mart Zirnask <martzirnask@gmail.com>:
> Hi,
>
> Thanks for advice.
> shell-command-on-region worked, but also provided the following in minibuffer:
>
> -------------------
> "tagcloud: Wrong number of arguments: #[(start end command &optional
> output-buffer replace error-buffer display-error-buffer) "
>
>  [error-buffer small-temporary-file-directory temporary-file-directory
> exit-status error-file replace make-temp-file expand-file-name "scor"
> nil ...] 9 1940772 (let (string) (unless (mark) (error "The mark is
> not set now, so there is no region")) (setq string (read-shell-command
> "Shell command on region: ")) (list (region-beginning) (region-end)
> string current-prefix-arg current-prefix-arg
> shell-command-default-error-buffer t))], 1
> --------------------
>
> Basically, what I want to do is to run this great script through
> Emacs: http://perlmonks.org/?node_id=707360
>
> Everything seems to work fine when I hand-type the command ("perl
> tags#.pl current-buffer-filename.txt") in eshell or Windows native
> shell launched through Emacs. But I'd like to assign  the script to a
> hotkey (using the current buffer as input for Perl), and this is where
> I'm facing problems at the moment. Might this somehow be related to
> Windows' filenames (because they include spaces)?
>
> However, a workaround would be binding my hotkey to the eshell
> command. But I haven't found reference for doing this. So, what should
> I put into my .emacs in order to launch the script via a hotkey using
> eshell?
>
> Thanks,
>
> Mart,
> in trouble, but still
>
> -------------------------------------------------
> Am 21.09.2011 14:54, schrieb Mart Zirnask:
>
>    Hello everybody,
>
>    Probably an issue not very complicated: when I try to launch an
>    external Perl script ("tags#.pl") from Emacs, providing it with the
>    current buffer name, the editor freezes.
>
>    I'm on Windows and here's what I have in my .emacs:
>
>    --------------------------------------------------------------------
>    ;; Perl tagcloud
>    (global-set-key (kbd "<f2>")
>                           (lambda ()
>                             (interactive)
>                             (shell-command (concat "perl
>    ~/.emacs.d/tags#.pl " buffer-file-name))))
>    --------------------------------------------------------------------
>
>    I'm not a programmer and I started using Emacs for text editing only
>    recently. What's wrong?
>
>    Thanks for any help,
>    best,
>    Mart Zirnask,
>    from Estonia
>
> -----------------------------
>
> Hi,
>
>
> assume the file is locked by your buffer, so if perl trys to change, it fails.
>
> BTW open Emacs and try to access the file, see what happens.
>
>
> If you want to change the current content, shell-command-on-region should DTRT.
>
> HTH,
>
> Andreas
>



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-09-22 16:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-21 12:54 launching a perl script Mart Zirnask
2011-09-21 13:01 ` Mart Zirnask
2011-09-22  4:40   ` XeCycle
2011-09-22  8:05 ` Andreas Röhler
2011-09-22 14:46 ` PJ Weisberg
2011-09-22 15:19   ` Mart Zirnask
2011-09-22 16:02     ` Mart Zirnask

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.