unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* windows, elisp function to call batch file, shell-command, Whitaker's words
@ 2016-12-02 13:49 Hugh Lawson
  2016-12-02 14:06 ` tomas
  2016-12-02 15:03 ` windows, elisp function to call batch file, shell-command, Whitaker's words--solved Hugh Lawson
  0 siblings, 2 replies; 5+ messages in thread
From: Hugh Lawson @ 2016-12-02 13:49 UTC (permalink / raw)
  To: help-gnu-emacs

The problem is that William Whitaker's Words program returns an error when I try to call it with this setup, in Windows 10.  I have a Latin text in a buffer. I put the cursor on a Latin word, and strike F12.  The elisp function calls the latin.bat bath file, which calls the words latin dictionary program.  I think something is wrong either with my elisp function or my batch file.

The following error is displayed:

=>Raised END_ERROR, although in STANDARD_INPUT
^Z is inappropriate keyboard input, WORDS should be terminated with a blank line
Giving up!

In .emacs file:

(defun whitaker-lookup ()
"Lookup Latin word at point in Whitaker's words"
(interactive )
(shell-command (concat "C:\latin " (thing-at-point 'word))))
;;C:\latin is a batch file
(global-set-key (kbd "<f12>") 'whitaker-lookup)


Here is the batch file, latin.bat

cd c:\WORDS
words


The same error occurs if I issue these commands:

m-x shell-command
latin

However, if I go into the shell mode buffer I can make things work:

mx-shell

c:\> cd c:\words
c:\words> words
;;calls the words program with no error
c:\words> latin
;; calls the batch file which calls the words program, successfully.


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

* Re: windows, elisp function to call batch file, shell-command, Whitaker's words
  2016-12-02 13:49 windows, elisp function to call batch file, shell-command, Whitaker's words Hugh Lawson
@ 2016-12-02 14:06 ` tomas
  2016-12-02 15:03 ` windows, elisp function to call batch file, shell-command, Whitaker's words--solved Hugh Lawson
  1 sibling, 0 replies; 5+ messages in thread
From: tomas @ 2016-12-02 14:06 UTC (permalink / raw)
  To: help-gnu-emacs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Fri, Dec 02, 2016 at 05:49:17AM -0800, Hugh Lawson wrote:
> The problem is that William Whitaker's Words program returns an error when I try to call it with this setup, in Windows 10.  I have a Latin text in a buffer. I put the cursor on a Latin word, and strike F12.  The elisp function calls the latin.bat bath file, which calls the words latin dictionary program.  I think something is wrong either with my elisp function or my batch file.
> 
> The following error is displayed:
> 
> =>Raised END_ERROR, although in STANDARD_INPUT
> ^Z is inappropriate keyboard input, WORDS should be terminated with a blank line
> Giving up!
> 
> In .emacs file:
> 
> (defun whitaker-lookup ()
> "Lookup Latin word at point in Whitaker's words"
> (interactive )
> (shell-command (concat "C:\latin " (thing-at-point 'word))))
> ;;C:\latin is a batch file
> (global-set-key (kbd "<f12>") 'whitaker-lookup)

It seems to me that words (and thus latin) are expecting the
word(s) at their standard input, whereas your elisp snippet
above is providing it as a command line argument.

That would also (half-) explain why the program is complaining
about a ^Z (which in DOS tradition sometimes signals an "end
of file/stream").

You could try to mark the word in question (possibly appending
it with a newline if things don't work right away) and invoking
"M-x shell-command-on-region". If you get *that* to run, you
at least know in which general direction to shoot.

> Here is the batch file, latin.bat
> 
> cd c:\WORDS
> words
> 
> 
> The same error occurs if I issue these commands:
> 
> m-x shell-command
> latin
> 
> However, if I go into the shell mode buffer I can make things work:
> 
> mx-shell
> 
> c:\> cd c:\words
> c:\words> words
> ;;calls the words program with no error
> c:\words> latin
> ;; calls the batch file which calls the words program, successfully.

*Here it is* how do now the words "arrive" at words viz. latin?
Are they waiting for you to type them "at them"?

regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlhBf94ACgkQBcgs9XrR2kZhSwCfX9okqHt1Q4KQprfgrlm+XYxz
nPkAn1enQL03XFGeLlFwDzLoMyWbM1M0
=I5H+
-----END PGP SIGNATURE-----



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

* Re: windows, elisp function to call batch file, shell-command, Whitaker's words--solved
  2016-12-02 13:49 windows, elisp function to call batch file, shell-command, Whitaker's words Hugh Lawson
  2016-12-02 14:06 ` tomas
@ 2016-12-02 15:03 ` Hugh Lawson
  2016-12-02 17:03   ` B. T. Raven
  1 sibling, 1 reply; 5+ messages in thread
From: Hugh Lawson @ 2016-12-02 15:03 UTC (permalink / raw)
  To: help-gnu-emacs

On Friday, December 2, 2016 at 8:49:19 AM UTC-5, Hugh Lawson wrote:
> The problem is that William Whitaker's Words program returns an error when I try to call it with this setup, in Windows 10.  I have a Latin text in a buffer. I put the cursor on a Latin word, and strike F12.  The elisp function calls the latin.bat bath file, which calls the words latin dictionary program.  I think something is wrong either with my elisp function or my batch file.

[snip ]
> Here is the batch file, latin.bat
> 
> cd c:\WORDS
> words

I found the problem in my batch file, which I revised as follows:
@Echo off
cd c:\WORDS
words.exe %1




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

* Re: windows, elisp function to call batch file, shell-command, Whitaker's words--solved
  2016-12-02 15:03 ` windows, elisp function to call batch file, shell-command, Whitaker's words--solved Hugh Lawson
@ 2016-12-02 17:03   ` B. T. Raven
  2016-12-19  2:41     ` Hugh Lawson
  0 siblings, 1 reply; 5+ messages in thread
From: B. T. Raven @ 2016-12-02 17:03 UTC (permalink / raw)
  To: help-gnu-emacs

On 12/2/2016 09:03, Hugh Lawson wrote:
> On Friday, December 2, 2016 at 8:49:19 AM UTC-5, Hugh Lawson wrote:
>> The problem is that William Whitaker's Words program returns an error when I try to call it with this setup, in Windows 10.  I have a Latin text in a buffer. I put the cursor on a Latin word, and strike F12.  The elisp function calls the latin.bat bath file, which calls the words latin dictionary program.  I think something is wrong either with my elisp function or my batch file.
>
> [snip ]
>> Here is the batch file, latin.bat
>>
>> cd c:\WORDS
>> words
>
> I found the problem in my batch file, which I revised as follows:
> @Echo off
> cd c:\WORDS
> words.exe %1
>
>

Yes, the batch file needs to be setup to accept argument(s). But you 
don't really need the batch file if you hardcode the path info into the 
elisp function:

(defun wwwd ()
"Lookup Latin word at point with William Whitaker's Words program"
(interactive )
(cd "c:/wwwd") ;; where I unzipped everything
(shell-command (concat "wwwd " (thing-at-point 'sentence))) ;; renamed 
word.exe to wwwd.exe
(cd "c:/mydocu~1")) ;; reset current directory for emacs

(global-set-key (kbd "<f12>") 'wwwd)

To use the 'sentence "thing" instead of the 'word "thing" you might have 
to mess with these settings:

  '(sentence-end "[.?!][]\"')}]*\\($\\| $\\|	\\| \\)[ 	
]*")
  '(sentence-end-double-space nil)

or else just enter a series of space-separated Latin forms on the same 
line. With the following (all punctuation removed), the programm parsed 
all tokens up to and including the words "bonorum omnium," most of them 
correctly.

Quo usque tandem abutere Catilina, patientia nostra quam diu etiam furor 
iste tuus nos eludet quem ad finem sese effrenata iactabit audacia 
Nihilne te nocturnum praesidium Palati nihil urbis vigiliae nihil timor 
populi nihil concursus bonorum omnium nihil hic munitissimus habendi 
senatus locus nihil horum ora voltusque moverunt Patere tua consilia non 
sentis constrictam iam horum omnium scientia teneri coniurationem tuam 
non vides

So there is a limit to the number a arguments that the program will 
accept, even though it's written in Ada.

Ed




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

* Re: windows, elisp function to call batch file, shell-command, Whitaker's words--solved
  2016-12-02 17:03   ` B. T. Raven
@ 2016-12-19  2:41     ` Hugh Lawson
  0 siblings, 0 replies; 5+ messages in thread
From: Hugh Lawson @ 2016-12-19  2:41 UTC (permalink / raw)
  To: help-gnu-emacs

On Friday, December 2, 2016 at 12:04:13 PM UTC-5, B. T. Raven wrote:

[big snip]
Ed, that is extremely impressive.  It will take me hours of study to figure that out. Many thanks. Hugh


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

end of thread, other threads:[~2016-12-19  2:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-02 13:49 windows, elisp function to call batch file, shell-command, Whitaker's words Hugh Lawson
2016-12-02 14:06 ` tomas
2016-12-02 15:03 ` windows, elisp function to call batch file, shell-command, Whitaker's words--solved Hugh Lawson
2016-12-02 17:03   ` B. T. Raven
2016-12-19  2:41     ` Hugh Lawson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).