Re: Emacs mode can't run pil

2018-03-03 Thread Lawrence Bottorff
 . . . yes, sessions
make perfect sense, but I thought sessions was an advanced feature for only
some of the "elite" languages, i.e., so many of the babel languages don't
support sessions. Still, I should have known to try. . .

Now, why would trying to run picolisp (org-mode or picolisp-mode) from an
Emacs started with emacsclient -c -a '' from my Gnome taskbar not work? It
gives the error in my Messages:

executing Picolisp code block...
executing Picolisp source code block
(New file)
Wrote /home/hercynian/.pil/editor
apply: Searching for program: No such file or directory, pil

and it writes `editor-orig` to ~/.pil, which I must then rm. I can only get
a REPL when I start Emacs from my command line, i.e.,

>emacs &

LB


On Sat, Mar 3, 2018 at 9:40 AM, Thorsten Jolitz  wrote:

> Lawrence Bottorff 
> writes:
>
> Hi Lawrence,
> [just for the protocoll, I send you the identical answer on the
> org-mode mailing list already].
>
> > I'm looking at picolisp -- and wondering how it works, or better, why it
> > doesn't really work work with babel. First problem, I couldn't get any
> > form of picolisp to work in Emacs -- until I stopped starting Emacs with
> > [...]
> > I don't mean to complain or sound negative, but picolisp as is can't
> > really be included as a babel language, can it? Maybe it worked once,
> > but doesn't now?
>
> sometimes the bug actually sits in front of the computer, as we all know
> ;-)
>
> Apparently you are not aware of the 'session' concept of org source
> blocks (please refer to the org manual).
> This is nothing specific to ob-picolisp, but holds for all ob languages
> that do allow for sessions:
>
> ,
> | * Picolisp scr-block test
> |
> | #+BEGIN_SRC picolisp  :session pil1
> |  (setq X1 (+ 3 4))
> | #+END_SRC
> |
> | #+results:
> | : 7
> |
> |
> | #+BEGIN_SRC picolisp  :session pil1
> | (setq X2 (+ X1 1))
> | #+END_SRC
> |
> | #+results:
> | : 8
> |
> |
> | #+BEGIN_SRC picolisp  :session pil1
> | (de foo1 (X) (+ X 2))
> | #+END_SRC
> |
> | #+results:
> | : foo1
> |
> | #+BEGIN_SRC picolisp  :session pil1 :results raw
> | (setq X3 (foo1 8))
> | #+END_SRC
> |
> | #+results:
> | 10
> `
>
> And, with a session, you do have a related interactive repl buffer in
> Emacs called "pil1", thats reflects all evaluations of the code blocks
> in the org file, and allows for user input just like the PicoLisp repl:
>
> ,
> | (setq X1 (+ 3 4))
> | 'org-babel-picolisp-eoe
> | : -> 7
> | : -> org-babel-picolisp-eoe
> | : (setq X2 (+ X1 1))
> | 'org-babel-picolisp-eoe
> | -> 8
> | : -> org-babel-picolisp-eoe
> | : (de foo1 (X) (+ X 2))
> | 'org-babel-picolisp-eoe
> | -> foo1
> | : -> org-babel-picolisp-eoe
> | : (setq X3 (foo1 8))
> | 'org-babel-picolisp-eoe
> | -> 10
> | : -> org-babel-picolisp-eoe
> | :
> `
>
> Hope that helps
>
> --
> cheers,
> Thorsten
>
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: Emacs mode can't run pil

2018-03-03 Thread Thorsten Jolitz
Lawrence Bottorff 
writes:

Hi Lawrence,
[just for the protocoll, I send you the identical answer on the
org-mode mailing list already].

> I'm looking at picolisp -- and wondering how it works, or better, why it
> doesn't really work work with babel. First problem, I couldn't get any
> form of picolisp to work in Emacs -- until I stopped starting Emacs with
> [...]
> I don't mean to complain or sound negative, but picolisp as is can't
> really be included as a babel language, can it? Maybe it worked once,
> but doesn't now?

sometimes the bug actually sits in front of the computer, as we all know
;-)

Apparently you are not aware of the 'session' concept of org source
blocks (please refer to the org manual). 
This is nothing specific to ob-picolisp, but holds for all ob languages
that do allow for sessions:

,
| * Picolisp scr-block test
| 
| #+BEGIN_SRC picolisp  :session pil1
|  (setq X1 (+ 3 4))
| #+END_SRC
| 
| #+results:
| : 7
| 
| 
| #+BEGIN_SRC picolisp  :session pil1
| (setq X2 (+ X1 1))
| #+END_SRC
| 
| #+results:
| : 8
| 
| 
| #+BEGIN_SRC picolisp  :session pil1
| (de foo1 (X) (+ X 2))
| #+END_SRC
| 
| #+results:
| : foo1
| 
| #+BEGIN_SRC picolisp  :session pil1 :results raw
| (setq X3 (foo1 8))
| #+END_SRC
| 
| #+results:
| 10
`

And, with a session, you do have a related interactive repl buffer in
Emacs called "pil1", thats reflects all evaluations of the code blocks
in the org file, and allows for user input just like the PicoLisp repl:

,
| (setq X1 (+ 3 4))
| 'org-babel-picolisp-eoe
| : -> 7
| : -> org-babel-picolisp-eoe
| : (setq X2 (+ X1 1))
| 'org-babel-picolisp-eoe
| -> 8
| : -> org-babel-picolisp-eoe
| : (de foo1 (X) (+ X 2))
| 'org-babel-picolisp-eoe
| -> foo1
| : -> org-babel-picolisp-eoe
| : (setq X3 (foo1 8))
| 'org-babel-picolisp-eoe
| -> 10
| : -> org-babel-picolisp-eoe
| : 
`

Hope that helps

-- 
cheers,
Thorsten


-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Emacs mode can't run pil

2018-02-23 Thread Lawrence Bottorff
Nothing new; I've tried all that. Yes, *some* of the examples in
https://github.com/tj64/ob-picolisp work. But again, the picolisp tutorial
example

#+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

produces

executing Picolisp code block...
executing Picolisp source code block
Wrote /tmp/babel-11969YoC/ob-input-119693pA
org-babel-execute:picolisp: End of file during parsing

and a basic thing like this:

#+name: hello
#+begin_src picolisp
(de hello (X)
   (prinl "Hello " X) )
#+end_src

isn't working either. It also gives

executing Picolisp code block (hello)...
executing Picolisp source code block
Wrote /tmp/babel-8702vHu/ob-input-8702Ete
org-babel-execute:picolisp: End of file during parsing

Again, picolisp-mode is working (however it doesn't like who, what, more,
etc), but org-mode not so well. I'm sure it has something to do with
org-mode babel's picolisp not  being properly integrated with
picolisp-mode. In general, I bother with Emacs org-mode because I think a
sizeable percentage of Emacs users now live inside of org-mode.

On Thu, Feb 22, 2018 at 9:44 PM, Nehal  wrote:

> 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 ru

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 block doesn't seem to 

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
>


Re: Emacs mode can't run pil

2018-02-21 Thread Nehal
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