comparison lisp/emacs-lisp/edebug.el @ 109412:9557b86a556a

Merge from mainline.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Sun, 20 Jun 2010 22:46:22 +0000
parents bd9d982851e0
children cc035ccb9275
comparison
equal deleted inserted replaced
109411:d654ebf81f14 109412:9557b86a556a
883 (forward-char 1) 883 (forward-char 1)
884 (list 884 (list
885 (edebug-storing-offsets (1- (point)) 'quote) 885 (edebug-storing-offsets (1- (point)) 'quote)
886 (edebug-read-storing-offsets stream))) 886 (edebug-read-storing-offsets stream)))
887 887
888 (defvar edebug-read-backquote-level 0
889 "If non-zero, we're in a new-style backquote.
890 It should never be negative. This controls how we read comma constructs.")
891
892 (defun edebug-read-backquote (stream) 888 (defun edebug-read-backquote (stream)
893 ;; Turn `thing into (\` thing) 889 ;; Turn `thing into (\` thing)
894 (forward-char 1) 890 (forward-char 1)
895 (list 891 (list
896 (edebug-storing-offsets (1- (point)) '\`) 892 (edebug-storing-offsets (1- (point)) '\`)
897 (let ((edebug-read-backquote-level (1+ edebug-read-backquote-level))) 893 (edebug-read-storing-offsets stream)))
898 (edebug-read-storing-offsets stream))))
899 894
900 (defun edebug-read-comma (stream) 895 (defun edebug-read-comma (stream)
901 ;; Turn ,thing into (\, thing). Handle ,@ and ,. also. 896 ;; Turn ,thing into (\, thing). Handle ,@ and ,. also.
902 (let ((opoint (point))) 897 (let ((opoint (point)))
903 (forward-char 1) 898 (forward-char 1)
908 ((eq (following-char) ?\@) 903 ((eq (following-char) ?\@)
909 (setq symbol '\,@) 904 (setq symbol '\,@)
910 (forward-char 1))) 905 (forward-char 1)))
911 ;; Generate the same structure of offsets we would have 906 ;; Generate the same structure of offsets we would have
912 ;; if the resulting list appeared verbatim in the input text. 907 ;; if the resulting list appeared verbatim in the input text.
913 (if (zerop edebug-read-backquote-level) 908 (list
914 (edebug-storing-offsets opoint symbol) 909 (edebug-storing-offsets opoint symbol)
915 (list 910 (edebug-read-storing-offsets stream)))))
916 (edebug-storing-offsets opoint symbol)
917 (let ((edebug-read-backquote-level (1- edebug-read-backquote-level)))
918 (edebug-read-storing-offsets stream)))))))
919 911
920 (defun edebug-read-function (stream) 912 (defun edebug-read-function (stream)
921 ;; Turn #'thing into (function thing) 913 ;; Turn #'thing into (function thing)
922 (forward-char 1) 914 (forward-char 1)
923 (cond ((eq ?\' (following-char)) 915 (cond ((eq ?\' (following-char))
935 (defun edebug-read-list (stream) 927 (defun edebug-read-list (stream)
936 (forward-char 1) ; skip \( 928 (forward-char 1) ; skip \(
937 (prog1 929 (prog1
938 (let ((elements)) 930 (let ((elements))
939 (while (not (memq (edebug-next-token-class) '(rparen dot))) 931 (while (not (memq (edebug-next-token-class) '(rparen dot)))
940 (if (and (eq (edebug-next-token-class) 'backquote) 932 (push (edebug-read-storing-offsets stream) elements))
941 (null elements)
942 (zerop edebug-read-backquote-level))
943 (progn
944 ;; Old style backquote.
945 (forward-char 1) ; Skip backquote.
946 ;; Call edebug-storing-offsets here so that we
947 ;; produce the same offsets we would have had
948 ;; if the backquote were an ordinary symbol.
949 (push (edebug-storing-offsets (1- (point)) '\`) elements))
950 (push (edebug-read-storing-offsets stream) elements)))
951 (setq elements (nreverse elements)) 933 (setq elements (nreverse elements))
952 (if (eq 'dot (edebug-next-token-class)) 934 (if (eq 'dot (edebug-next-token-class))
953 (let (dotted-form) 935 (let (dotted-form)
954 (forward-char 1) ; skip \. 936 (forward-char 1) ; skip \.
955 (setq dotted-form (edebug-read-storing-offsets stream)) 937 (setq dotted-form (edebug-read-storing-offsets stream))
4453 (function (lambda () (require 'cl-specs)))) 4435 (function (lambda () (require 'cl-specs))))
4454 ;; The following causes cl-specs to be loaded if you load cl.el. 4436 ;; The following causes cl-specs to be loaded if you load cl.el.
4455 (add-hook 'cl-load-hook 4437 (add-hook 'cl-load-hook
4456 (function (lambda () (require 'cl-specs))))) 4438 (function (lambda () (require 'cl-specs)))))
4457 4439
4458 ;;; edebug-cl-read and cl-read are available from liberte@cs.uiuc.edu 4440 ;; edebug-cl-read and cl-read are available from liberte@cs.uiuc.edu
4459 (if (featurep 'cl-read) 4441 (if (featurep 'cl-read)
4460 (add-hook 'edebug-setup-hook 4442 (add-hook 'edebug-setup-hook
4461 (function (lambda () (require 'edebug-cl-read)))) 4443 (function (lambda () (require 'edebug-cl-read))))
4462 ;; The following causes edebug-cl-read to be loaded when you load cl-read.el. 4444 ;; The following causes edebug-cl-read to be loaded when you load cl-read.el.
4463 (add-hook 'cl-read-load-hooks 4445 (add-hook 'cl-read-load-hooks
4464 (function (lambda () (require 'edebug-cl-read))))) 4446 (function (lambda () (require 'edebug-cl-read)))))
4465 4447
4466 4448
4467 ;;; Finalize Loading 4449 ;;; Finalize Loading
4468 4450
4469 ;;; Finally, hook edebug into the rest of Emacs. 4451 ;; Finally, hook edebug into the rest of Emacs.
4470 ;;; There are probably some other things that could go here. 4452 ;; There are probably some other things that could go here.
4471 4453
4472 ;; Install edebug read and eval functions. 4454 ;; Install edebug read and eval functions.
4473 (edebug-install-read-eval-functions) 4455 (edebug-install-read-eval-functions)
4474 4456
4475 (provide 'edebug) 4457 (provide 'edebug)