Ads by Google

Monday, February 27, 2012

Friday, February 24, 2012

Emacs Tip: Change Background colour depending on File mode

From the mailing list, here's a nice tip by Kevin Rodgers that might be useful for those who need visual reminders when working on read only files.  Adding the following to your .emacs, would change the background to yellow in this case, which, of course you can modify.

(add-hook 'find-file-hooks

 (lambda ()
   (when buffer-read-only
     (set-background-color "yellow"))))

Sunday, February 19, 2012

Using Beamer Animations to simulate Terminal Input and Output

I've been meaning to write about this for some time.  A few months ago, I had to prepare some training material on Unix basics and such.  While beamer was a natural choice for the presentation, I wanted to show some nifty animations that showed the commands and outputs as typed in a terminal.  I had the written text all done up but didn't know how to get the animation correct; I had misunderstood the features of animate package on CTAN.

Being stuck, I posted on tex stackexchange and had a beautiful solution from Alexander Grahn who went out of his way to solve my different issues that I had with my code.  Finally, on a beamer slide, you can now autoplay simulated Unix commands and expected output while giving a talk, instead of doing uncover on mouse click in beamer.

If you want to see my code instead of the one posted on the stackexchange site, do email me and I shall mail it separately.

EDIT: the compiled PDF can be found here, as requested. Of course you have to download it and open it in Reader for you to see the animations; it won't work in the web preview.

Wednesday, February 15, 2012

Ma Gnus 0.3 released and changing file transfer mode in Ange-ftp

Ma Gnus 0.3 has been released, primarily targeting marks removal from various backends.  And if you want to change the file transfer modes(binary/ascii) when read/writing remote files in emacs, you need to tinker with ange-ftp-binary-file-name-regexp as suggested in this post.  If you need to know what Ange-ftp is, you also need to know Tramp.

Saturday, February 11, 2012

Org-mode, Another reason to learn it

You know why people fall in love with org-mode?  Because of posts like this, explaining how to do source code and results with the minimal of overheads.  That's why.  It's all in a bloody, blooming, text file, dammit.

What's your excuse in not learning it?
sotto voce: Emacs?

Friday, February 10, 2012

SSL certificates, why do they bother?

After reading this article from The Register, why bother with SSL?  A banking heist of the century is waiting to happen, me thinks.  And that innocuous padlock on your browser is going to be the reason for the vanishing money.   You can think of even more ingenious ways of using it to snooker anyone...

Certificate Authority Trustwave has revoked a digital certificate that allowed one of its clients to issue valid certificates for any server, thereby allowing one of its customers to intercept their employees' private email communication.

And it's all downhill from there.

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.


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.