3

Is there a way for multi-line input in EShell? When I want to do a quick function definition at the commandline of EShell, it doesn't really work. I tried using explicit linebreaks (\n), as well as single-quotes ('') and double quotes (""), but with no success.

When I write a newline \n and press enter (point is at position *) I get an error message and a new eshell prompt.

$ (def foo (x y ) \n *)
Symbol's function definition is void: def

When I use C-q C-j and press Enter (point is at position *) I get the same error message and a new eshell prompt.

$ 
(def foo (x y) *)
Symbol's function definition is void: def
phils
  • 71,335
  • 11
  • 153
  • 198
Thorsten
  • 3,451
  • 3
  • 20
  • 25
  • NTEmacs 23.3.1 seems perfectly happy for me to use newlines in a function definition in eshell. What does "it doesn't really work" actually mean? – phils Jun 03 '11 at 12:00
  • Right, that explains it. See answer below. – phils Jun 04 '11 at 05:10

2 Answers2

0

You have to leave a parenthesis open to prevent Eshell from evaluating the input prematurely. Also, as pointed out by phils, def is not defined in stock Elisp; you probably want defun.

huaiyuan
  • 26,129
  • 5
  • 57
  • 63
  • Yes, that solves the problem. I use minor-modes pair (or paredit) that always give me the closing parenthesis too. When I delete it multiline input works by just pressing enter (no explizit \n in the text). Thanks. – Thorsten Jun 04 '11 at 12:00
0

There is no (def).

In elisp you define functions with (defun).

See C-hf defun RET

http://www.gnu.org/software/emacs/manual/html_node/elisp/Defining-Functions.html

phils
  • 71,335
  • 11
  • 153
  • 198