tutorial source how for emacs elisp

source - emacs tutorial



Ejecutar el programa elisp sin Emacs? (1)

Definitivamente, puede ejecutar scripts elisp en Emacs sin iniciar la interfaz del editor.

Aquí están las notas que he hecho / copiado de algunas preguntas y respuestas extremadamente útiles sobre el tema aquí en SO (y las dos siguientes en particular).

;;;; Elisp executable scripts ;; --batch vs --script ;; M-: (info "(emacs) Initial Options") RET ;; M-: (info "(elisp) Batch Mode") RET ;; Passing additional command-line arguments to Emacs: ;; https://stackoverflow.com/questions/6238331/#6259330 ;; ;; For robustness, it''s important to both pass ''--'' as an argument ;; (to prevent Emacs from trying to process option arguments intended ;; for the script), and also set "argv" to nil at the end of the script ;; (to prevent Emacs from visiting the non-option arguments as files). ;; ;; #!/bin/sh ;; ":"; exec emacs --no-site-file --script "$0" -- "$@" # -*-emacs-lisp-*- ;; (print (+ 2 2)) ;; (setq argv nil) ;; always end with this ;; Processing with STDIN and STDOUT via --script: ;; https://stackoverflow.com/questions/2879746/#2906967 ;; ;; #!/usr/local/bin/emacs --script ;; ;;-*- mode: emacs-lisp;-*- ;; ;; (defun process (string) ;; "just reverse the string" ;; (concat (nreverse (string-to-list string)))) ;; ;; (condition-case nil ;; (let (line) ;; ;; commented out b/c not relevant for `cat`, but potentially useful ;; ;; (princ "argv is ") ;; ;; (princ argv) ;; ;; (princ "/n") ;; ;; (princ "command-line-args is" ) ;; ;; (princ command-line-args) ;; ;; (princ "/n") ;; ;; (while (setq line (read-from-minibuffer "")) ;; (princ (process line)) ;; (princ "/n"))) ;; (error nil))

Dejando de lado a Emacs, el único otro intérprete / compilador elisp que conozco es Guile. Si le interesa la codificación general en elisp, vale la pena echarle un vistazo (especialmente si el rendimiento es una preocupación).

Elisp es un buen lenguaje, me parece que puede manejar todo tipo de trabajos, pero ¿puedo usarlo como un script de shell?

es decir, ejecutar algunos archivos * .el desde la consola, sin iniciar Emacs. O lance Emacs, pero no entre en modo interactivo.