comparison lisp/edebug/cl-read.el @ 72:b9518feda344 r20-0b31

Import from CVS: tag r20-0b31
author cvs
date Mon, 13 Aug 2007 09:03:46 +0200
parents 131b0175ea99
children 360340f9fd5f
comparison
equal deleted inserted replaced
71:bae944334fa4 72:b9518feda344
1 ;; Customizable, Common Lisp like reader for Emacs Lisp. 1 ;; Customizable, Common Lisp like reader for Emacs Lisp.
2 ;; 2 ;;
3 ;; Copyright (C) 1993 by Guido Bosch <Guido.Bosch@loria.fr> 3 ;; Copyright (C) 1993 by Guido Bosch <Guido.Bosch@loria.fr>
4 4
5 ;; This file is written in GNU Emacs Lisp, but not (yet) part of GNU Emacs. 5 ;; This file is part of XEmacs
6 6
7 ;; The software contained in this file is free software; you can 7 ;; XEmacs is free software; you can redistribute it and/or modify it
8 ;; redistribute it and/or modify it under the terms of the GNU General 8 ;; under the terms of the GNU General Public License as published by
9 ;; Public License as published by the Free Software Foundation; either 9 ;; the Free Software Foundation; either version 2, or (at your option)
10 ;; version 2, or (at your option) any later version. 10 ;; any later version.
11 11
12 ;; GNU Emacs is distributed in the hope that it will be useful, 12 ;; XEmacs is distributed in the hope that it will be useful, but
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 13 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 ;; GNU General Public License for more details. 15 ;; General Public License for more details.
16 16
17 ;; You should have received a copy of the GNU General Public License 17 ;; You should have received a copy of the GNU General Public License
18 18 ;; along with XEmacs; see the file COPYING. If not, write to the Free
19 ;; along with GNU Emacs; see the file COPYING. If not, write to 19 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 20 ;; 02111-1307, USA.
21 ;; 21
22 ;;; Synched up with: Not in FSF
23
24 ;;; Commentary:
25
22 ;; Please send bugs and comments to the author. 26 ;; Please send bugs and comments to the author.
23 ;; 27 ;;
24 ;; <DISCLAIMER> 28 ;; <DISCLAIMER>
25 ;; This program is still under development. Neither the author nor 29 ;; This program is still under development. Neither the author nor
26 ;; his employer accepts responsibility to anyone for the consequences of 30 ;; his employer accepts responsibility to anyone for the consequences of
202 206
203 207
204 ; Change History 208 ; Change History
205 ; 209 ;
206 ; $Log: cl-read.el,v $ 210 ; $Log: cl-read.el,v $
207 ; Revision 1.1.1.1 1996/12/18 22:43:07 steve 211 ; Revision 1.1.1.2 1996/12/18 22:51:45 steve
208 ; XEmacs 20.0 -- Beta 30 212 ; XEmacs 20.0 -- Beta 31
209 ; 213 ;
210 ; Revision 1.19 94/03/21 19:59:24 liberte 214 ; Revision 1.19 94/03/21 19:59:24 liberte
211 ; Add invalid-cl-read-syntax error symbol. 215 ; Add invalid-cl-read-syntax error symbol.
212 ; Add reader::read-sexp and reader::read-sexp-func to allow customization 216 ; Add reader::read-sexp and reader::read-sexp-func to allow customization
213 ; based on the results of reading. 217 ; based on the results of reading.
300 ; Revision 1.1 1993/03/29 19:37:21 bosch 304 ; Revision 1.1 1993/03/29 19:37:21 bosch
301 ; Initial revision 305 ; Initial revision
302 ; 306 ;
303 ; 307 ;
304 308
305 ;; 309 ;;; Code:
310
306 (require 'cl) 311 (require 'cl)
307 312 ;; Thou shalt evaluate a defadvice only once, or thou shalt surely lose. -sb
313 (require 'advise-eval-region)
314
315 ;; load before compiling
316 ;; This is ugly, but apparently the only way to do it :-( -sb
308 (provide 'cl-read) 317 (provide 'cl-read)
309 ;; load before compiling
310 (require 'cl-read) 318 (require 'cl-read)
311 319
312 ;; bootstrapping with cl-packages 320 ;; bootstrapping with cl-packages
313 ;; defpackage and in-package are ignored until cl-read is installed. 321 ;; defpackage and in-package are ignored until cl-read is installed.
314 '(defpackage reader 322 '(defpackage reader
1313 ))))) 1321 )))))
1314 (setq values (cons (eval reader::expression) values)) 1322 (setq values (cons (eval reader::expression) values))
1315 (prin1 (car values) t)) 1323 (prin1 (car values) t))
1316 1324
1317 (require 'eval-reg "eval-reg") 1325 (require 'eval-reg "eval-reg")
1318 (require 'advice) 1326 ; (require 'advice)
1319 1327
1320 1328
1321 ;; installing/uninstalling the cl reader 1329 ;; installing/uninstalling the cl reader
1322 ;; These two should always be used in pairs, or just install once and 1330 ;; These two should always be used in pairs, or just install once and
1323 ;; never uninstall. 1331 ;; never uninstall.
1342 ;; for buffers without cl read syntax. The buffer local variable 1350 ;; for buffers without cl read syntax. The buffer local variable
1343 ;; `cl-read-active' controls whether the replacement funtions of this 1351 ;; `cl-read-active' controls whether the replacement funtions of this
1344 ;; package or the original ones are actually called. 1352 ;; package or the original ones are actually called.
1345 (cl-reader-install) 1353 (cl-reader-install)
1346 (cl-reader-uninstall) 1354 (cl-reader-uninstall)
1347
1348 ;; Advise the redefined eval-region
1349 (defadvice eval-region (around cl-read activate)
1350 "Use the reader::read instead of the original read if cl-read-active."
1351 (with-elisp-eval-region (not cl-read-active)
1352 (ad-do-it)))
1353 ;;(ad-unadvise 'eval-region)
1354
1355 1355
1356 (add-hook 'emacs-lisp-mode-hook 'cl-reader-autoinstall-function) 1356 (add-hook 'emacs-lisp-mode-hook 'cl-reader-autoinstall-function)
1357 1357
1358 '(defvar read-syntax) 1358 '(defvar read-syntax)
1359 1359
1395 (make-local-variable 'cl-read-active) 1395 (make-local-variable 'cl-read-active)
1396 (setq cl-read-active t)))))) 1396 (setq cl-read-active t))))))
1397 1397
1398 1398
1399 (run-hooks 'cl-read-load-hooks) 1399 (run-hooks 'cl-read-load-hooks)
1400 ;; end cl-read.el 1400
1401 ;; cl-read.el ends here