【发布时间】:2010-01-20 03:20:58
【问题描述】:
是否有内置或 3rd 方 elisp 命令可以在 cc 模式下移动到匹配的大括号?
我目前使用(paren-set-mode 'paren t) 让XEmacs 突出显示匹配的大括号或括号,但是当大括号在带有嵌套if 块的一段代码中不在屏幕上时,有一个跳转命令会非常有用到匹配的大括号。
类似于M-C-f 和M-C-b 的东西,但用于{} 而不是()。
【问题讨论】:
是否有内置或 3rd 方 elisp 命令可以在 cc 模式下移动到匹配的大括号?
我目前使用(paren-set-mode 'paren t) 让XEmacs 突出显示匹配的大括号或括号,但是当大括号在带有嵌套if 块的一段代码中不在屏幕上时,有一个跳转命令会非常有用到匹配的大括号。
类似于M-C-f 和M-C-b 的东西,但用于{} 而不是()。
【问题讨论】:
C-M-f 和 C-M-b 也应该适用于 { 和 }。
【讨论】:
C-M-f 时,它会跳转到下一个 ) 而不是当前块的右大括号。
C-M-f 的左大括号上加上一个字符,在C-M-b 的右大括号后面加一个字符。
我在 XEmacs 21.5 中安装了 big-menubar.el。 它添加了一个菜单项“Motion”,在该菜单中有以下两个命令及其键绑定:
平衡括号 C-M-n 结束
平衡括号 C-M-p 的开头
我认为它们是 Control-Meta-next 和 previous。
他们还有一些您可能感兴趣的其他移动命令, 这是来自 big-menubar.el 的剪切和粘贴,显示了它们正在执行的命令(一旦您知道命令是什么,您就可以将其分配给您喜欢的任何键......):
(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]))
【讨论】: