Why is this function saying wrong number of arguments? reddit / emacs ---------------------------------------------------------------------- LowCom · 2022-05-29 03:49 ``(defun selectLine () (interactive) (beginning-of-visual-line) (set- mark-command) (end-of-visual-line) )`` Also, is there a key binding to select whole line through one key? I know I can select it using C-a C-spc and C-e. But I need it to be one key as I have a function that will evaluate math expression in selected region and it's cumbersome to select line through 3 keys and then apply key for that function. ---------------------------------------------------------------------- ambihelical · 2022-05-29 04:16 `M-x toggle-debug-on-error` before you run it, and you will get a nice stack backtrace. ---------------------------------------------------------------------- whudwl · 2022-05-29 04:21 `set-mark-command` expects one argument. What you want to do is probably `(set-mark-command nil)` ---------------------------------------------------------------------- howardthegeek · 2022-05-29 05:04 Another approach, instead of selecting the line, is to get the positions of the beginning and end of the line, and then call your math evaluation using buffer-substring (If it takes a string) or the positional numbers (If it takes a region). ---------------------------------------------------------------------- Gallipo · 2022-05-29 14:14 You could also wrap that in a (save-excursion …) to preserve point.