Indent/Format the whole buffer in Emacs

Monday, February 8th, 2010

I have had an indent-buffer command like this for some time, which formats the whole current buffer. I used it for java, c++, css, html, xml and lisp.

(defun indent-buffer ()
    "Indent the current buffer"
    (interactive)
    (save-excursion (indent-region (point-min) (point-max) nil))
)

I found the above function at http://www.emacswiki.org/cgi-bin/wiki/ReformatBuffer

Recently I noticed that it was leaving tabs in (which I hate) and trailing spaces.  It was simply just indenting the buffer.

After some more searching today I found the untabify command and I created the following commands.  Mainly because I expected the command to be called something like tab-???

(defun untabify-buffer ()
    "Untabify current buffer"
    (interactive)
    (save-excursion (untabify (point-min) (point-max)))
)
 
(defun tab-to-spaces ()
    "Convert tab to spaces"
    (interactive)
    (save-excursion (untabify (point-min) (point-max)))
)

I then found this page, http://emacsblog.org/2007/01/17/indent-whole-buffer/ which has the best indent/format buffer function.

(defun indent-buffer-2 ()
    "Indent the buffer 2"
    (interactive)
    (save-excursion
        (delete-trailing-whitespace)
        (indent-region (point-min) (point-max) nil)
        (untabify (point-min) (point-max))
    )
)

Using ISO files in Linux and Windows.

Thursday, November 13th, 2008

I’ve started to use more and more ISO images as disk space is becoming cheaper and its a lot easier to manage ISO files compared to physical CDs/DVDs.  Mainly because I keep forgetting where I put the physical media.

Linux

appleseed movie

Create an ISO file using dd

 download the x files i want to believe dd if=/dev/cdrom of=image.iso

Mount the ISO using local loop back download smokey and the bandit part 3 movie (you may need to be root)

mkdir /mnt/disk
mount -o loop image.iso /mnt/disk

Windows

For Windows you should get a copy of the free program MagicDisk

numb download

I use it all the time at work and I’ve never had any problems with it.   Its small simply and works well.

More gimp flame backgrounds

Sunday, August 10th, 2008

nympha dvd watch babylon 5 the lost tales voices in the dark online

I made some more gimp flame backgrounds. Both images are 1600×1280.

watch under the tuscan sun online

These look good on 21″ CRT monitors. Of course you can crop them for wide screen monitors too.

a yellow circle flame spiral.

and

a yellow flame with square middle.

Don’t forget the full gallery is here

AVI to FLV with ffmpeg

Monday, June 9th, 2008

I used to have all my videos on my website as divx or xvid encoded AVI. This is a pain as you have to download the files to play them.

I found FlowPlayer and it works really well. I used to use flvtool to encode videos as flv files but it is not part of gentoo and I had to keep manually downloading and building it all the time to get the updates.

kismat konnection movie

I recently found this article which shows how to use ffmpeg to encode videos as flv files.

ffmpeg -i video.avi -ar 22050 -ab 32 -f flv -s 320x256 video.flv

download outlaw trail the treasure of butch cassidy download doctor zhivago dvd

I then use the flv with FlowPlayer like this

<object type="application/x-shockwave-flash"
    data="/include/FlowPlayer.swf"
    width="320"
    height="284"
    id="FlowPlayer1">
  <param name="allowScriptAccess" value="sameDomain" />
  <param name="movie" value="/include/FlowPlayer.swf" />
  <param name="quality" value="high" />
  <param name="scale" value="noScale" />
  <param name="wmode" value="transparent" />
  <param name="allowNetworking" value="all" />

  <param name="flashvars" value="config={
		autoPlay: false,
		loop: false,
		initialScale: 'scale',
		showLoopButton: false,
		showPlayListButtons: false,
		playList: [
			{ url: '/media/tux_07.flv' }
		]
		}" />
</object>

See Hintertux 2007 for an example.

Hintertux Video Processing

Saturday, June 7th, 2008

Well, this is crazy. We are back from Hintertux and now its time to start processing the video. My new Helmet cam means that I have loads of footage. 57Gb of raw dv files.

I have started watching the clips and chopping them up into little clips in Cinelerra. Its really a very good application. In my opinion its better than most. The motion tracking and stabilisation is really good.

download hard boiled online download bug s life a movie I did have one problem and it didn’t really like using the XVID AVI files which my helmet camera made so I converted all the files to raw DV files. I used ffmpeg to do this.

fairytale a true story dvd ffmpeg -i video.avi -target pal-dv video.dv

I’ve been processing for days already and I still haven’t processed half of the footage.