Emacs 热键对齐等号 [英] Emacs hotkey to align equal signs
本文介绍了Emacs 热键对齐等号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在我的 .emacs 中加入这样的内容:
I'd like to put something like this in my .emacs:
(local-set-key (kbd "C-c a =")
(lambda () (interactive)
(align-regexp (region-beginning) (region-end) "=")))
但是每当我运行它时,我都会收到错误消息错误的类型参数:numberp,nil".
But whenever I run it, I get an error "Wrong type argument: numberp, nil".
这个错误是什么意思,我如何获得我想要的效果?
What does this error mean and how do I get the effect I'm looking for?
推荐答案
这里是我亲爱的伙伴.
(defun align-to-equals (begin end)
"Align region to equal signs"
(interactive "r")
(align-regexp begin end "\(\s-*\)=" 1 1 ))
(s-*)
前缀由 align-regexp 内部使用
The (s-*)
prefix is used internally by align-regexp
来自 align.el
(list (concat "\(\s-*\)"
John Wiegley 只是忽略了记录它,我想大多数人只是交互地使用 align-regexp,或者只是记录并保存一个宏!
John Wiegley just neglected to document it, and I guess most people just use align-regexp interactively, or just record and save a macro!
这篇关于Emacs 热键对齐等号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文