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

user1854496
  • 133
  • 6

1 Answers1

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)))
sds
  • 1,596
  • 2
  • 14
  • 21