all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* REPL
@ 2004-11-27 18:55 Elvin Peterson
  2004-11-27 19:17 ` REPL Maciek Pasternacki
                   ` (4 more replies)
  0 siblings, 5 replies; 15+ messages in thread
From: Elvin Peterson @ 2004-11-27 18:55 UTC (permalink / raw)


How do I create a REPL for emacs for elisp?

TIA.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: REPL
  2004-11-27 18:55 REPL Elvin Peterson
@ 2004-11-27 19:17 ` Maciek Pasternacki
  2004-11-27 19:50 ` REPL Marco Gidde
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 15+ messages in thread
From: Maciek Pasternacki @ 2004-11-27 19:17 UTC (permalink / raw)


On Boomtime, The Aftermath 40, 3170 YOLD, Elvin Peterson wrote:

> How do I create a REPL for emacs for elisp?

Just use lisp-interaction-mode, there you can use C-j to evaluate form
before the cursor and result is inserted into the buffer.  The initial
*scratch* buffer is started in this mode.

-- 
__    Maciek Pasternacki <maciekp@japhy.fnord.org> [ http://japhy.fnord.org/ ]
`| _   |_\  / { Hac in hora sine mora corde pulsum tangite;
,|{-}|}| }\/         quod per sortem sternit fortem, mecum omnes plangite!   }
\/   |____/                                           ( Carmina Burana )  -><-

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: REPL
  2004-11-27 18:55 REPL Elvin Peterson
  2004-11-27 19:17 ` REPL Maciek Pasternacki
@ 2004-11-27 19:50 ` Marco Gidde
  2004-11-28 17:53   ` REPL Elvin Peterson
       [not found] ` <mailman.1833.1101583655.27204.help-gnu-emacs@gnu.org>
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 15+ messages in thread
From: Marco Gidde @ 2004-11-27 19:50 UTC (permalink / raw)


Elvin Peterson <elvin_peterson@yahoo.com> writes:

> How do I create a REPL for emacs for elisp?

You could try the command ielm (Interactive Emacs Lisp Mode). It's
more like the 'classical' REPL you might know from other Scheme or
Common Lisp implementations.


-- 
Marco Gidde

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: REPL
  2004-11-27 19:50 ` REPL Marco Gidde
@ 2004-11-28 17:53   ` Elvin Peterson
  2004-11-28 21:48     ` REPL Marco Gidde
                       ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Elvin Peterson @ 2004-11-28 17:53 UTC (permalink / raw)


Marco Gidde wrote:
> Elvin Peterson <elvin_peterson@yahoo.com> writes:
> 
> 
>>How do I create a REPL for emacs for elisp?
> 
> 
> You could try the command ielm (Interactive Emacs Lisp Mode). It's
> more like the 'classical' REPL you might know from other Scheme or
> Common Lisp implementations.
> 
> 

Thanks.  I get the error -- command cat not found when I try to run it. 
  IIRC, the REPL code for COMMON LISP is just a couple of lines, so I 
was hoping someone would post similar stuff for emacs.

Thanks.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: REPL
       [not found] ` <mailman.1833.1101583655.27204.help-gnu-emacs@gnu.org>
@ 2004-11-28 17:55   ` Elvin Peterson
  2004-11-28 19:36     ` REPL Pascal Bourguignon
  0 siblings, 1 reply; 15+ messages in thread
From: Elvin Peterson @ 2004-11-28 17:55 UTC (permalink / raw)


Maciek Pasternacki wrote:
> On Boomtime, The Aftermath 40, 3170 YOLD, Elvin Peterson wrote:
> 
> 
>>How do I create a REPL for emacs for elisp?
> 
> 
> Just use lisp-interaction-mode, there you can use C-j to evaluate form
> before the cursor and result is inserted into the buffer.  The initial
> *scratch* buffer is started in this mode.
> 

That is quite painful to use, especially since I don't get the command 
recall and options to access outputs of previous commands.  Something 
like SLIME would be really nice.

Thanks.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: REPL
  2004-11-28 17:55   ` REPL Elvin Peterson
@ 2004-11-28 19:36     ` Pascal Bourguignon
  2004-11-28 22:01       ` REPL Marco Gidde
  2004-11-29 18:30       ` REPL Elvin Peterson
  0 siblings, 2 replies; 15+ messages in thread
From: Pascal Bourguignon @ 2004-11-28 19:36 UTC (permalink / raw)


Elvin Peterson <elvin_peterson@yahoo.com> writes:

> Maciek Pasternacki wrote:
> > On Boomtime, The Aftermath 40, 3170 YOLD, Elvin Peterson wrote:
> >
> >>How do I create a REPL for emacs for elisp?
> > Just use lisp-interaction-mode, there you can use C-j to evaluate
> > form
> > before the cursor and result is inserted into the buffer.  The initial
> > *scratch* buffer is started in this mode.
> >
> 
> That is quite painful to use, especially since I don't get the command
> recall and options to access outputs of previous commands.  Something
> like SLIME would be really nice.

Yes, some work hard on stuff like ilisp or slime to try to be able to
use other lisp like emacs-lisp, and others are not happy with
emacs-lisp REPL and want the harder lisp REPL...

If you want to get the answer when typing RET instead of C-u C-x C-e, use:

(defun newline-and-eval ()
  (interactive)
  (insert "\n")
  (eval-last-sexp t))

(local-set-key "C-j" 'newline-and-eval)

(and instead of typing RET when you want to insert a new line, type C-q RET)

Or you could use:

(local-set-key [C-return] 'newline-and-eval)

to differenciate a normal new-line (RET) from one when you want to
evaluate (C-return).

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
The world will now reboot; don't bother saving your artefacts.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: REPL
  2004-11-28 17:53   ` REPL Elvin Peterson
@ 2004-11-28 21:48     ` Marco Gidde
  2004-11-29 11:48     ` REPL Kai Grossjohann
  2004-12-04 11:21     ` REPL Oliver Scholz
  2 siblings, 0 replies; 15+ messages in thread
From: Marco Gidde @ 2004-11-28 21:48 UTC (permalink / raw)


Elvin Peterson <elvin_peterson@yahoo.com> writes:

>> You could try the command ielm (Interactive Emacs Lisp Mode). It's
>> more like the 'classical' REPL you might know from other Scheme or
>> Common Lisp implementations.
>>
>
> Thanks.  I get the error -- command cat not found when I try to run
> it. IIRC, the REPL code for COMMON LISP is just a couple of lines, so
> I was hoping someone would post similar stuff for emacs.

Sorry, I wasn't thinking of Windows NT. But as I saw in another thread
you're just solving your cygwin problems :-)

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: REPL
  2004-11-28 19:36     ` REPL Pascal Bourguignon
@ 2004-11-28 22:01       ` Marco Gidde
  2004-11-29 18:30       ` REPL Elvin Peterson
  1 sibling, 0 replies; 15+ messages in thread
From: Marco Gidde @ 2004-11-28 22:01 UTC (permalink / raw)


Pascal Bourguignon <spam@mouse-potato.com> writes:

> Yes, some work hard on stuff like ilisp or slime to try to be able to
> use other lisp like emacs-lisp, and others are not happy with
> emacs-lisp REPL and want the harder lisp REPL...

I think both 'modes', the usual emacs/ilisp/slime stuff and the REPL,
have their strong points. The first is most useful for programming,
the second for testing and trying out small snippets of code. If there
were no REPL I would really miss *, ** and *** :-)

-- 
Marco Gidde

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: REPL
  2004-11-28 17:53   ` REPL Elvin Peterson
  2004-11-28 21:48     ` REPL Marco Gidde
@ 2004-11-29 11:48     ` Kai Grossjohann
  2004-12-04 11:21     ` REPL Oliver Scholz
  2 siblings, 0 replies; 15+ messages in thread
From: Kai Grossjohann @ 2004-11-29 11:48 UTC (permalink / raw)


Elvin Peterson <elvin_peterson@yahoo.com> writes:

> Thanks.  I get the error -- command cat not found when I try to run it. 

I think you can tell it to run hexl instead.  This might have been
fixed in the CVS version of Emacs.  So you could search the ChangeLog
file for the relevant entry and patch your version of Emacs.

Kai

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: REPL
  2004-11-28 19:36     ` REPL Pascal Bourguignon
  2004-11-28 22:01       ` REPL Marco Gidde
@ 2004-11-29 18:30       ` Elvin Peterson
  1 sibling, 0 replies; 15+ messages in thread
From: Elvin Peterson @ 2004-11-29 18:30 UTC (permalink / raw)


Pascal Bourguignon wrote:
> Elvin Peterson <elvin_peterson@yahoo.com> writes:
> 
> 
>>Maciek Pasternacki wrote:
>>
>>>On Boomtime, The Aftermath 40, 3170 YOLD, Elvin Peterson wrote:
>>>
>>>
>>>>How do I create a REPL for emacs for elisp?
>>>
>>>Just use lisp-interaction-mode, there you can use C-j to evaluate
>>>form
>>>before the cursor and result is inserted into the buffer.  The initial
>>>*scratch* buffer is started in this mode.
>>>
>>
>>That is quite painful to use, especially since I don't get the command
>>recall and options to access outputs of previous commands.  Something
>>like SLIME would be really nice.
> 
> 
> Yes, some work hard on stuff like ilisp or slime to try to be able to
> use other lisp like emacs-lisp, and others are not happy with
> emacs-lisp REPL and want the harder lisp REPL...

I was thinking more in terms of teaching new users rather than 
application development.  Downloading, installing, and configuring a 
standalone lisp seems more involved than just running emacs.

Thanks for the reply.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: REPL
  2004-11-27 18:55 REPL Elvin Peterson
                   ` (2 preceding siblings ...)
       [not found] ` <mailman.1833.1101583655.27204.help-gnu-emacs@gnu.org>
@ 2004-11-30 21:53 ` Alan Mackenzie
  2004-11-30 23:31   ` REPL Joe Corneli
  2004-12-02  8:24 ` REPL Friedrich Dominicus
  4 siblings, 1 reply; 15+ messages in thread
From: Alan Mackenzie @ 2004-11-30 21:53 UTC (permalink / raw)


Elvin Peterson <elvin_peterson@yahoo.com> wrote on Sun, 28 Nov 2004
00:25:18 +0530:
> How do I create a REPL for emacs for elisp?

A _what_?

A Regular Expression Parsing Language?
A Redundant Elisp Parenthesis Lopper?
A Railway Engine Passing Loop?

???

> TIA.

-- 
Alan Mackenzie (Munich, Germany)
Email: aacm@muuc.dee; to decode, wherever there is a repeated letter
(like "aa"), remove half of them (leaving, say, "a").

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: REPL
  2004-11-30 21:53 ` REPL Alan Mackenzie
@ 2004-11-30 23:31   ` Joe Corneli
  0 siblings, 0 replies; 15+ messages in thread
From: Joe Corneli @ 2004-11-30 23:31 UTC (permalink / raw)


   Elvin Peterson <elvin_peterson@yahoo.com> wrote on Sun, 28 Nov 2004
   00:25:18 +0530:
   > How do I create a REPL for emacs for elisp?

   A _what_?

GIYF.

http://www.cliki.net/REPL

   A Redundant Elisp Parenthesis Lopper?

Basically correct.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: REPL
  2004-11-27 18:55 REPL Elvin Peterson
                   ` (3 preceding siblings ...)
  2004-11-30 21:53 ` REPL Alan Mackenzie
@ 2004-12-02  8:24 ` Friedrich Dominicus
  4 siblings, 0 replies; 15+ messages in thread
From: Friedrich Dominicus @ 2004-12-02  8:24 UTC (permalink / raw)


Elvin Peterson <elvin_peterson@yahoo.com> writes:

> How do I create a REPL for emacs for elisp?
use M-x ielm

Regards
Friedrich

-- 
Please remove just-for-news- to reply via e-mail.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: REPL
  2004-11-28 17:53   ` REPL Elvin Peterson
  2004-11-28 21:48     ` REPL Marco Gidde
  2004-11-29 11:48     ` REPL Kai Grossjohann
@ 2004-12-04 11:21     ` Oliver Scholz
  2004-12-04 12:17       ` REPL Pascal Bourguignon
  2 siblings, 1 reply; 15+ messages in thread
From: Oliver Scholz @ 2004-12-04 11:21 UTC (permalink / raw)


[Since M-x ielm has already been pointed to by others ...]

Elvin Peterson <elvin_peterson@yahoo.com> writes:
[...]
> IIRC, the REPL code for COMMON LISP is just a couple of lines, so I
> was hoping someone would post similar stuff for emacs.

Sure, to get a very basic REPL in Emacs is simple:

;; Because we use `loop' for the looks of it:
(require 'cl)

(let* ((buffer (generate-new-buffer "*tmp*"))
       (standard-output buffer))
  (switch-to-buffer buffer)
  ;; The REPL:
  (loop (print (eval (read)))))

The extra code in ielm is to get something a tiny little bit more
comfortable.

    Oliver
-- 
14 Frimaire an 213 de la Révolution
Liberté, Egalité, Fraternité!

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: REPL
  2004-12-04 11:21     ` REPL Oliver Scholz
@ 2004-12-04 12:17       ` Pascal Bourguignon
  0 siblings, 0 replies; 15+ messages in thread
From: Pascal Bourguignon @ 2004-12-04 12:17 UTC (permalink / raw)


Oliver Scholz <alkibiades@gmx.de> writes:

> [Since M-x ielm has already been pointed to by others ...]
> 
> Elvin Peterson <elvin_peterson@yahoo.com> writes:
> [...]
> > IIRC, the REPL code for COMMON LISP is just a couple of lines, so I
> > was hoping someone would post similar stuff for emacs.
> 
> Sure, to get a very basic REPL in Emacs is simple:
> 
> ;; Because we use `loop' for the looks of it:
> (require 'cl)
> 
> (let* ((buffer (generate-new-buffer "*tmp*"))
>        (standard-output buffer))
>   (switch-to-buffer buffer)
>   ;; The REPL:
>   (loop (print (eval (read)))))
> 
> The extra code in ielm is to get something a tiny little bit more
> comfortable.

Good idea. It could be useful to handle errors, history variables and
termination:


(defvar +++ nil)
(defvar ++  nil)
(defvar +   nil)
(defvar /// nil)
(defvar //  nil)
(defvar /   nil)
(defvar *** nil)
(defvar **  nil)
(defvar *   nil)
(defvar -   nil)

(defun repl ()
  (interactive)
  ;; I prefer to do it in the current buffer.
  (let ((standard-output  (current-buffer)))
    (switch-to-buffer standard-output)
    (block nil
      (loop for hist from 1 do
            (setf +++ ++   
                  ++  + 
                  +   -
                  -   (read))
            (insert (format  "[%d]> %S\n" hist -))
            (when (or (member - '((quit)(exit)(continue))))
              (insert "Good bye.\n")
              (return))
            (setf /// //   
                  //  /
                  /   (list (condition-case G61912 (eval -) (error G61912)))
                  *** **
                  **  *
                  *   (first /))
            (insert (format (format "%%%ds %%S\n\n" 
                              (length (format "[%d]>" hist))) "-->" *))))))

M-x repl RET

[1]> (dotimes (i 5) (if (oddp i) (princ "odd: %d
" i) (princ "even: %d
" i)))
 --> (invalid-function 0)

[2]> (princ "toto")
toto --> "toto"

[3]> (dotimes (i 5) (princ (format (if (oddp i) "odd:  %d
" "even: %d
") i)))
even: 0
odd:  1
even: 2
odd:  3
even: 4
 --> nil

[4]> (/ 5550690 30)
 --> 185023

[5]> (quit)
Good bye.

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
The world will now reboot; don't bother saving your artefacts.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2004-12-04 12:17 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-27 18:55 REPL Elvin Peterson
2004-11-27 19:17 ` REPL Maciek Pasternacki
2004-11-27 19:50 ` REPL Marco Gidde
2004-11-28 17:53   ` REPL Elvin Peterson
2004-11-28 21:48     ` REPL Marco Gidde
2004-11-29 11:48     ` REPL Kai Grossjohann
2004-12-04 11:21     ` REPL Oliver Scholz
2004-12-04 12:17       ` REPL Pascal Bourguignon
     [not found] ` <mailman.1833.1101583655.27204.help-gnu-emacs@gnu.org>
2004-11-28 17:55   ` REPL Elvin Peterson
2004-11-28 19:36     ` REPL Pascal Bourguignon
2004-11-28 22:01       ` REPL Marco Gidde
2004-11-29 18:30       ` REPL Elvin Peterson
2004-11-30 21:53 ` REPL Alan Mackenzie
2004-11-30 23:31   ` REPL Joe Corneli
2004-12-02  8:24 ` REPL Friedrich Dominicus

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.