From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: rustom Newsgroups: gmane.emacs.help Subject: apl: from X to gnu emacs Date: Wed, 11 Aug 2010 07:09:05 -0700 (PDT) Organization: http://groups.google.com Message-ID: <7b9d484a-46f4-4140-a654-d537dce30e76@b4g2000pra.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1291865091 28510 80.91.229.12 (9 Dec 2010 03:24:51 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 9 Dec 2010 03:24:51 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Dec 09 04:24:47 2010 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.69) (envelope-from ) id 1PQX7f-0006xW-6L for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Dec 2010 04:24:47 +0100 Original-Received: from localhost ([127.0.0.1]:41364 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQX7e-0000tx-C1 for geh-help-gnu-emacs@m.gmane.org; Wed, 08 Dec 2010 22:24:46 -0500 Original-Path: usenet.stanford.edu!postnews.google.com!b4g2000pra.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 87 Original-NNTP-Posting-Host: 116.73.35.230 Original-X-Trace: posting.google.com 1281535745 16966 127.0.0.1 (11 Aug 2010 14:09:05 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Wed, 11 Aug 2010 14:09:05 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: b4g2000pra.googlegroups.com; posting-host=116.73.35.230; posting-account=mBpa7woAAAAGLEWUUKpmbxm-Quu5D8ui User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.11) Gecko/20100701 Firefox/3.5.11,gzip(gfe) Original-Xref: usenet.stanford.edu gnu.emacs.help:180579 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:76542 Archived-At: Heres some progress with apl mode in gnu emacs. The xemacs stuff I earlier mentioned was unusable (at least by me) but I found a nice apl mode for gnu emacs by Markus Triska. It handles the characters of apl but did not have any comint functionality ie it could wirte program(files) but not interact with the interpreter. So below is some code that tweaks some hooks for comint to do this. I was hoping some (more experienced) lipsers could test this and see if its the right direction... If the direction is ok I can clean it up and put it on the wiki. To Test: 1. Aplus. On debian the package is Aplus-fsf (Aplus-fsf-dev will pull in all the xemacs stuff which is not needed). This should make the a+ binary available. Starting a+ at the shell should give you a prompt type 2+3 If it gives 5, a+ is working but char-encoding-issues at the shell level prevent anything more here. 2. Markus Triska's apl.el from http://stud4.tuwien.ac.at/~e0225855/unicapl/= apl.el Load it into emacs set-input-method to apl-ascii (perhaps in a fresh buffer) Typing {rho} {iota} {is} should give you rho iota and left arrow: =E2=8D=B4= =E2=8D=B3 =E2=86=90 3. Load the code below (with suitable change to the load-path line) This will directly start apl in a comint buffer Type A {is} 2 3 {rho} {iota} 6 The {rho} and {iota} should immediately convert to =E2=8D=B4 =E2=8D=B3 Type A and a 2x3 matrix should be there. Elisp code ---------------------------------------------------------------------------= ----- ;; Basic Aplus (Apl) comint functionality (very incomplete) ;; Uses Markus Triska's apl.el for encodings, input-methods etc ;; Make sure apl.el is on emacs' load path and a+ on execution path (add-to-list 'load-path "wherever apl.el is") ;; where apl.el is (require 'apl) (defun apl-unicode2aplus-char (c) "Converts unicode char to an Aplus single char string All bets off when its not convertile :-)" (let ((c2 (rassq c apl-aplus-table))) (string (if c2 (car c2) c)))) (defun apl-unicode2aplus-str (s) "Converts a unicode string to an Aplus string" (mapconcat (function apl-unicode2aplus-char) s "")) (defun apl-comint-send (process s) "`comint-simple-send' with string preprocessed with `apl-unicode2aplus- str'" (comint-simple-send process (apl-unicode2aplus-str s))) ;;replace comint-simple-send (setq comint-input-sender 'apl-comint-send) (defun apl-aplus2unicode-char (c) "Converts Aplus char to a unicode single char string All bets off when its not convertile :-)" (let ((c2 (assq c apl-aplus-table))) (string (if c2 (cdr c2) c)))) (defun apl-aplus2unicode-str (s) "Converts a Aplus string to a unicode string" (mapconcat (function apl-aplus2unicode-char) s "")) (add-hook 'comint-preoutput-filter-functions 'apl-aplus2unicode-str) ;;; The following should be put into some kind of ;;; apl-inferior mode making function ;;; But there are more important lacunae: such as when encoding fails (make-comint "a+" "a+") (set-buffer "*a+*") (set-input-method "apl-ascii") (switch-to-buffer "*a+*")