Welcome to XCODX Online Compiler
Quick Start:
Ctrl+Enter Run code
Ctrl+S Save / Download
Ctrl+L Clear output
Select a language and start coding.
Welcome to XCODX Online Compiler
Quick Start:
Ctrl+Enter Run code
Ctrl+S Save / Download
Ctrl+L Clear output
Select a language and start coding.
Emacs Lisp is the programming language that the GNU Emacs text editor is built from and extended with. It is a dialect of Lisp, closely related to the older Maclisp with later borrowings from Common Lisp, first released with GNU Emacs in 1985 by Richard Stallman. Almost everything you see in Emacs, from editing commands to major modes, is written in Emacs Lisp, while only a small core, including the Lisp interpreter itself, is written in C. That makes it one of the most heavily used Lisp dialects in existence, even though it was designed to manipulate buffers and text rather than to be a general-purpose language. On XCODX it runs non-interactively with 'emacs --script' (batch mode), so there is no editor window, just your code reading input and printing results.
;; In batch mode, read-string reads a line from standard input.
(princ "What is your name? ")
(let ((name (read-string "")))
(princ (format "Hello, %s!\n" name))
(princ (format "2 + 3 = %d\n" (+ 2 3))))
Emacs Lisp exists to customize and program the Emacs editor: you use it to write commands, define modes, automate editing, and reshape the environment while it runs. Because it is a complete Lisp, it also handles lists, recursion, higher-order functions, and macros, so it works fine for small scripting and text-processing tasks. In this sandbox you can explore that Lisp core in batch mode and read from standard input. What you cannot do here is the thing Emacs Lisp is really for, interacting with live buffers, windows, and the editor UI, because no editor session is running.
It is a full Lisp dialect, not a limited config format. It has functions, closures, macros, and data structures, and happens to be specialized for driving the Emacs editor. The language underneath is general enough for real computation, which is what runs here.
Use the normal minibuffer-reading functions; in batch mode they read from standard input instead of prompting. '(read-string "")' returns one line as a string, and you can call it repeatedly. Type into the live terminal / Stdin Box and each read consumes the next line.
In batch mode Emacs sends 'message' to standard error and sends 'princ' and 'prin1' to standard output. For results you want in the console's main output, use 'princ', optionally with 'format', rather than 'message'.
No. There is no network and no package installation, and the filesystem resets each run, so 'package-install', MELPA, and external .el libraries are unavailable. You can only use functions built into the Emacs that ships in the sandbox.
No. 'emacs --script' runs Emacs headless with no UI, purely to execute your Lisp and then exit. Buffer and window commands still exist as functions, but there is no interactive editor to see, and the run has a short time limit.
It shares Lisp's parenthesized syntax and list processing but has its own libraries centered on text editing, and it historically used dynamic scoping (lexical binding is now available). Code written for Common Lisp or Scheme generally will not run unchanged.
main.elcommonlispread-string; Emacs Lisp
(message "Hello from Emacs Lisp!")
(message "Welcome to XCODX Online Compiler!")
;; List operations
(let ((numbers '(1 2 3 4 5)))
(message "Numbers: %s" numbers)
(message "Sum: %d" (apply #'+ numbers))
(message "Doubled: %s" (mapcar (lambda (x) (* x 2)) numbers)))
Emacs echoes its output on both the pty and stderr. The duplicate copy is collapsed so each line appears once.