From 31ad74e07ca4b77ffbfdc104b403efda61487e40 Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Thu, 4 Dec 2008 21:17:37 +0100 Subject: Add function IN-METHOD-SYNTAX. darcs-hash:d988f9cdc21410c6910aa52e0f396a2ebc7216fb --- Lisp/defpackage.lisp | 1 + Lisp/reader-syntax.lisp | 15 +++++++++++---- NEWS | 8 ++++++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Lisp/defpackage.lisp b/Lisp/defpackage.lisp index 074e8ab..3c560e5 100644 --- a/Lisp/defpackage.lisp +++ b/Lisp/defpackage.lisp @@ -25,6 +25,7 @@ #:shutdown-runtime #:install-reader-syntax #:enable-method-syntax + #:in-method-syntax #:enable-objective-c-syntax #:disable-method-syntax #:disable-objective-c-syntax diff --git a/Lisp/reader-syntax.lisp b/Lisp/reader-syntax.lisp index 18174d2..905807d 100644 --- a/Lisp/reader-syntax.lisp +++ b/Lisp/reader-syntax.lisp @@ -22,6 +22,16 @@ (defvar *bracket-syntax-macro-chars* (list)) +(defun in-method-syntax () + ;; FIXME: Document. + (setq *readtable* (copy-readtable *readtable*)) + (push (get-dispatch-macro-character #\# #\/) *method-syntax-macro-chars*) + (set-dispatch-macro-character #\# #\/ #'(lambda (stream char arg) + (declare (ignore char arg)) + (read-objective-c-method stream))) + (values)) + + (defun enable-method-syntax () "Install a **reader macro** that makes method calls look nicer. @@ -76,10 +86,7 @@ __selector__s registered by way of __collect-methods__. __enable-objective-c-syntax__" (save-readtable) - (push (get-dispatch-macro-character #\# #\/) *method-syntax-macro-chars*) - (set-dispatch-macro-character #\# #\/ #'(lambda (stream char arg) - (declare (ignore char arg)) - (read-objective-c-method stream))) + (in-method-syntax) (values)) diff --git a/NEWS b/NEWS index a2cdf94..1df91e8 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,14 @@ Context: [[http://matthias.benkard.de/objective-cl][The Objective-CL Project]]. ---- +* 0.2.3 (?) + + - The function IN-METHOD-SYNTAX has been added. It's like + ENABLE-METHOD-SYNTAX except that it does not store the original + syntax to be restored by DISABLE-METHOD-SYNTAX later. Use this for + file-local readtable changes (as opposed to code-block-local ones). + + * 0.2.2 (2008-03-23) - CMUCL compatibility has been restored. -- cgit v1.2.3