I tend to use query-replace-regexp over an entire buffer rather than at the current position so I regularly use the sequence C-< (beginning-of-buffer), then C-r (query-replace-repexp).
I'd like to make another function bound to C-S-r (C-R) which does this for me. I thought that if I simply wrapped it all together such as:
(defun query-replace-regexp-whole-buffer ()
"query-replace-regexp from the beginning of the buffer."
(interactive)
(beginning-of-buffer)
(query-replace-regexp))
that this would be adequate, unfortunately though I'm getting some errors.
query-replace-regexp-whole-buffer: Wrong number of arguments: #[(regexp to-string &optional delimited start end) "Å Æ
Ç& " [regexp to-string delimited start end perform-replace t nil] 10 1940879 (let ((common (query-replace-read-args (concat "Query replace" (if current-prefix-arg " word" "") " regexp" (if (and transient-mark-mode mark-active) " in region" "")) t))) (list (nth 0 common) (nth 1 common) (nth 2 common) (if (and transient-mark-mode mark-active) (region-beginning)) (if (and transient-mark-mode mark-active) (region-end))))], 0
I can't really see what I'm doing wrong, hopefully someone can help.