0

I'm new to emacs and newer to lisp

I'm trying to set Meta + spacebar to set the mark for highlighting text (at current cursor position). searching around online and experimenting I've ended up with the command

(global-set-key (kbd "M-SPC") 'push-mark nil nil 1)

The above command isn't working for me though, I'm getting an "incorrect number of arguments error".

Got the function definition,

    push-mark &optional position nomsg activate
from elisp manual here

    Position: nil for position should default to current cursor position
    nomsg: I don't care about (I think)
    activate: apparently isn't true by default so I need to set it to...something.

How would I format the command to pass in three values?

The error is definitely due to the push-mark function call as other functions such as backward-char (which I'm not passing inputs to) work correctly

1

You need to pass your arguments to push-mark, not global-set-key:

(global-set-key (kbd "M-SPC") (lambda() (interactive) (push-mark nil nil 1)))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.