【问题标题】:Emacsclient does not respond to mouse clicksEmacsclient 不响应鼠标点击
【发布时间】:2011-06-24 00:40:33
【问题描述】:

当我运行 emacsclient 时,它不会响应鼠标点击。我的主要 Emacs 进程在终端中运行并正确响应鼠标点击,因为我的 Emacs 配置文件中有以下代码:

(xterm-mouse-mode 1)

为什么 emacsclient 不响应鼠标点击?有没有办法让它这样做?

【问题讨论】:

    标签: emacs mouseevent gnu-screen xterm emacsclient


    【解决方案1】:

    这可能是因为 Emacs 中的某些设置特定于 终端,并且在您的 init 文件中操作此类设置只会影响在评估 init 文件时处于活动状态的终端。

    下面的 Q+A 处理了大致相同的问题,并详细说明:

    Run command on new frame with daemon/client in Emacs

    对于您的问题,我认为这应该可以解决问题:

    (defun my-terminal-config (&optional frame)
      "Establish settings for the current terminal."
      (if (not frame) ;; The initial call.
          (xterm-mouse-mode 1)
        ;; Otherwise called via after-make-frame-functions.
        (if xterm-mouse-mode
            ;; Re-initialise the mode in case of a new terminal.
            (xterm-mouse-mode 1))))
    ;; Evaluate both now (for non-daemon emacs) and upon frame creation
    ;; (for new terminals via emacsclient).
    (my-terminal-config)
    (add-hook 'after-make-frame-functions 'my-terminal-config)
    

    【讨论】:

    • 太棒了!我实际上只在 GNU Screen 会话中遇到过这个问题,但这解决了它。
    • 很高兴听到。我刚刚意识到xterm-mouse-mode 是一种全局次要模式,我的代码存在缺陷,如果您故意禁用该模式,然后创建一个新框架,它将再次打开。我已经相应地编辑了代码。我认为该模式足够智能,不需要我最初包含的window-system 检查(无论如何这不足以识别 xterm)。
    • 只是想提一下,这可能会导致错误 #28800 与 rxvt。
    • @AndreaRichiardi,你说的“这个”是什么意思?使用xterm-mouse-mode?在after-make-frame-functions 中使用它?还有什么?
    • 抱歉耽搁了,但基本上after-make-frame-functions 中的调用运行良好。 (my-terminal-config) 调用可能会触发该错误。将其注释掉即可解决。另请注意,这只是 emacsclient -nw 错误。
    猜你喜欢
    • 2015-02-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-10-03
    • 2022-01-15
    • 2011-08-14
    相关资源
    最近更新 更多