help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

help with wrong-number-of-arguments


From: hw
Subject: help with wrong-number-of-arguments
Date: Tue, 26 Sep 2023 15:40:08 +0200
User-agent: Evolution 3.48.4 (3.48.4-1.fc38)

Hi,

I created the function at [1] a while ago and bound it to C-x t i, and
it has been working fine.  Now when I press C-x t i, I'm getting


Debugger entered--Lisp error: (wrong-number-of-arguments #<subr 
my-perltidy-replace> 1)
  my-perltidy-replace(nil)
  funcall-interactively(my-perltidy-replace nil)
  command-execute(my-perltidy-replace)


What might have changed is the emacs version because I built one that
uses wayland, but I don't remember if it used to work with the wayland
version.

I'm guessing that emacs now figures that the function is getting an
argument where it doesn't take one, and I fail to make sense of
this. How can I fix this?


[1]:


(defun my-perltidy-replace ()
  "This function replaces the contents of the current buffer with
the output of perltidy, and makes a backup of the current buffer.
The backup is then saved."
  (interactive "P")
  (let ((tidy_buffer (generate-new-buffer (generate-new-buffer-name (concat 
"TidyBackup-" (buffer-name))))))
    (with-current-buffer (buffer-name)
      (shell-command-on-region (point-min) (point-max) "perltidy 
--standard-output" tidy_buffer)
      (buffer-swap-text tidy_buffer))
    (with-current-buffer tidy_buffer
      (let ((visiting_file (generate-new-buffer-name (concat 
"~/tmp/TidyBackup/" (buffer-name)))))
      (set-visited-file-name visiting_file)
      (save-buffer)
      (message "backup saved as %s" visiting_file)))))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]