如何在 Windows 10 Bash 上使用带有 Emacs 的 X Windows? [英] How to use X Windows with Emacs on Windows 10 Bash?

查看:25
本文介绍了如何在 Windows 10 Bash 上使用带有 Emacs 的 X Windows?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Windows 程序上的 Ubuntu 上使用 Bash 来将 Emacs 用于 C++.现在,我可以使用键盘快捷键对所有内容进行编码,但是,我想用鼠标选择文本或用鼠标设置标记,而不必总是使用键盘.

I am using the Bash on Ubuntu on Windows program to use Emacs for C++. Right now, I can code everything using the keyboard shortcuts, however, I want to select text with my mouse or set the mark with my mouse instead of always having to use my keyboard.

为了获得 X Windows 系统,我已经执行了 sudo apt-get install xserver -xorg 但 emacs 仍然在终端编辑器中运行.

To get the X Windows System, I already did sudo apt-get install xserver -xorg but emacs still runs in a terminal editor.

我不知道要使用哪些其他命令,也不知道如何让 X Windows 开始运行.

I don't know what other commands to use or how to get X Windows to start running.

推荐答案

Windows bash 不支持 X Server.但是,将 Windows X Server 端口(例如 MobaXTerm、XMing 或 vcXsrv)与 Windows bash 结合使用是可行的.有些东西是开箱即用的(gvim 做到了),emacs 需要更多的努力.

Windows bash does not support X Server. However, using a Windows X Server port such as MobaXTerm, XMing or vcXsrv in conjunction with Windows bash works. Some things work out of the box (gvim did,) emacs requires more effort.

这是我让它工作的方式:

Here's how I've made it work:

  • 安装 MobaXterm.很可能你也可以让它与 XMing 一起工作,但我只用 MobaXterm 测试过.更新: 使用 vcXsrvXMing(付费版.)工作原理基本相同,我可能会坚持使用 MobaXTerm.

  • Install MobaXterm. Most probably you can make it work with XMing as well, but I have tested only with MobaXterm. Update: Tested with vcXsrv and XMing (paid version.) Works essentially the same, I will probably stick with MobaXTerm.

安装 emacs 25.1 快照.原因:Ubuntu 14.04 带有 emacs 24.3,它不适用于 Windows bash 和 MobaXTerm X 服务器(不知道为什么,反正它太旧了.)

Install emacs 25.1 snapshot. The reason: Ubuntu 14.04 comes with emacs 24.3, which doesn't work with Windows bash and MobaXTerm X server (no idea why, and it's too old anyway.)

使用以下命令安装快照:

Install the snapshot using the following commands:

sudo add-apt-repository ppa:ubuntu-elisp/ppa
sudo apt-get update
sudo apt-get install emacs-snapshot

然后运行

sudo update-alternatives --config emacs

并选择emacs-snapshot

确保你设置了DISPLAY

export DISPLAY=localhost:0.0

运行 MobaXTerm(您不需要在其中执行任何操作,只需启动它 - 它会在需要时启动 X Server.)

Run MobaXTerm (you don't need anything to do in it, just start it - it will start X Server when needed.)

在 bash 中运行 emacs 并享受.

Run emacs in bash and enjoy.

仍然存在一个问题,它在我测试过的所有三个软件包(MobaXTerm、XMing 和 vcXsrv)中仍然存在.Emacs 坚持初始框架大小,并且在调整窗口大小时不会调整其框架的大小.菜单栏也有同样的问题——当菜单栏被禁用时,emacs 不会回收它的空间,它仍然是一个灰色的矩形.这个问题似乎是 Windows bash 上的 emacs 所特有的——gvim 和其他 GUI 程序似乎工作正常.此外,使用 Windows 上的任何 X 服务器在 Linux 上运行 emacs 25.1 工作正常.我曾尝试使用不同的 GUI 设置(GTK 2.0 等)构建 emacs,但在 Windows bash 上的 emacs make 卡住了.如果我找到了解决方法,我会发布更新.

One problem remains, and it persists across all three packages I've tested (MobaXTerm, XMing and vcXsrv). Emacs sticks to the initial frame size, and doesn't resize its frame when the window is resized. Same problem with the menu bar - when menu bar is disabled, emacs doesn't reclaim its space, it remains as a grey rectangle. This problem seems to be peculiar to emacs on Windows bash - gvim and other GUI programs seem to work fine. Also, running emacs 25.1 on Linux using any X Server on Windows works fine. I have tried to build emacs with different GUI settings (GTK 2.0 etc.) but emacs make on Windows bash gets stuck. If I find a workaround for this I will post an update.

更新 09/24/2017 根据 Jarett 在您的 中的以下内容init.el 应该修复帧大小调整问题:

Update 09/24/2017 According to Jarett the following in your init.el should fix the frame resizing problem:

(setq frame-resize-pixelwise t)

我不再使用 bash 活动的 Windows,因此我无法对其进行测试.

I don't have Windows with bash active anymore, so I can't test it.

这篇关于如何在 Windows 10 Bash 上使用带有 Emacs 的 X Windows?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆