开发者

XEmacs command for moving to matching brace in cc-mode

Is there a built-in or 3rd party elisp command to mov开发者_运维百科e to the matching brace in cc-mode?

I currently use (paren-set-mode 'paren t) to have XEmacs highlight the matching brace or paren, but when the brace is off the screen in a piece of code with nested if blocks, it would be very useful to have a command to jump to the matching brace.

Something similar to M-C-f and M-C-b but for {} rather than ().


C-M-f and C-M-b should work for { and } as well.


I have the big-menubar.el installed in XEmacs 21.5. It adds a menu item "Motion", and in that menu has the following two commands with their keybindings shown:

End of balanced Parenthesis C-M-n

Beginning of balanced Parenthesis C-M-p

I think of them as Control-Meta-next and previous.

They also have some other move-to commands that might interest you, here's a cut and paste from big-menubar.el showing the commands they are executing (which you can assign to any keys you like once you know what the commands are...):

(add-submenu
 nil
 '("Motion"
   ["Goto Mark"                  exchange-point-and-mark (mark t)]
   ["Goto Line..."                          goto-line           t]
   "---"
   ["End of Balanced Parentheses ( )"       forward-list        t]
   ["Beginning of Balanced Parentheses ( )" backward-list       t]
   ["Next Opening Parenthesis ("            down-list           t]
   ["Previous Opening Parenthesis ("        backward-up-list    t]
   ["Next Closing Parenthesis )"            up-list             t]
   "---"
   ["End of Balanced Expression"            forward-sexp        t]
   ["Beginning of Balanced Expression"      backward-sexp       t]
   "---"
   ["End of Function"                       end-of-defun        t]
   ["Beginning of Function"                 beginning-of-defun  t]
   "---"
   ["Next Page"                             forward-page        t]
   ["Previous Page"                         backward-page       t]
   "---"
   ["End of Buffer"                         end-of-buffer       t]
   ["Beginning of Buffer"                   beginning-of-buffer t]
   "---"
   ["Save Current Position..."              point-to-register   t]
   ["Goto Saved Position..."                register-to-point   t]
   "---"
   ["Set Marker..."                         set-user-marker     t]
   ["Goto Marker..."                        goto-user-marker    t]
   ["List Markers"                          list-markers        t]
   "---"
   ["Set Goal Column"                       set-goal-column     t]
   ["Cancel Goal Column"          (set-goal-column t) goal-column]))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜