Johnny [Life & Code]

February 8, 2009

1 reason to run GDB & 2 reasons to run emacs from source

Filed under: CODE, Emacs, Linux Fun, Tech — Johnny @ 1:08 pm

CODE :

GDB : Compiling from Project Archer, you get to have python scripting inside gdb. This opens up numerous possibilities and nice tricks that helps you to debug  faster. http://tromey.com/blog/?cat=17 has few example + demo scripts.  Falling in love  with these ..

EMACS : emacs 23 (in cvs) gives you MultiTTY Support , XFT Font rendering (and more). Looks better with XFT and multitty support rocks !

LIFE :

??

December 27, 2006

[EMACS : emacsclient -n] echo “alias ec=’emacsclient -n’” >> ~/.bashrc

Filed under: Emacs, Linux Fun — Johnny @ 5:02 am

I use emacs shell extensively. so when i grep for some thing and i need to open the file, i have to visit the file (c-x c-f) eventhough  imy emacs shell is in the current directory. so

echo “alias ec=’emacsclient -n’” >> ~/.bashrc

m-x server-start (you can add this to ur .emacs)

m-x shell

blah@foo:~> ec test.test

emacs is kewl !!

November 28, 2006

[EMACS] GTD Issues : Rescued by EMACS!

Filed under: Emacs, Linux Fun, Tech, Thoughts, eXtreme — Johnny @ 6:43 pm

Have you ever wondered that you have sincerely worked on tasks all day and at the end you find that therez still lot to do .. And do you use EMACS most of the time writing code, patching bugz, making good software, making software good ..

Well .. yes .. thatz me (a little!!).. The first thing I do when i switch on my laptop is … start EMACS!! . I daily use EMACS to write code in c and c# .. yes i write C# in Emacs.

Well Anyway, the coolest thing (among lot other coolstuff ) is the ‘timeclock-in’ and ‘timeclock-out’ functions.

you  can timeclock-in to a project and timeclock-out.. at the end of the day you could use timeclock-generate-report.

Found  a simple page detailing this : http://www.delorie.com/gnu/docs/emacs/emacs_437.html 

If you are more serious about using EMACS as your planner , then planner.el is the right thing ..  I’m not joking here … have a look at joe’s site : joesteeve.org . Everything you see there is by EMACS !!!!

August 29, 2006

Editing remote files using emacs

Filed under: Emacs, Thoughts — Johnny @ 2:46 pm

I write code in my laptop and sometimes i have to do the same on my test machines. I dont want to look into my laptop and try to do the same on other machines (well .. not copying files.. . … ). As usual Emacs has something ..

TRAMP- `Transparent Remote (file) Access, Multiple Protocol’. With it i can edit remote files very easily.

May 26, 2006

Ill effects of EMACS

Filed under: Emacs, Linux Fun, Thoughts — Johnny @ 8:47 am

Every Emacs user has to admit this… Using emacs has a lot of disadvantages..

1. Suddenly your standard keyboard looks too big with unwanted keys… Especially the "Insert, home … page down", arrow keys , Num pad … Sometimes i feel like cutting the right side off my keyboard

2. Navigating in other word-processors like 'open office' becomes a tedious task…. to do something you have to use your mouse (sometimes)…

3. Its very addictive… Sometimes when u are discovering a new feature… it can distract you away from work.

Well if you have experienced anything like this … feel free to add it in the comments

May 25, 2006

Tempo mode in Emacs

Filed under: Emacs, Tech — Johnny @ 4:09 am

When debugging or learning code i use a lot of printf statements to understand the execution path and things like that. I know there are better ways to learn the code …. But I like these printfs… So in emacs this is how i do it using the tempo mode. koool

(defvar c-tempo-tags nil
"Tempo tags for C mode")

;;; C-Mode Templates
(require 'tempo)
;;; (setq tempo-interactive t)

(add-hook 'c-mode-hook
'(lambda ()
(local-set-key [f11] 'tempo-complete-tag)
(tempo-use-tag-list 'c-tempo-tags)
))
;;; Templates appended to c-tempo-tags

(tempo-define-template "c-debug-pf"
'("printf(\"%s(%d):%s:" r "\\n\", __FILE__, __LINE__, __PRETTY_FUNCTION__);">)
"include"
"Insert a printf statement with info on location"
'c-tempo-tags)

Add this line (i'm sure there ia better way to add this .. but for now ….)
(global-set-key "\C-x\C-q" 'tempo-template-c-debug-pf)

So from now on inside any buffer if you press C-x C-q… it'll insert the line

printf("%s(%d):%s:\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
You can add any number of templates

BTW,

__FILE__ , __LINE__ and __PRETTY_FUNCTION__ are GCC magic identifiers :)

Blog at WordPress.com.