Have you ever been in the middle of a really long function and wondered just exactly what it was called? Angus Lees came up with
(defun print-defun-name ()
(interactive)
(save-excursion
(beginning-of-defun)
(beginning-of-line 0)
(let ((start (point))
string)
(end-of-line 2)
(setq string (buffer-substring start (point)))
(message "%s" (replace-regexp-in-string "[ \t\n]" " " string)))))
I came up with a slightly different version that works a little better for C code
(defun c-print-defun-name ()
(interactive)
(save-excursion
(c-beginning-of-defun)
(end-of-line 0)
(let ((end (point)))
(c-beginning-of-statement)
(let ((start (point)))
(setq string (buffer-substring start end))
(message "%s" (replace-regexp-in-string "[ \t\n]+" " " string))))))
Add it to your .emacs and if you really want, bind it to a key.