Re: Emacs mode can't run pil

2018-02-22 Thread Nehal
As far as picolisp running in Org mode is concerned:


** 1. I tried the following code in org babel and they show perfect
results as shown in ob-picolisp-more-tests.org given on
https://github.com/tj64/ob-picolisp.

*** Example 1

#+begin_src picolisp  :results value html
   (load  "@lib/http.l" "@lib/xhtml.l" "@lib/form.l")

   (html 0 "Hello" "@lib.css" NIL
  ( NIL "Hello World!")
  ( "This is some text.")
  (ht:Prin "And this is a number: " (+ 1 2 3)) )
 #+end_src

   #+RESULTS:
   #+BEGIN_HTML
   
   #+END_HTML

*** Example 2

 #+begin_src picolisp  :results value code
   '(a (b c d) (e (f (g) (h) (i)) (j (k) (l) (m))) (n o p) q)
 #+end_src

 #+RESULTS:
 #+BEGIN_SRC picolisp
 (a
(b c d)
(e
   (f (g) (h) (i))
   (j (k) (l) (m)) )
(n o p)
q )
 #+END_SRC



*** Example 3

 #+begin_src picolisp  :results value pp
   '(a (b c d) (e (f (g) (h) (i)) (j (k) (l) (m))) (n o p) q)
 #+end_src

 #+RESULTS:
 : (a
 :(b c d)
 :(e
 :   (f (g) (h) (i))
 :   (j (k) (l) (m)) )
 :(n o p)
 :q )


** 2. Try commenting out code (/picoLisp/lib/el) in your .emacs:

;; In order to get the picolisp-mode working correctly you have to
;; add the following expressions to your .emacs and adapt them
;; according to your set-up:

;; (add-to-list 'load-path "/opt/picoLisp/lib/el")
;; (load "tsm.el") ;; Picolisp TransientSymbolsMarkup (*Tsm)
;; (autoload 'run-picolisp "inferior-picolisp")
;; (autoload 'picolisp-mode "picolisp" "Major mode for editing
;;  Picolisp." t)

;; pil is more modern than plmod
  ;;   (setq picolisp-program-name "/opt/picoLisp/pil")

;; If you have also SLIME installed, it will suck all possible lisp
;; extensions up.
;; So in order to get the correct file-association for picolisp
;; files you'll have to also add this:

;; (add-to-list 'auto-mode-alist '("\\.l$" . picolisp-mode))

;; If you want, you can add a few hooks for convenience:

   ;;  (add-hook 'picolisp-mode-hook
 ;;(lambda ()
   ;;(paredit-mode +1) ;; Loads paredit mode automatically
 ;;  (tsm-mode) ;; Enables TSM
;;   (define-key picolisp-mode-map (kbd "RET") 'newline-and-indent)
;;   (define-key picolisp-mode-map (kbd "C-h")
'paredit-backward-delete) ) )

;; By the way, don't forget to patch your paredit.el (v21) with the
;;  patch provided to get a smoother editing.

;;(add-hook 'lisp-mode-hook (lambda () (slime-mode t)))
;;(add-hook 'inferior-lisp-mode-hook (lambda () (inferior-slime-mode t)))
;;(slime) (slime-scratch)

And having only:

(org-babel-do-load-languages 'org-babel-load-languages
 '( (emacs-lisp . t)
   (gnuplot . t)
   (lisp . t)
   (picolisp . t)
   (python . t)
   (sh . t)))

(Mainly add picolisp above) and then restart Emacs. This works perfectly here.

On 2/22/18, Lawrence Bottorff  wrote:
> I tracked it down to something totally bizarre: Starting emacs GUI (I'm on
> Ubuntu + Gnome) from a task bar button with the command
>
> emacsclient -c -a ''
>
> (that's two single quotes)
>
> was the problem, i.e., using the emacs daemon. However, changing the task
> bar button to
>
> emacs --daemon
>
> then running
>
> emacs &
>
> from an open terminal "fixed" the problem. I spent hours tearing things out
> of my init diaspora, doing emacs -q, then C-x-e-ing things back in, etc. I
> have absolutely no idea why starting Emacs this way would make a
> difference. I'm saying this fixed the problem with `run-picolisp` inside of
> picolisp-mode. But still, org-mode picolisp is touchy. For example, one of
> the tutorial examples:
>
> (let Str "The quick brown fox jumped over the lazy dog's back"
>(pack
>   (mapcar '((B) (pad 2 (hex B)))
>  (native "libcrypto.so" "MD5"
> '(B . 16) Str (length Str) '(NIL (16))
>
> runs fine in a picolisp-mode started REPL, but not in an org-mode code
> block like this:
>
> #+BEGIN_SRC picolisp
> # call the 'MD5' function from 'libcrypto.so'
> (let Str "The quick brown fox jumped over the lazy dog's back"
>(pack
>   (mapcar '((B) (pad 2 (hex B)))
>  (native "libcrypto.so" "MD5"
> '(B . 16) Str (length Str) '(NIL (16))
> #+END_SRC
>
> Running the above gives:
>
> executing Picolisp code block...
> executing Picolisp source code block
> Wrote /tmp/babel-26285uqi/ob-input-26285Ue1
> org-babel-execute:picolisp: End of file during parsing
>
> and no result. Also, some of the examples in this
>  aren't working properly, but then I'm
> guessing it's more org-mode's having changed (tables, variable in source
> block, etc.) since this was put together. Also, doing C-c C-c on an
> org-mode code 

Re: Emacs mode can't run pil

2018-02-22 Thread Lawrence Bottorff
I tracked it down to something totally bizarre: Starting emacs GUI (I'm on
Ubuntu + Gnome) from a task bar button with the command

emacsclient -c -a ''

(that's two single quotes)

was the problem, i.e., using the emacs daemon. However, changing the task
bar button to

emacs --daemon

then running

emacs &

from an open terminal "fixed" the problem. I spent hours tearing things out
of my init diaspora, doing emacs -q, then C-x-e-ing things back in, etc. I
have absolutely no idea why starting Emacs this way would make a
difference. I'm saying this fixed the problem with `run-picolisp` inside of
picolisp-mode. But still, org-mode picolisp is touchy. For example, one of
the tutorial examples:

(let Str "The quick brown fox jumped over the lazy dog's back"
   (pack
  (mapcar '((B) (pad 2 (hex B)))
 (native "libcrypto.so" "MD5"
'(B . 16) Str (length Str) '(NIL (16))

runs fine in a picolisp-mode started REPL, but not in an org-mode code
block like this:

#+BEGIN_SRC picolisp
# call the 'MD5' function from 'libcrypto.so'
(let Str "The quick brown fox jumped over the lazy dog's back"
   (pack
  (mapcar '((B) (pad 2 (hex B)))
 (native "libcrypto.so" "MD5"
'(B . 16) Str (length Str) '(NIL (16))
#+END_SRC

Running the above gives:

executing Picolisp code block...
executing Picolisp source code block
Wrote /tmp/babel-26285uqi/ob-input-26285Ue1
org-babel-execute:picolisp: End of file during parsing

and no result. Also, some of the examples in this
 aren't working properly, but then I'm
guessing it's more org-mode's having changed (tables, variable in source
block, etc.) since this was put together. Also, doing C-c C-c on an
org-mode code block doesn't seem to start a REPL as does, say, Racket. I'm
saying with Racket, any org-mode code block you may run immediately starts
a  Racket REPL "session" wherein, e.g., a function is then known  . . . but
this is not the case when you run a picolisp code block. I know Racket runs
in conjunction with Geiser-mode. I would think picolisp babel would run in
conjunction with picolisp-mode. . . .

 Basically, I'm concerned about org-mode more than regular
picolisp-mode+REPL because Emacs is evolving into an org-mode vehicle, AFAI
can tell. New people to picolisp who use Emacs will likely be org-moders
too.

LB

On Wed, Feb 21, 2018 at 9:50 PM, Nehal  wrote:

> Hi Lawrence,
>
> Check:
>
> 1. If pil is running correctly in shell from inside Emacs.
> 2. If you added Picolisp in .emacs file in
> (org-babel-do-load-languages 'org-babel-load-languages
>   '((picolisp . t)))
>
>
> On 2/21/18, Lawrence Bottorff  wrote:
> > I'm getting either
> >
> > Searching for program: No such file or directory, pil
> >
> > or
> >
> > File already exists: /home/hercynian/.pil/editor-orig
> >
> > whenever I try to do `run-picolisp` in Emacs. I've got pil correctly set
> > up:
> >
> >>which pil
> > /home/me/opt/picoLisp/pil
> >
> > and the command-line pil works fine
> >
> >>pil
> > : (version)
> > 18.2.3
> > -> (18 2 3)
> > :
> >
> > I've also spelled out to babel where pil is:
> >
> > Org Babel Picolisp Cmd: /home/me/opt/picoLisp/pil
> >
> > picolisp-mode starts up fine (using provided .el), but then it can't
> > evaluate, with similar errors above.
> >
> > L. Bottorff
> > Goshen, IN
> >
>
>
> --
> Warm Regards,
> Nehal Singhal
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>