monkey patching a cc-mode function (c-neutralize-syntax-in-CPP) to avoid error.

This commit is contained in:
Zhang Chiyuan 2008-03-07 13:38:50 +00:00
parent d578654269
commit 76ef5b9ae7

View File

@ -778,3 +778,18 @@ the menu if `yas/use-menu' is `t'."
(delete-overlay (yas/field-overlay field)))))
(provide 'yasnippet)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Monkey patching for other functions that's causing
;; problems to yasnippet. For details on why I patch
;; those functions, refer to
;; http://code.google.com/p/yasnippet/wiki/MonkeyPatching
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defadvice c-neutralize-syntax-in-CPP
(around yas-mp/c-neutralize-syntax-in-CPP activate)
"Adviced `c-neutralize-syntax-in-CPP' to properly
handle the end-of-buffer error fired in it by calling
`forward-char' at the end of buffer."
(condition-case err
ad-do-it
(error (message (error-message-string err)))))