diff options
| author | Ravi R Kiran <aine.marina@gmail.com> | 2017-08-08 11:49:06 (GMT) |
|---|---|---|
| committer | Ravi R Kiran <aine.marina@gmail.com> | 2017-08-08 11:49:06 (GMT) |
| commit | ce4936ffed85df032056a030c00d741ef4c6045b (patch) | |
| tree | 281aa27f91723c354564106578565358bb98f641 /lisp | |
| parent | 35a76cadc70194c722c03ba729bb74392168f532 (diff) | |
| download | dotemacs-ce4936ffed85df032056a030c00d741ef4c6045b.zip dotemacs-ce4936ffed85df032056a030c00d741ef4c6045b.tar.gz dotemacs-ce4936ffed85df032056a030c00d741ef4c6045b.tar.bz2 | |
Closing delimiter works with new emacs again
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ravi-init-cpp.el | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/lisp/ravi-init-cpp.el b/lisp/ravi-init-cpp.el index 7e69bec..4ebdd84 100644 --- a/lisp/ravi-init-cpp.el +++ b/lisp/ravi-init-cpp.el @@ -449,17 +449,10 @@ this to 3 makes header-protection define KIG_MISC_NEWTYPE_H for a file named (defadvice c-electric-brace (after ravi/do-not-activate-region activate) (deactivate-mark)) - (defmacro ravi/fake-send-key (key-to-bind char-to-bind) - (let ((command (key-binding key-to-bind))) - (setq last-command-event char-to-bind) - (setq this-command command) - (call-interactively command)) - ) - - (defun ravi/insert-closing-delimiter() - (interactive) + (defun ravi/insert-closing-delimiter(arg) + (interactive "p") (if (c-in-literal) - (self-insert-command) + (self-insert-command arg) (progn ;; Find nearest unmatched opening delimiter (let (brace-type) @@ -472,10 +465,10 @@ this to 3 makes header-protection define KIG_MISC_NEWTYPE_H for a file named (t (setq brace-type 'brace-type-none)) )) (cond - ((eq brace-type 'brace-type-brace) (ravi/fake-send-key "}" ?\})) - ((eq brace-type 'brace-type-paren) (ravi/fake-send-key ")" ?\))) + ((eq brace-type 'brace-type-brace) (setq unread-command-events (listify-key-sequence "}"))) + ((eq brace-type 'brace-type-paren) (setq unread-command-events (listify-key-sequence ")"))) ; Uncommenting the line below would lead to infinite recursion - ;((eq 'brace-type 'brace-type-square) (ravi/fake-send-key "]" ?\])) + ;((eq 'brace-type 'brace-type-square) (setq unread-command-events (listify-key-sequence "]"))) (t (self-insert-command 1)) ) )))) |
