lisp
(defun iedit-symbol-in-defun ()
"Enter `iedit-mode' to rename the symbol in current function, or exit it."
(interactive)
(if iedit-mode
(progn
(iedit-mode -1)
(widen))
(progn
(if (thing-at-point 'symbol)
(progn
(narrow-to-defun)
(iedit-mode t)
(message "When done, run `epy-iedit-in-defun' again to quit.")
)
(error "You need to put cursor on identifier.")
))))