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

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

Re: binding C-uC-SPC to a new key


From: rgb
Subject: Re: binding C-uC-SPC to a new key
Date: 22 Dec 2006 05:47:42 -0800
User-agent: G2/1.0

> >> > i would appreciate pointers to invoke the the set-mark-command
> >> > with a prefix (so that it traverses back to where previous mark was).
> >>
> >> Is not C-x C-x what you want?  Or do you just want that the cursor to
> >> skip temporarily to the previous mark?
> >
> > no. what i wanted is to cycle thru all of the marks in my mark-ring.
>
> (setq set-mark-command-repeat-pop t)
>
> means that effectively you only have to type "C-u C-SPC" *once* and
> then for the other locations only "C-SPC".

But if you still want to create a key that invokes a function with a
prefix arg, look at the function's calling syntax.  A prefix arg, like
other interactive arguments is handled by the (interactive ...) clause
which tells emacs how to get the arguments needed to call the
function.

Since you don't want to call it interactively you're call just supplies

the arguments that the interactive clause would otherwise supply.  In
this case, C-u translates to (4).  So call the function like this:

(set-mark-command '(4))

Mapping it to a key could look like this:

(global-set-key [?\C-\M- ](lambda () (interactive)(set-mark-command
'(4))))

The C-u prefix is probably the most obsecure of all interactive
translations so don't be put off by the fact that you're saying to
yourself 'how could I have known'.  All the others are really obvious.
C-h f interactive
and the Elisp reference node- 21.11 Prefix Command Arguments
describe it all.



reply via email to

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