Difference between revisions of "Emacs"

From BarikWiki
Jump to: navigation, search
(MediaWiki)
Line 10: Line 10:
 
== MediaWiki ==
 
== MediaWiki ==
  
* Supposedly, you can directly edit [https://launchpad.net/mediawiki-el MediaWiki.el] pages from Emacs.
+
* Supposedly, you can directly edit [https://launchpad.net/mediawiki-el MediaWiki.el] pages from Emacs. But no matter what I do, I receive: <code>error in process filter: Invalid Login!</code>.
  
 
== Python ==
 
== Python ==

Revision as of 20:52, 21 June 2012

Introduction

Since I've decided to give up on Vim, it's time to take a serious look at Emacs.

  • Windows is always quirky: GNU Emacs FAQ For MS Windows; the short of it is that you probably want an init.el file in your .emacs.d directory.
  • EmacsWiki: Emacs Channel FAQ
  • Windows binaries.
  • Set ALTERNATE_EDITOR to runemacs.exe. Then, if you want to load a file from the command-line into the existing Emacs client (with (server-start)), use emacsclientw filename.

MediaWiki

  • Supposedly, you can directly edit MediaWiki.el pages from Emacs. But no matter what I do, I receive: error in process filter: Invalid Login!.

Python

  • Use can use python-mode. Please note that this is different than the python.el that comes by default in FSF Emacs. I've added to the existing bug report; it appears that it assumes the existence of an abbrev_defs.
  • Ultimately, I'd like to be able to use ipython from within this environment.

Spelling

  • It would be a shame if you couldn't get spelling to work at all. For Windows, you'll need GNU Aspell. You need to download both the Full Installer and then a Precompiled Dictionary. There are some instructions for setting up Aspell Windows. I prefer instead to use M-x customize-variable to do this.
  • Flyspell note: turn-on-flyspell.

LaTeX

  • I've tried practically every editor at this point and decided that Emacs is in fact the best environment for editing LaTeX documents.
  • For LaTeX: AUXTex, sophisticated document creation. Installation on Windows involves simply extracting a zip file, but PDF preview is much more difficult to get reasonably correct. Compile to PDF by default. The EmacsWiki has a lot of good AucTeX tweaks.
  • This isn't just an Emacs issue, but acroread locks the PDF, which makes repeated runs of pdflatex irritating. You can try Sumatra PDF instead as your LaTeX viewer. The first thing people usually notice about Sumatra PDF is the obnoxious background color. This can be changed through a command-line argument in the manual.

AucTeX and PDF Synchronization on Windows

In this section, we'd like to setup GNU Emacs and AucTex so that it can do both forward searches (using Emacs to control the PDF Viewer) and inverse searches (using the PDF Viewer to control Emacs). William's instructions have recently been updated, and reflect many of these changes. The version here is expanded for individuals like myself who need a little more hand holding.

  • Unlike on the Mac, TeX tool support on Windows is quite a challenge. With the exception of Sumatra PDF, there are basically no PDF viewers that support source synchronization. Here, use the full installer, and not the portable apps version of Sumatra PDF.
  • To get PDF synchronization to work, you'll need to set a few AucTeX variables in emacs (M-x customize-variable). The first is TeX-view-program-list, which needs to have a Choice of Command. The Name should read as Sumatra PDF. The Command part needs to read: "C:/Program Files (x86)/SumatraPDF/SumatraPDF.exe" -reuse-instance %o, adjusting accordingly for your actual path. I have no idea where %o is actually documented; it just works.
  • The next variable is TeX-view-program-selection, where the Viewer for output-pdf should be set to Sumatra PDF.
  • Similarly, find TeX-source-correlate-mode and set this to On. Finally, set TeX-source-correlate-method to synctex.
  • Need, you'll need a special script for forward searching: sumatra-forward.el. Place this file in c:\emacs\site-lisp, or equivalent. Update your init.el file in .emacs with (require 'sumatra-forward).
  • On Windows in particular, (server-start) is problematic and will fail by default with something like: error: The directory ‘~/.emacs.d/server' is unsafe. This is due to a permissions problem; the file ~/.emacs.d/server needs to be owned by you. The easiest way to do this is through the command-line: takeown /f server, though you can also use the GUI to take ownership of the file (Properties > Security > Advanced > Owner). If you like, you can optionally also set the variable TeX-source-correlate-start-server to Always.
  • Also, GNU Emacs now comes with DDE client, so there's no need to install this.
  • The only thing left to do now is inverse search. Under Sumatra PDF, go to Settings > Options. Set the inverse search command-line to c:\emacs\bin\emacsclientw.exe +%l "%f" or equivalent.
  • Finally! To perform forward search (from within Emacs) hit F8. To perform inverse search (from within Sumatra PDF), double-click the area of text.