|
From: | B. T. Raven |
Subject: | Re: windows, elisp function to call batch file, shell-command, Whitaker's words--solved |
Date: | Fri, 2 Dec 2016 11:03:08 -0600 |
User-agent: | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.5.0 |
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 wordsI 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
[Prev in Thread] | Current Thread | [Next in Thread] |