Emacs: How to use a marking ring?

When I do C-u C-SPC, emacs leads me to "where I was before." Subsequent C-u C-SPCclicks return to previous places. It's damn cool and I use it a lot.

But something always eavesdropped on me: the only mark missing from the label was where-I-called-this-in-1st place! I like to leave the breadcrumbs behind you, and then go “scream, I can be lost, imma go back and check”, and then go back without leaving the breadcrumbs where you are now!

I tried to advise functions, but I can’t imitate me programmatically for life C-SPC C-SPC.

  • how can I “see” (echo, message, trace, etc.) what a key combination is, for example, “Ch k”, but for repeated key sequences, for example C-SPC C-SPC? This is what the last guide says (my attention).

C-SPC runs the set-mark-command command, which is an interactive compiled Lisp function in `simple.el '.

It is associated with C- @ , C-SPC.

(set-mark-command ARG command)

Mark where the dot is, or scroll to the mark. Setting a character also changes the region, which is the text between the point and the mark; this is the closest equivalent in Emacs to what some editors call Selection.

. .

( ) " ", " ", " "..? ( ).

, . , .

+5
4

,

(defun px-push-mark-once-and-back ()
    "Mark current point (`push-mark') and `set-mark-command' (C-u C-SPC) away."
    (interactive)
    (let ((current-prefix-arg '(4))) ; C-u
        (if (not (eq last-command 'px-push-mark-once-and-back))
                (progn
                    (push-mark)
                    (call-interactively 'set-mark-command))
            (call-interactively 'set-mark-command))))

(global-set-key (kbd "<s-left>") 'px-push-mark-once-and-back)
+1

(push-mark) , , .

+3

, .

C-- C-SPC -.

+1
source

You should probably not use set-markor set-mark-commandnot interactively. Within elisp, just store the point (or any other location) in a variable with a good name.

In addition, C-h i m emacs m mark.

I am not emacs guru wrt mark, I almost never use it. I know that I saw the behavior you need before.

0
source

All Articles