【问题标题】:How to automatically jump into the *compilation* buffer after the compilation ending in emacs?编译以emacs结束后如何自动跳转到*编译*缓冲区?
【发布时间】:2020-06-17 14:46:57
【问题描述】:

Emacs 有一个编译命令,它打开一个所谓的 *compilation* 缓冲区,显示编译结果。 我想将 emacs 配置为在编译结束后自动跳转到此缓冲区(无论是否有警告或错误)。

这样做的目的是,如果没有错误,并且我想继续编码,关闭 *compilation* 缓冲区需要跳转到它 (C-x o) 并关闭它 (q) 或关闭其他窗口(C-x 1) 在键盘上敲击 3 或 4 次。如果自动选择*编译*缓冲区,则只需要一个(q)(或者我可以使用RET 转到错误)。

我看到了其他相关的帖子,但没有人专门解决这个问题。

【问题讨论】:

    标签: emacs compilation


    【解决方案1】:

    将此添加到您的初始化文件中:~/.emacs(或~/.emacs.d/init.el

    (add-hook 'compilation-finish-functions 'switch-to-buffer-other-window 'compilation)

    add-hookcompilation-finish 之后添加函数调用。该函数显式为switch-to-buffer-other-window,并采用参数compilation,即*编译*缓冲区的名称。

    【讨论】:

      猜你喜欢
      • 2012-06-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-31
      相关资源
      最近更新 更多