68

Registers: C-xrSPC runs point-to-register C-xrj runs jump-to-register Type any character to specify a register when prompted.1 Bookmarks: C-xrm runs bookmark-set C-xrb runs bookmark-jump Mark ring: C-SPCC-SPC pushes the current position to the mark ring (without leaving it active). C-uC-SPC pops the mark ring, jumping to the previous position. You can ...


25

Helm has an interface for browsing both local and global mark-rings: helm-all-mark-rings. See the mini-guide for a brief description and a screenshot. And if you prefer Ivy/Swiper/Counsel, see counsel-mark-ring.


24

Emacs windows C-x 2 will open another window (=split the frame) below the current one, attached to the same buffer. You can move point in either window without affecting the other. You can move from one window to the other using C-x o. The built-in windmove library provides some function that makes navigating between windows easier. If this method suits ...


20

In addition to phils's answer, there are some more options: helm-all-mark-rings: It allows you to view the content of the both the local and global mark rings in a friendly interface, so you can always jump back to where you were. You can push mark with C-SPC C-SPC. Demo: helm-semantic-or-imenu: List all available definitions in the current file. If ...


16

When you set set-mark-command-repeat-pop to t via (setq set-mark-command-repeat-pop t) you can keep pressing C-SPC after the first invocation of C-u C-SPC to jump to previous locations stored in the mark ring.


13

I find it easier to use registers to mark locations: C-x r <space> and then a letter to mark, C-x r j and a letter to jump back. I can maintain a number of marks, very useful when alternating between multiple buffers


11

C-x C-x for exchange-mark-and-point has similar use to C-u C-space. It lets you bounce between a point and the last mark. It's a little weird for bouncing with transient-mark-mode as it activates the mark and selects the region.


10

Apart from the other tips you have got here I thought I should mention that C-s sets the mark for you, so there is no need to do it explicitly. Also, many commands that "move a potentially long way" (beginning-of-buffer and end-of-buffer for example) also sets the mark where you started. Together with the other ways to work with the mark (pop, exchange point ...


9

Besides registers and markers (see @phils's answer about both and my other, Icicles answer about markers), bookmarks, particularly either autonamed or temporary bookmarks, can be helpful for this. You need library Bookmark+ for these special bookmark types. An autonamed bookmark is one that you do not need to name. It is quick to create and delete: just hit ...


9

Because shift translation and temporary activation of the mark is handled by the command loop, you will need to call the interactive versions of the movement functions in order to get the appropriate shift selection behavior from them: ;; (source: http://emacs.stackexchange.com/a/22166/93) (defun my-mark-current-line () (interactive) (beginning-of-line) ...


7

C-h v mark-ring C-h v global-mark-ring A ring is an elisp data structure. It can be created by make-ring function and assigned to any variable. Each buffer remembers previous locations of the mark, in the “mark ring”. That “mark ring” is an elisp variable mark-ring that is a buffer local variable(each buffer has its own value of that variable). ...


7

With regard to indirect buffers mentioned in the accepted answer... M-x clone-indirect-buffer will create an indirect buffer for the current buffer. The name of the new buffer will have '<2>' added to it (or a greater number if you've already got duplicate buffer names). The new buffer is opened in a new window. You can switch back to a single window ...


6

(Your question is pretty open-ended, so it might get closed as being primarily opinion-based.) What I use: Icicles multi-command icicle-goto-marker (bound to C-- C-SPC) to trip around the marks in any buffer (mark-ring), and icicle-goto-global-marker (C-- C-x C-SPC) to trip among the global marks (global-mark-ring). The lines of text where the markers are ...


6

From pop-mark's documentation: ...This does not move point in the buffer I think you want: ;; do some stuff (goto-char (mark)) (pop-mark) But if all you care about is returning to a previous location, and not actually using the mark ring, then you could either 1) save (point) in a variable and return to it 2) use save-excursion which does this for you


5

You should pose only one question per question here. For your first question: *What are the differences between the mark-ring and the global-mark-ring: This is answered very well in the Emacs manual, nodes Mark Ring and Global Mark Ring. You really owe it to yourself to learn to ask Emacs: C-h r is your starting point. From node Global Mark Ring: In ...


4

For the past 20 years or so, I've been using these two gems: (defun ska-point-to-register () "Store cursorposition _fast_ in a register. Use ska-jump-to-register to jump back to the stored position." (interactive) (point-to-register 8)) (defun ska-jump-to-register () "Switches between current cursorposition and position that was stored with ska-...


4

Save the mark as a marker: (setq my-var (mark-marker)) Then: (goto-char my-var) This works regardless of the buffer where you set the variable to the marker: (let ((buf (marker-buffer foo))) (switch-to-buffer buf)(goto-char foo)) Or if you want to go to that place temporarily, in Lisp code (i.e., without switching to that buffer): (with-current-...


4

It's possible, and in fact it's dead simple, as long as you're okay with where mark already is. There's no pre-existing command for it, but you could use this: (defun my/activate-region-only () "Activate the region without changing the mark ring." (interactive) (setq mark-active t)) If you want to set the mark without adding it to the mark ring, you ...


3

The helm package offer the M-x helm-all-mark-rings and M-x helm-mark-ring to interactively browse the mark-ring (the first show both global and local mark-ring when the latter show only the local one)


3

if you use evil-mode, the vim layer, then C-o and C-i will work the same. They run the commands evil-jump-backward / forward. C-o jumps to the older position in the jump list, which is set automatically (marks are set on motion commands). C-i goes in reverse. We can also use TAB after a C-o instead of C-i. So using both functions will take you back and ...


3

There's a built-in package hilit-chg which tracks and highlights the changes applied to a buffer. I disable its highlight and but just use as a change-tracker. The mode automatically put text-properties to mark the modified regions of a buffer, so I implement an anything (precedent of helm) source for myself, that collects the regions marked by hilit-chg. ...


3

If you use Icicles then you can use C-SPC to go to any marker, choosing it using completion against the text of its line. With no prefix arg or a positive prefix arg C-SPC is just set-mark-command, as usual in Emacs (set the mark). C-0 C-SPC (prefix arg 0) invokes command icicle-goto-any-marker, which lets you choose any marker in any buffer. C-- C-SPC (...


2

If you use Icicles then you can quickly navigate among the markers in the mark-ring of each buffer or the global-mark-ring (which has a single marker in each buffer). You do this using multi-command C-- C-SPC (for a buffer's mark-ring) or C-- C-x C-SPC (for the global-mark-ring). After hitting the key once, you use the usual Icicles cycling keys etc., to ...


2

The goto-char function works. It will teleport you to the mark in the same buffer. (goto-char (mark))


2

A minimimal but often helpful possibility - when you just want to peek the other function - is setting (setq scroll-preserve-screen-position t) which brings you back to your exact starting cursor position when switching between C-v and M-v.


2

You can call xref-find-definitions programatically by (xref-find-definitions (symbol-name (symbol-at-point))) or if you want to be prompted for an identifier (funcall-interactively #'xref-find-definitions (xref--read-identifier "Find definitions of: "))


1

The Elisp manual, node Rings, tells you about rings in Emacs. It starts off with a description: A ring is a fixed-size data structure that supports insertion, deletion, rotation, and modulo-indexed reference and traversal. An efficient ring data structure is implemented by the ring package. It provides the functions listed in this section. Note that several ...


1

(defun my-mouse-1 (event) "..." (interactive "e") (mouse-set-point event) (push-mark)) (global-set-key (kbd "<mouse-1>") 'my-mouse-1) (Not that I really recommend doing this. You won't be able to take advantage of double and triple clicking mouse-1.)


1

If you can choose among markers in all buffers then you need to be able to choose one, and that means identifying the buffer and the marker in it that you want. That is, I believe, the answer to your question of why it is so difficult to navigate among all such markers. If you use Icicles then you can use command icicle-goto-any-marker, bound by default to ...


1

Put this in your .emacs (setq helm-follow-mode-persistent t) and whenever you enter helm-imenu or helm-mark-ring, press C-<up> or C-<down> to follow to that line in helm.


Only top voted, non community-wiki answers of a minimum length are eligible