comparison lisp/cedet/semantic/lex-spp.el @ 110534:826d60163924

Merge changes from emacs-23 branch.
author Chong Yidong <cyd@stupidchicken.com>
date Thu, 23 Sep 2010 22:10:54 -0400
parents a5ad4f188e19
children 9814473572d4
comparison
equal deleted inserted replaced
110517:64945cefe6a6 110534:826d60163924
862 semantic-lex-spp-dynamic-macro-symbol-obarray 862 semantic-lex-spp-dynamic-macro-symbol-obarray
863 semantic-lex-spp-dynamic-macro-symbol-obarray-stack 863 semantic-lex-spp-dynamic-macro-symbol-obarray-stack
864 semantic-lex-spp-expanded-macro-stack 864 semantic-lex-spp-expanded-macro-stack
865 )) 865 ))
866 ) 866 )
867 (with-current-buffer buf 867 (if (> semantic-lex-spp-hack-depth 5)
868 (erase-buffer) 868 nil
869 ;; Below is a painful hack to make sure everything is setup correctly. 869 (with-current-buffer buf
870 (when (not (eq major-mode mode)) 870 (erase-buffer)
871 (save-match-data 871 ;; Below is a painful hack to make sure everything is setup correctly.
872 872 (when (not (eq major-mode mode))
873 ;; Protect against user-hooks that throw errors. 873 (save-match-data
874 (condition-case nil 874
875 (funcall mode) 875 ;; Protect against user-hooks that throw errors.
876 (error nil)) 876 (condition-case nil
877 877 (funcall mode)
878 ;; Hack in mode-local 878 (error nil))
879 (activate-mode-local-bindings) 879
880 ;; CHEATER! The following 3 lines are from 880 ;; Hack in mode-local
881 ;; `semantic-new-buffer-fcn', but we don't want to turn 881 (activate-mode-local-bindings)
882 ;; on all the other annoying modes for this little task. 882
883 (setq semantic-new-buffer-fcn-was-run t) 883 ;; CHEATER! The following 3 lines are from
884 (semantic-lex-init) 884 ;; `semantic-new-buffer-fcn', but we don't want to turn
885 (semantic-clear-toplevel-cache) 885 ;; on all the other annoying modes for this little task.
886 (remove-hook 'semantic-lex-reset-hooks 'semantic-lex-spp-reset-hook 886 (setq semantic-new-buffer-fcn-was-run t)
887 t) 887 (semantic-lex-init)
888 )) 888 (semantic-clear-toplevel-cache)
889 889 (remove-hook 'semantic-lex-reset-hooks 'semantic-lex-spp-reset-hook
890 ;; Second Cheat: copy key variables regarding macro state from the 890 t)
891 ;; the originating buffer we are parsing. We need to do this every time 891 ))
892 ;; since the state changes. 892
893 (dolist (V important-vars) 893 ;; Second Cheat: copy key variables regarding macro state from the
894 (set V (semantic-buffer-local-value V origbuff))) 894 ;; the originating buffer we are parsing. We need to do this every time
895 (insert text) 895 ;; since the state changes.
896 (goto-char (point-min)) 896 (dolist (V important-vars)
897 897 (set V (semantic-buffer-local-value V origbuff)))
898 (setq fresh-toks (semantic-lex-spp-stream-for-macro (point-max)))) 898 (insert text)
899 899 (goto-char (point-min))
900 (dolist (tok fresh-toks) 900
901 (when (memq (semantic-lex-token-class tok) '(symbol semantic-list)) 901 (setq fresh-toks (semantic-lex-spp-stream-for-macro (point-max))))
902 (setq toks (cons tok toks)))) 902
903 (dolist (tok fresh-toks)
904 (when (memq (semantic-lex-token-class tok) '(symbol semantic-list))
905 (setq toks (cons tok toks)))))
903 906
904 (nreverse toks))) 907 (nreverse toks)))
905 908
906 ;;;; FIRST DRAFT 909 ;;;; FIRST DRAFT
907 ;; This is the fist version of semantic-lex-spp-stream-for-arglist 910 ;; This is the fist version of semantic-lex-spp-stream-for-arglist