30 April, 2008

Emacs : Highlight changes and autocomplete word

  • M-x highlight-changes-mode
  • (type and then) M-/

28 April, 2008

Emacs C++ Class Browser and other tricks

http://www.geocities.com/davinpearson/research/2006/mopa2e.html

Display current C function in modeline

;; show current function in modeline
(which-func-mode t)


Etags emacs

From http://www.xemacs.org/Documentation/21.5/html/emodules_5.html

Indexing your source code for easy navigation

Emacs comes with an etags executable (and also probably its cousin ctags), which can index source code, allowing you to jump around your source code quickly by simply giving a method name to jump to, etc. Here are some simple steps to get you started:
  1. from a shell, run etags *.[ch] in your source directory, which will index or re-index the .c and .h files in your source directory, and will create a file named TAGS.
  2. inside emacs, run M-x visit-tags-table RET and then enter the name of the TAGS file created by the previous step.
  3. for example, to visit a function named "sortRecords", type M-. and then enter the name "sortRecords". Or, better yet, enter just "sortRec", as substrings will work as well, as long as they are unique.
  4. did your press of M-. not put you in the right function/variable? Then try pressing C-u M-. to visit the next function/variable with a similar name.
  5. do you want to go back to where you were before the last M-. or C-u M-.? Then simply to M-*, each press of which will pop a stack and return you to where you came from.

03 April, 2008

Alt-Delete in iterm

There are two ways you can backwards delete a word out of the box with iterm:
Ctrl+w
Esc, Ctrl+h or Esc, Delete

Finally, using some unix trickery, I got option+delete working. First, I used the bind command to map Esc, d to backwards delete word. Edit ~/.bash_profile in your favorite text editor and add the line:

bind '"\M-d": backward-kill-word'

(Make sure you have all those quotes, otherwise it doesn't work.)

Now that you have an escape sequence that doesn't require the Ctrl key, you can map option+delete to it in iTerm.

In iTerm, go to Bookmarks > Manage Profiles. Choose Keyboard Profiles > Global and click the + button to add a key binding. Choose delete from the dropdown, check the option checkbox, and then in the Action: dropdown choose escape sequence. In the text field that appears, type d. I also checked the High interception priority checkbox for good measure.
http://hackaddict.blogspot.com/2008/01/delete-backwards-word-with-optiondelete.html