7

Just unzipped and started using Emacs 25.1, hoping to get a browser running in emacs. The instructions I found had me enter

"M-x xwidget-webkit-browse-url"

And then I'm asked to complete a command like this:

http://editing.

Which I do with some random URL -- then I'm told that:

Your emacs did not compile with xwidget support.

Can anyone give me some simple instructions to follow to fix this? (hopefully this isn't too involved...)

zck
  • 8,984
  • 2
  • 31
  • 65
David J.
  • 153
  • 3
  • 11
  • I added an article in my answer suggested by @M.W. about compiling Emacs with Xwidgets via Cygwin; you might want to look at it if you're still interested in using Xwidgets on Windows. – GDP2 Nov 10 '16 at 02:56

1 Answers1

9

I don't use Emacs on Windows, nor do I use xwidgets, but I do know that Emacs has to be compiled with xwidgets (since some of its stuff is written in C) for it to work. Taking a cursory look at the configure options for Emacs, I see a particular option for compiling Emacs with xwidgets:

--with-xwidgets         enable use of some gtk widgets in Emacs buffers
                          (requires gtk3)

I'm not sure how you would compile Emacs like this on Windows, but my first guess would be to use Cygwin or something similar.

EDIT:

Here's an article about compiling Emacs with Xwidgets support on Windows via Cygwin, courtesy of M.W. I'll copy it here for convenience and to circumvent link rot:


Setup Emacs with PDF Tools and Xwidgets web browser on Windows

Installation instructions:

Prerequisite

  • Download Cywing setup from Cygwin's Install page.
  • If you want only the PDF reader, you can install the Emacs shipped by Cygwin. However, if you also want the web browser, then you need to compile your own Emacs 25 from source.

With PDF reader

DEMO (Notice how I press some text in PDF file and Latex buffer jumps to corresponding automatically).

First, don’t use MELPA; you must install pdf-tools manually from this repository. Then, you need to install Cygwin. The following dependencies are needed:

If you don't plan to use Xwidget browser, just install Emacs from Cygwin:

  • emacs-w32 (Editors category)

Then install the tool chain for PDF Tools:

  • make (Devel category)
  • gcc-core (Devel category)
  • gcc-g++ (Devel category)
  • autoconf (Devel category)
  • automake (Devel category)
  • perl (Perl category)

Then install Poppler development library:

  • libpoppler-devel (Lib category)
  • libpoppler-glib-devel (Lib category)

Just type the dependency name above and click to choose. For example, enter libpoppler-devel into the search box.

After all dependencies installed, clone pdf-tools:

git clone https://github.com/politza/pdf-tools

Then, go into pdf-tools directory and build it:

make

When the compilation is done, from your Cygwin Terminal, copy the file server/epdfinfo.exe into /usr/bin/:

cp server/epdfinfo.exe /usr/bin/

Then, also within Cygwin, run emacs command. Within Emacs, run the Emacs command:

  • M-x package-install-file
  • Press RET
  • Select pdf-tools-${VERSION}.tar RET (the tar file is in your repository).
  • Finally, run pdf-tools-install and enjoy. Here is the configuration you can put in your init file:

    (pdf-tools-install) (setq pdf-info-epdfinfo-program "/usr/bin/epdfinfo.exe")

With Xwidgets browser

DEMO

Development libraries for building Emacs that supports Xwidgets:

  • libgif-devel (Graphics category)
  • libtiff-devel (Lib category)
  • libjpeg-devel (Devel category)
  • libxpm-devel (Devel category)
  • libgnutls-devel (Devel category)
  • libpng-devel (Devel category)
  • libncurses-devel (Lib category)
  • libgtk3-drivel (Lib category)
  • libwebkitgtk3.0-devel (Lib category)

Then, install X11 server for displaying Emacs:

  • xorg-server (X11 category)
  • xinit (X11 category)

Then, open Cygwin terminal and compile Emacs:

./configure --with-xwidgets
make
make install

Finally, set your display:

echo "export DISPLAY=:0.0" >> .bash_profile

Then, from your Start Menu, open the X server:

Xserver example

Then, run your compiled Emacs 25 from Cygwin terminal:

emacs
GDP2
  • 1,340
  • 9
  • 25
  • 1
    https://tuhdo.github.io/setup-emacs-windows.html has step-by-step instructions to compile Emacs with XWidget (and PDF) support using the Cygwin toolchain and libraries. – M.W. Nov 09 '16 at 23:46
  • @M.W. Ok, great. I'll edit my answer to contain that article. – GDP2 Nov 10 '16 at 02:35