From 76ef5b9ae7e59424d97a16e7675f671313a707bd Mon Sep 17 00:00:00 2001 From: Zhang Chiyuan Date: Fri, 7 Mar 2008 13:38:50 +0000 Subject: [PATCH] monkey patching a cc-mode function (c-neutralize-syntax-in-CPP) to avoid error. --- yasnippet.el | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/yasnippet.el b/yasnippet.el index 8613259..9cd9a52 100644 --- a/yasnippet.el +++ b/yasnippet.el @@ -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)))))