Oct
30
2009

Emacs: Marking lines in source code

Today I ported some code to a new API. What I really like about that API upgrade: They changed a structure of the interface to a completely new structure, which basically had the same contents with a few new fields. Of course, the order has changed as well and the field names were revised.

Comparing those structure definitions is really no joy, I wished I were able to mark what I dealt with in the header files. With Emacs, that was really a trivial task:

1
2
3
4
5
6
7
(defun mark-overlay ()
  "Marks the region using a special background color."
  (interactive)
  (let ((ovl (make-overlay (point) (mark))))
    (overlay-put ovl 'face '(:background "light green"))))

(global-set-key [?\C-+] 'mark-overlay)

That was easy. Simple hitting ^+ with the region I dealt with now notes that by adding a green background.

tags: ,
posted in Uncategorized by admin

Follow comments via the RSS Feed | Leave a comment | Trackback URL

Leave Your Comment

You must be logged in to post a comment.

 
Powered by Wordpress and MySQL. Theme by openark.org