summaryrefslogtreecommitdiff
path: root/module/language/elisp
AgeCommit message (Collapse)AuthorFilesLines
2012-03-08elisp rngBT Templeton1-0/+15
* module/language/elisp/boot.el (random): New function.
2012-03-08elisp i/oBT Templeton1-0/+13
* module/language/elisp/boot.el (send-string-to-terminal) (read-from-minibuffer, prin1-to-string): New functions.
2012-03-08elisp: symbol-name, internBT Templeton1-0/+2
* module/language/elisp/boot.el (symbol-name, intern): New functions.
2012-03-08elisp: when, unlessBT Templeton1-0/+8
* module/language/elisp/boot.el (when, unless): New macros.
2012-03-08elisp sequence functionsBT Templeton1-0/+82
* module/language/elisp/boot.el (nreverse, assoc, assq, rplaca, rplacd) (caar, cadr, cdar, cddr, dolist, stringp, string-equal, string=) (substring, upcase, downcase, string-match, make-vector, mapc, aref) (aset, concat): New functions.
2012-03-08integerp, wholenump return nil for non-numbersBT Templeton1-5/+3
* module/language/elisp/boot.el (integerp, wholenump): Call `integer?' before `exact?' so that these predicates return nil for non-numbers instead of signalling an error.
2012-03-05use #nil as default for elisp rest parametersBT Templeton1-1/+8
* module/langauge/elisp/compile-tree-il.scm (compile-lambda): Bind the rest parameter to `#nil' instead of `()' by default.
2012-03-05Merge branch 'bt/elisp'BT Templeton12-1394/+1077
Conflicts: am/guilec libguile/_scm.h libguile/vm-i-scheme.c module/language/elisp/compile-tree-il.scm module/language/elisp/runtime.scm module/language/elisp/runtime/macros.scm module/language/tree-il/compile-glil.scm module/language/tree-il/primitives.scm
2012-02-03function binding fixesBT Templeton2-62/+78
* module/language/elisp/bindings.scm (bindings): Add `function-bindings' field. (make-bindings): Initialize the `function-bindings' field. (get-function-binding, with-function-bindings): New functions. (access-variable, reference-variable, set-variable!): Remove the `module' argument and only handle references to the value cell. All callers changed. Callers passing `function-slot' as the module changed to use the corresponding functions for the function cell instead. (access-function, reference-function, set-function!): New procedures. (compile-flet, compile-labels): Use `with-function-bindings' instead of `with-lexical-bindings'.
2012-02-03sharpsign-colon for uninterned symbolsBT Templeton1-1/+6
* module/language/elisp/lexer.sm (lex): Add support for `#:' syntax for uninterned symbols.
2012-02-03elisp I/OBT Templeton1-0/+14
* module/language/elisp/boot.el (princ, print, terpri, format*): New functions.
2012-02-03improve management of global special variablesBT Templeton2-151/+109
* module/language/elisp/bindings.scm (bindings): Remove `globals' field. (global?, mark-global!, map-globals): Remove. All callers changed. * module/language/elisp/compile-tree-il.scm (generate-ensure-global, ensuring-globals): Remove. All callers changed. (global?, ensure-globals!): New procedures. (bind-lexically?): Use new `global?'. (compile-lambda, compile-let, compile-let*): Use `ensure-globals!'.
2012-02-03more lexical declarationsBT Templeton1-0/+5
* module/language/elisp/boot.el (condition-case, catch): Add `lexical' declarations in macro expansions.
2012-02-03signal an error for uncaught throwsBT Templeton1-3/+6
* module/language/elisp/boot.el (%catch): New variable. (catch): Bind `%catch' to `t' during the evaluation of `body'. Call `throw' instead of signalling an exception directly. (throw): Signal a `no-catch' error if there is no `catch' to throw to.
2012-02-03`catch' in terms of `condition-case'BT Templeton1-21/+16
* module/language/elisp/boot.el (throw): Define an `error-conditions' property for this symbol. (catch): Define in terms of `condition-case' instead of using Guile exceptions directly. (throw): Signal a `throw' condition instead of throwing a Guile exception directly.
2012-02-03standard error symbolsBT Templeton1-0/+6
* module/language/elisp/boot.el (error, wrong-type-argument, no-catch, invalid-function): Define `error-conditions' properties for these standard error symbols.
2012-02-03`%plist-member' fixBT Templeton1-5/+7
* module/language/elisp/boot.el (%plist-member): Use recursion to avoid using `catch' and `throw'.
2012-02-03condition-caseBT Templeton1-2/+27
* module/language/elisp/boot.el (signal): Accept only two arguments, and throw an `elisp-condition' exception instead of an `elisp-error' exception. (condition-case): New macro.
2012-02-03elisp `member' subrsBT Templeton1-0/+18
* module/language/elisp/boot.el (%member, member, memql, memq): New functions.
2012-02-03use `dynlet' for dynamic bindingBT Templeton1-41/+36
* module/language/elisp/compile-tree-il.scm (let-dynamic): Remove. All callers changed to use `dynlet' instead.
2012-02-03inline `generate-let' and `generate-let*'BT Templeton1-97/+79
* module/language/elisp/compile-tree-il.scm (generate-let, compile-let): Inline the former into the latter. (generate-let*, compile-let*): Likewise.
2012-02-03define `flet' directlyBT Templeton1-7/+15
* module/language/elisp/compile-tree-il.scm (compile-flet): Compile `flet' directly instead of using `generate-let'.
2012-02-03lexical binding macrosBT Templeton3-28/+25
* module/language/elisp/boot.el (lexical-let, lexical-let*): New macros. * module/language/elisp/compile-tree-il.scm (bind-lexically?): Remove the check for a `lexical' flag, since `lexical-let' and `lexical-let*' are no longer special operators. (compile-lexical-let, compile-lexical-let*): Remove. * module/language/elisp/runtime/function-slot.scm: Update module definition.
2012-02-03use `lexical' declarations in "boot.el"BT Templeton1-5/+9
* module/language/elisp/boot.el (prog1, cond, or, catch): Use `let' with `lexical' declarations instead of `lexical-let'. (%plist-put): Use `let' instead of `lexical-let', since "boot.el" now uses lexical binding by default.
2012-02-03elisp `while' macroBT Templeton3-50/+8
* module/language/elisp/compile-tree-il.scm (compile-while): Remove. * module/language/elisp/boot.el (while): New macro. * module/language/elisp/runtime/function-slot.scm: Update module definition.
2012-02-03elisp `labels'BT Templeton2-0/+23
* module/language/elisp/compile-tree-il.scm (compile-labels): New special operator. * module/language/elisp/runtime/function-slot.scm: Update module definition.
2012-02-03fix `flet' syntaxBT Templeton1-97/+113
* module/language/elisp/compile-tree-il.scm (process-let-bindings): Remove. (parse-let-binding, parse-flet-binding): New procedures. (generate-let, generate-let*): Now takes an association list mapping symbols to values for the `bindings' argument. (compile-let, compile-let*, compile-lexical-let) (compile-lexical-let*): Parse the bindings list with `parse-let-binding'. (compile-flet): Parse the bindings list with `parse-flet-binding'.
2012-02-03elisp binding declarationsBT Templeton1-68/+52
* module/language/elisp/compile-tree-il.scm (bind-lexically?): Accept a new `decls' argument and check it for `lexical' declarations. Establish the same kind of binding whether or not a lexical binding for `sym' exists, whereas previously the presence of a lexical binding would cause newly-established bindings to be lexical bindings as well. (split-let-bindings): Remove. All callers changed. (generate-let, generate-let*, compile-lambda): Pass the declarations list to `bind-lexically?'. * test-suite/tests/elisp-compiler.test: Explicitly disable the lexical-binding mode. Add `lexical' declarations where necessary.
2012-02-03declaration parsingBT Templeton1-105/+147
* module/language/elisp/compile-tree-il.scm (parse-body-1, parse-body) (parse-lambda-body, parse-declaration): New procedures. (generate-let, generate-let*): Use `parse-body'. (compile-lambda): Use `parse-lambda-body'.
2012-02-03elisp lambda list parsingBT Templeton1-171/+90
* module/language/elisp/compile-tree-il.scm (split-lambda-arguments): Remove. (parse-lambda-list, make-simple-lambda): New procedures. (compile-lambda): Use `parse-lambda-list' and `make-simple-lambda'. Set empty rest arguments to the empty list instead of `#nil'. * test-suite/tests/elisp-compiler.test ("Lambda Expressions")["rest argument"]: Use Elisp `null' instead of a Scheme equality check.
2012-02-03elisp function subrsBT Templeton5-69/+90
* module/language/elisp/boot.el (null, consp, listp, car, cdr) (make-symbol, signal): Use `%funcall' instead of `funcall' or `fset'. (symbolp, symbol-function, eval): Use `%funcall', since `funcall' now calls these functions. (functionp, %indirect-function): New functions. (funcall): Define in terms of `%funcall' and `%indirect-function'. (apply): New function. Previously defined in "module/language/elisp/runtime/subrs.scm". (fset): If `definition' is not a function, set the function cell of `symbol' to an falias for `definition'. * module/language/elisp/falias.scm: New file. * module/language/elisp/subrs.scm: Remove file. (apply): Remove. Now defined in "boot.el". * module/language/elisp/runtime/function-slot.scm: Update module definition. * module/Makefile.am: Update.
2012-02-03remove dynamic function bindingBT Templeton2-22/+12
* module/language/elisp/compile-tree-il.scm (find-operator): Assume that `name' is lexically bound. * module/language/elisp/runtime.scm (symbol-fbound?, fmakunbound!): Assume that `symbol' is lexically bound. (defspecial): Bind special operators lexically.
2012-02-03elisp nil equalityBT Templeton1-2/+14
* module/language/elisp/boot.el (eq, equal): Return `#t' if both arguments are nil. (eql): New function.
2012-02-03use lexical binding in boot.elBT Templeton1-1/+1
* module/language/elisp/boot.el: Use lexical binding.
2012-02-03remove unused codeBT Templeton2-32/+1
* module/language/elisp/compile-tree-il.scm (runtime-error): Remove. * module/language/elisp/runtime.scm (macro-error, runtime-error, elisp-bool, prim): Remove.
2012-02-03new elisp special form `%funcall'BT Templeton2-0/+10
* module/language/elisp/compile-tree-il.scm (compile-%funcall): New procedure. * module/language/elisp/runtime/function-slot.scm: Update module definition.
2012-02-03rewrite `eval' and `load' in elispBT Templeton2-15/+18
* module/language/elisp/subrs.scm (eval, load): Rewrite in Elisp and move to... * module/language/elisp/boot.el (eval, load): ...here.
2012-02-03evaluate the function position correctlyBT Templeton1-5/+1
* module/language/elisp/compile-tree-il (compile-pair): Use `function' to perform functional evaluation. Previously, if the operator of a compound form was not a symbol, the operator would be evaluated as a normal expression. This happened to work only because there is a `lambda' macro. The compiler will now signal an error if the operator is neither a function name nor a lambda expression. * test-suite/tests/elisp-compiler.test ("Lambda Expressions")["optional argument"]: Remove an erroneous use of `function' in the function position.
2012-02-03purify elisp symbol cell modulesBT Templeton2-2/+4
* module/language/elisp/runtime/function-slot.scm: * module/language/elisp/runtime/value-slot.scm: Define these as pure modules.
2012-02-03record elisp function namesBT Templeton1-4/+8
* language/elisp/compile-tree-il.scm (compile-lambda): Add a `meta' argument for the procedure's properties. (compile-function, compile-defmacro, compile-defun): Update accordingly, passing a `name' property to `compile-lambda' where possible.
2012-02-03elisp variable aliasesBT Templeton1-0/+8
* module/language/elisp/boot.el (defvaralias): New function.
2012-02-03simplify elisp symbol accessorsBT Templeton4-99/+92
* module/language/elisp/boot.el (fset, symbol-value, symbol-function) (set, makunbound, fmakunbound, boundp, fboundp): Use procedures in `(language elisp runtime)'. (symbolp): New function. * module/language/elisp/compile-tree-il.scm (set-variable!): Use `set-symbol-function!'. * module/language/elisp/runtime.scm (reference-variable, set-variable!): Remove. (symbol-fluid, set-symbol-fluid!): New procedure. (symbol-value, set-symbol-value!, symbol-function) (set-symbol-function!, symbol-bound?, symbol-fbound?, makunbound!) (fmakunbound!): Moved from `(language elisp subrs)' and updated to avoid using `reference-variable' and `set-variable!'. * module/language/elisp/runtime/subrs.scm (symbol-value) (symbol-function, set, fset, makunbound, fmakunbound, boundp) (fboundp): Move to `(language elisp runtime)'. (apply): Use `symbol-function'.
2012-02-03elisp property listsBT Templeton1-0/+47
* module/language/elisp/boot.el (%plist-member, %plist-get, %plist-put) (plist-get, plist-put, plist-member, lax-plist-get, lax-plist-put) (symbol-plist, setplist, get, put): New functions. (plist-function): New variable.
2012-02-03simplify `mark-global!'BT Templeton1-3/+1
* module/language/elisp/bindings.scm (mark-global!): Use `lset-adjoin'.
2012-02-03remove `flet*' elisp special formBT Templeton2-9/+1
* module/language/elisp/compile-tree-il.scm (compile-flet*): Remove. * module/language/elisp/runtime/function-slot.scm: Update module definition. * test-suite/tests/elisp-compiler.test ("Lambda Expressions")["flet and flet*"]: Remove `flet*' test.
2012-02-03remove `with-always-lexical' elisp special formBT Templeton2-51/+5
* module/language/elisp/compile-tree-il.scm: (always-lexical): Remove. All uses changed. (with-added-symbols): Remove. (compile-with-always-lexical): Remove. (process-options!): Remove support for the `#:always-lexical' option. * module/language/elisp/runtime/function-slot.scm: Update import and re-export lists. * test-suite/tests/elisp-compiler.test: Remove or update tests using `with-always-lexical'.
2012-02-03emacs-compatible lexical bindingBT Templeton5-9/+46
* module/language/elisp/bindings.scm (global?): New function. * module/language/elisp/compile-tree-il.scm (lexical-binding): New variable. (bind-lexically?): If lexical binding is enabled, bind lexically unless a special binding exists. (compile-%set-lexical-binding-mode): New function. * module/language/elisp/lexer.scm (lexical-binding-regexp): New variable. (lex): Return a `set-lexical-binding-mode!' token if a comment is found while reading the first line. * module/language/elisp/parser.scm (get-expression): Add support for `set-lexical-binding-mode!' tokens. * module/language/elisp/runtime/function-slot.scm: Import and re-export the `%set-lexical-binding-mode' special form. * test-suite/tests/elisp-compiler.test ("Let and Let*")["lambda args inside lexical-let"]: Update.
2012-02-03remove `bind-arg-lexical?'BT Templeton1-7/+2
* module/language/elisp/compile-tree-il.scm (bind-arg-lexical?): Remove. All callers changed to use `bind-lexically?'.
2012-02-03fix elisp `catch'BT Templeton1-4/+4
* module/language/elisp/boot.el (catch): Only catch exceptions of type `elisp-exception'.
2012-02-03implement `throw' in elispBT Templeton2-7/+3
* module/language/elisp/runtime/subrs.scm (throw): Rewrite in Elisp and move to... * module/language/elisp/boot.el (throw): ...here.