有没有什么方法可以在emacs中标记文本并按空格/制表符粒度向左移动(删除起始空格)?
我会用Shift + Tab在其他编辑器上做同样的事情.
我使用ViewSourceWith 和Emacs 编辑StackOverflow的答案和问题.通常,我包含代码和StackOverflow格式规则 ,说它必须缩进四个空格才能被识别.手动或甚至使用宏来做这件事都很痛苦.
我在之前的帖子中搜索过,但一无所获.
从Python模式开始,我写道:
(defun text-shift-region (start end count)
"Indent lines from START to END by COUNT spaces."
(save-excursion
(goto-char end)
(beginning-of-line)
(setq end (point))
(goto-char start)
(beginning-of-line)
(setq start (point))
(indent-rigidly start end count)))
(defun text-shift-region-right (start end &optional count)
"Shift region of code to the right
Stolen from python-mode.
The lines from the line containing the start of the current region up
to (but not including) the line containing the end of the region …Run Code Online (Sandbox Code Playgroud)