Recently I upgraded my emacs from 24 to 25.3.1. After the upgrade, the following code does not work anymore:
;;================================== ;; Wrap Query Replace ;;================================== ;; copy the original query-replace-function (fset 'wrap-query-replace 'query-replace) ;; advise the new version to repeat the search after it ;; finishes at the bottom of the buffer the first time: (defadvice wrap-query-replace (around replace-wrap (FROM-STRING TO-STRING &optional DELIMITED START END)) "Execute a query-replace, wrapping to the top of the buffer after you reach the bottom" (save-excursion (let ((start (point))) ad-do-it (goto-char (point-min)) (ad-set-args 4 (list (point-min) start)) ad-do-it))) ;; Turn on the advice (ad-activate 'wrap-query-replace) (global-set-key "\C-cq" 'wrap-query-replace) When I tried to call the function with C-cq, it asked me for word to search and word to replace as usual, but when I press return, I received the following error in emacs 25.3.1 : 
Any idea what's wrong with it?
defadvicetoadvice-add.