summaryrefslogtreecommitdiff
path: root/lisp/cedet/semantic/lex-spp.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/cedet/semantic/lex-spp.el')
-rw-r--r--lisp/cedet/semantic/lex-spp.el69
1 files changed, 36 insertions, 33 deletions
diff --git a/lisp/cedet/semantic/lex-spp.el b/lisp/cedet/semantic/lex-spp.el
index 58ad681008c..88b77e50e1d 100644
--- a/lisp/cedet/semantic/lex-spp.el
+++ b/lisp/cedet/semantic/lex-spp.el
@@ -864,42 +864,45 @@ and variable state from the current buffer."
semantic-lex-spp-expanded-macro-stack
))
)
- (with-current-buffer buf
- (erase-buffer)
- ;; Below is a painful hack to make sure everything is setup correctly.
- (when (not (eq major-mode mode))
- (save-match-data
-
- ;; Protect against user-hooks that throw errors.
- (condition-case nil
- (funcall mode)
- (error nil))
-
- ;; Hack in mode-local
- (activate-mode-local-bindings)
- ;; CHEATER! The following 3 lines are from
- ;; `semantic-new-buffer-fcn', but we don't want to turn
- ;; on all the other annoying modes for this little task.
- (setq semantic-new-buffer-fcn-was-run t)
- (semantic-lex-init)
- (semantic-clear-toplevel-cache)
- (remove-hook 'semantic-lex-reset-hooks 'semantic-lex-spp-reset-hook
- t)
- ))
+ (if (> semantic-lex-spp-hack-depth 5)
+ nil
+ (with-current-buffer buf
+ (erase-buffer)
+ ;; Below is a painful hack to make sure everything is setup correctly.
+ (when (not (eq major-mode mode))
+ (save-match-data
+
+ ;; Protect against user-hooks that throw errors.
+ (condition-case nil
+ (funcall mode)
+ (error nil))
+
+ ;; Hack in mode-local
+ (activate-mode-local-bindings)
+
+ ;; CHEATER! The following 3 lines are from
+ ;; `semantic-new-buffer-fcn', but we don't want to turn
+ ;; on all the other annoying modes for this little task.
+ (setq semantic-new-buffer-fcn-was-run t)
+ (semantic-lex-init)
+ (semantic-clear-toplevel-cache)
+ (remove-hook 'semantic-lex-reset-hooks 'semantic-lex-spp-reset-hook
+ t)
+ ))
- ;; Second Cheat: copy key variables regarding macro state from the
- ;; the originating buffer we are parsing. We need to do this every time
- ;; since the state changes.
- (dolist (V important-vars)
- (set V (semantic-buffer-local-value V origbuff)))
- (insert text)
- (goto-char (point-min))
+ ;; Second Cheat: copy key variables regarding macro state from the
+ ;; the originating buffer we are parsing. We need to do this every time
+ ;; since the state changes.
+ (dolist (V important-vars)
+ (set V (semantic-buffer-local-value V origbuff)))
+ (insert text)
+ (goto-char (point-min))
- (setq fresh-toks (semantic-lex-spp-stream-for-macro (point-max))))
+ (setq fresh-toks (semantic-lex-spp-stream-for-macro (point-max))))
- (dolist (tok fresh-toks)
- (when (memq (semantic-lex-token-class tok) '(symbol semantic-list))
- (setq toks (cons tok toks))))
+ (dolist (tok fresh-toks)
+ (when (memq (semantic-lex-token-class tok) '(symbol semantic-list))
+ (setq toks (cons tok toks)))))
(nreverse toks)))