[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: inserting code based on syntactic information in cc-mode
From: |
SameerDS |
Subject: |
Re: inserting code based on syntactic information in cc-mode |
Date: |
Fri, 11 Dec 2009 19:14:39 -0800 (PST) |
User-agent: |
G2/1.0 |
harven, that explains it. I don't have the lisp sources installed!
Thanks!
Alan, from the lisp snippet posted earlier it seems the evaluation of
`c-guess-basic-syntax' is usually stored in the variable `c-syntactic-
context', _if_ it is currently bound. This might have been done for
performance reasons, and perhaps because the side-effects are
important here. Repeating the "probably correct" way of using this,
that was posted earlier on this thread. This is basically a guess
based on how other functions in cc-mode do it ... which is why I was
trying to reach the source for cc-mode.
(defun get-syntax ()
(let ((c-parsing-error nil))
(if (boundp 'c-syntactic-context)
;; Use `c-syntactic-context' in the same way as
;; `c-indent-line', to be consistent.
c-syntactic-context
(c-save-buffer-state nil
(c-guess-basic-syntax)))))
BTW, yasnippets rocks! :)
--
Sameer.
http://sameer.sbuddhe.net/