Tuesday, February 26, 2008

Ant JVM proxy configuration

I don't know much about apache ant.Last day I was trying to build a project and the build failed.Because there was an error while downloading a package from the net.After hours of battle it was figured out that there is a proxy configuration setting for Ant's JVM.We can set proxy with


export ANT_OPTS="-Dhttp.proxyHost= -Dhttp.proxyPort="

eg:

export ANT_OPTS="-Dhttp.proxyHost=192.168.0.2 -Dhttp.proxyPort=8080"

Saturday, February 9, 2008

To copy,paste between emacs and other applications....

By default U can't copy from an application say Firefox to emacs...
(a difficult situation for somebody like me who tweak on others code)

Copy pasting from emacs to aother applications are also not supported...

U can get it done by adding just two lines to your .emacs file..
(U can't copy paste it if U R using emacs for editing .emacs file...)

(setq x-select-enable-clipboard t)
(setq interprogram-paste-function
'x-cut-buffer-or-selection-value)


Done...

Now copy something to your clipboard from an application say firefox and
click C-y in emacs it gets copied....

Now do C-k(kill) a line a try C-v in any other application say gedit..it gets
pasted...

Thursday, February 7, 2008

Adding themes to emacs

U can add cool themes with a single command in ubuntu..

aptitude install emacs-goodies-el

Themes are installed...

Now start emacs and try

M-x color-theme-select

U will get menu list of themes.Select one from the list by pressing RET.

U have a new theme for Ur emacs....

The theme will stay only for that session of emacs...

If U want the theme to stay across sessions...add this code to the .emacs file
in the home directory.U should have .themesettings and .curTheme file in ur home
director(I was not having .themesettings I had to create it for this tweak)

(require ‘color-theme)
(setq theme-load-from-file t)
(defun my-onload()
(setq filename (concat (expand-file-name "~") "/.themesettings"))
(if (file-exists-p filename)
(progn
(load-file filename)
(if (equalp theme-load-from-file t)
(progn
(setq filename
(concat (expand-file-name "~") "/.curTheme"))
(if (file-exists-p filename)
(progn
(message "selecting theme from .curTheme")
(load-file filename)
(color-theme-install (my-color-theme))
)))
(funcall theme-default)
))
(message "selecting theme from color-theme-standard")
(color-theme-install(color-theme-standard)
)))

(defun my-kill-saves()
(if (equalp theme-load-from-file t)
(progn
(color-theme-print)
(write-file (concat (expand-file-name "~") "/.curTheme"))
)))

(add-hook 'after-init-hook 'my-onload)
(add-hook 'kill-emacs-hook 'my-kill-saves)


Now the selected theme will stay if we restart emacs.