Showing posts with label .emacs. Show all posts
Showing posts with label .emacs. Show all posts

Wednesday, February 1, 2012

No Gnus v0.19 is released

Installing AucTeX and Preview LaTeX on Windows

So, I upgraded my Emacs to the latest version and went through the steps of compiling my elisp packages on my Windows XP laptop and promptly struggled a bit on getting Auctex and Preview LaTeX to work.  I've decided on documenting it; well, only the key steps with a lot of hand waving and assumptions thrown in.

Namely,

Cygwin toolchains are installed(that's what I have)
MiKTeX is installed(whatever version)
Win32 Emacs from the official GNU site (I used 23.4)
Ghostscript is installed too (I used the cygwin based one)

In the cygwin terminal, either checkout the cvs version of Auctex or download the tarballs and untar it somewhere.  Presumably you have MiKTeX and Emacs installed already somewhere; preferably in a folder path that doesn't contain spaces in it's name(It should work with spaces in the path name but I haven't and daren't try that; I really don't need that aggravation).

First you run configure to generate the Makefile

./configure --with-emacs=c:/gnu/emacs-23.4/bin/emacs --prefix=c:/gnu --with-texmf-dir=c:/MiKTeX2.9

If you haven't got all the build tools needed (make, install, latex,perl..) it will stop.  Fix each one of them by installing the necessary packages by using the cygwin package manager setup.exe. Of course, you need to adjust the paths above.

By default, the preview build is enabled by default, which, you can disable by adding the option --disable-preview to configure above, if you don't want to preview your latex document that's got figures and maths.

When the Makefile is generated, run make.  Do not do a make install.  You can use the files in situ by following the instructions of Tassilo Horn here.   You'd probably need to add the following to get the correct info files of Auctex.

;; AUC TeX
(add-to-list 'load-path "C:/gnu/elisp/auctexcvs/auctex/")
(load "auctex.el" nil t t)
(add-to-list 'load-path "C:/gnu/elisp/auctexcvs/auctex/preview/")
(load "preview-latex.el" nil t t)
;;set the path to info files of auctex
(setq Info-default-directory-list
      (cons "c:/gnu/elisp/auctexcvs/auctex/doc" Info-default-directory-list))
I prefer it this way as this does not change the directory structure of a stock install of Emacs on Windows.  Easier to share the folders for someone to copy without borking something.

Navigate to the preview folder and load the circ.tex and compile it.  It should hopefully do so.

For preview you need the png or jpeg image support with Emacs. I've used the dlls mentioned in the Emacs README.w32 that are hosted on the GTK website. Specifically, the png and zlib ones that I downloaded and just dumped  in the Emacs bin directory.  Added the following to my .emacs

(setq preview-image-type 'png)

Ran the preview command on the circ.tex buffer and it showed the equations and images inline which is what it's supposed to do.  If you want jpeg support you'd have to get the jpeg dlls for win32 somewhere(the install files mentions gnuwin32 site)

Which is where I stop now as it all works fine and dandy for me.  The various install files tell you not to mix the cygwin paths and normal DOS paths and other such warnings.  But I haven't seen anything that has knackered my installation or borked my usage of them with different bits of win32 and cygwin tied together with AucTeX

So far.

Wednesday, June 18, 2008

Changing the default mode of the *Scratch* buffer

The default *Scratch* buffer in Emacs starts in fundamental mode which might not be useful for lots of people who either don't know or want to work on elisp.


If text mode makes sense for you as the default, the following addition to the .emacs file should fix it.

(setq initial-major-mode 'text-mode)

Note that you don't lose much if you're trying out a few lisp forms as they can be eval'ed anywhere by hitting C-x C-e that would have the same effect as doing it in lisp mode.

Wednesday, May 21, 2008

An useful emacs shell setting

This is another useful addition to your .emacs; To prevent that command line from staying at the bottom in your emacs shell. Though this doesn't seem to work on my win32 emacs and cygwin bash shell.

hmmm....

Edit: in the same thread the following suggestion works for win32 Emacs at least.

(setq comint-output-filter-functions '(comint-watch-for-password-prompt))

Now, the prompt is pretty much centred in the middle of the screen

Edit 2: More additions, this seems to be the correct way

(add-hook 'shell-mode-hook
(lambda ()
(remove-hook 'comint-output-filter-functions
'comint-postoutput-scroll-to-bottom
t))) ; LOCAL




Saturday, March 22, 2008

The cruft in my .emacs

It just occurred to me that I don't have a complete understanding of how I came up to speed (err,sort of) in being a bit proficient in using Emacs. I've come to realise that the advice given by Emacs developers is sound.

Do not randomly copy .emacs snippets from different users and websites. You have no idea what you copied when you're learning initially and at an intermediate stage, a little knowledge is dangerous!

My .emacs header says that it's 6 years old and I can see what a mess it is when I try to change it. I have repeated path references, lots of commented code, comments which don't make sense and some packages that I don't use at all.

If I clean up my .emacs, I'm pretty sure that I can shave off around 3 seconds of the startup time. I've also noticed that Emacs developers have made more of the customisations that were explicitly set as the defaults which means more stuff can be removed from the init file.

After backing up my .emacs I have deleted a lot of stuff and I don't miss it for over a month now. Going over the .emacs now with a bit more understanding,it's far easier to chop off code than when you're a noob. Of course, the code should not have been there in the first place.