删除Emacs中的空白块

Ale*_*sky 4 emacs

我经常最终得到这样的代码块:

public class CustomFile {

    public String path;
    public String name;





    public CustomFile (String pathToFile, String dbName) {
    path = pathToFile;
    name = dbName;
    }
}
Run Code Online (Sandbox Code Playgroud)

我希望能够将光标放在上面的行上,public CustomFile并能够删除所有空格,但不包括public String name;.是否有允许我这样做的命令或宏?

dfa*_*fan 10

这看起来像你想要的:

C-x C-o runs the command delete-blank-lines, which is an interactive
compiled Lisp function in `simple.el'.

It is bound to C-x C-o.

(delete-blank-lines)

On blank line, delete all surrounding blank lines, leaving just one.
On isolated blank line, delete that one.
On nonblank line, delete any immediately following blank lines.
Run Code Online (Sandbox Code Playgroud)