all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: rustom <rustompmody@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: apl: from X to gnu emacs
Date: Wed, 11 Aug 2010 07:09:05 -0700 (PDT)	[thread overview]
Message-ID: <7b9d484a-46f4-4140-a654-d537dce30e76@b4g2000pra.googlegroups.com> (raw)

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: ⍴ ⍳
←

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 ⍴ ⍳
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+*")


                 reply	other threads:[~2010-08-11 14:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7b9d484a-46f4-4140-a654-d537dce30e76@b4g2000pra.googlegroups.com \
    --to=rustompmody@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.