title: How to call query-replace-regexp inside a function?
body: <p>I tend to use query-replace-regexp over an entire buffer rather than at the current position so I regularly use the sequence C-&lt; (beginning-of-buffer),  then C-r (query-replace-repexp).</p>
  
  <p>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:</p>
  
  <pre><code>(defun query-replace-regexp-whole-buffer ()
    "query-replace-regexp from the beginning of the buffer."
    (interactive)
    (beginning-of-buffer)
    (query-replace-regexp))
  </code></pre>
  
  <p>that this would be adequate, unfortunately though I'm getting some errors. </p>
  
  <pre><code>query-replace-regexp-whole-buffer: Wrong number of arguments: #[(regexp to-string &amp;optional delimited start end) "Å Æ
  Ç&amp;  " [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
  </code></pre>
  
  <p>I can't really see what I'm doing wrong,  hopefully someone can help.</p>