reddit / emacs

Need help with beginner elisp defun that mimics another emacs command.

[deleted] · 2022-03-14 00:35
[deleted]
Status-Detective-783 · 2022-03-14 00:58
I think I'm so way off base that the question isn't good, so I'm deleting this question. I've found some similar Q/A's so I'm going to try them out. Here's the original question though: I'm trying to create a command that just mimics the `query-replace` command. But I cannot get the calling command correct. Below is the function, last two lines are alternate attempts, along with their error codes when I attempt to use this in emacs. Admittedly (global-set-key (kbd "M-p") 'dls-query-replace) (defun dls-query-replace (&optional arg) "My version of query-replace, only difference is that this is bound to M-p because M-% is used by MacOS. This just calls `query-replace'." (interactive "P") ; (arg #'query-replace)) ; <--- gives me "symbols definition is void: arg" (query-replace)) ; <-- give me "Wrong number of arguments: (2 . 7), 0" I know I can just bind `M-p` directly to `query-replace`, but I thought it would be nifty for my init.el to not mess with the standard binding, and also to have some help describing what I did and why.