How do you prevent the advised function from running when the advice returns nil?
(defadvice beginning-of-line (before test activate)
nil)
-> Not running beginning-of-line
at all.
EDIT: Just to take away your worries, I do not intend to use it on beginning-of-line
.