Questions tagged [motion]

is for moving the cursor around the buffer. Emacs provides key-bindings for alternative ways of moving the cursor interactively: by syntactical elements such as characters and words; by forward and backward searches; by arbitrary lines; by units such as sentences, paragraphs, and s-expressions; and by other methods unique to certain modes.

Useful links:

141 questions
19
votes
5 answers

Stop at beginning of a word on `forward-word`

I often use multiple invocations of forward-word followed by a single backward-word to move point to the beginning of a word on a line. I guess I never got used to the way forward-word differs from vim's w and even after years of using Emacs I…
user2005
15
votes
4 answers

Emacs point(cursor) movement lag

When running previous-line, C-p or the cursor jumps up a line without any issues or lags. When running next-line, C-n or the cursor properly jumps down a line, but with a significant lag. When I hold the down key I can't even see the…
15
votes
3 answers

Navigate by indentation

I want to navigate between the lines of a file based on indentation. The file is structured by indentation: a line that's more indented than the previous line is a child of the previous line, a line that has the same indentation as the previous line…
14
votes
1 answer

Find position in file by character number

When an error occur in compiling a program in Ghostscript, the error message gives a "Current file position is ..." with a number. I use emacs to edit the program file, so I would like to be able easily to find that position in the file (if that is…
Harry Weston
  • 271
  • 2
  • 5
13
votes
1 answer

Why doesn't M-v following C-v move cursor back to the original position?

M-v following C-v doesn't move the cursor back to the original position. Why is that? Can we make it happen?
Tim
  • 4,987
  • 7
  • 31
  • 60
12
votes
2 answers

How to handle next-line in keyboard macro?

I created a keyboard macro to join lines in a buffer using: F3 C-n M-x join-line RET F4. It works fine, except when lines get too long and start to wrap – which makes this macro dependent on the width of the frame. next-line doesn’t seem to go to…
10
votes
3 answers

How to jump to matching (double or single) quote of a quoted string?

When cursor on one quote symbol, how to jump to the pairing quote?
AhLeung
  • 1,083
  • 5
  • 14
9
votes
3 answers

Keep moving to the end of lines

The default of key binding C-a/C-e is only for one thing, move to the beginning/end of the line, is there any package that can make Emacs act like this: If I'm not at the end of a line, C-e will go to the end of the line, otherwise, go the end of…
CodyChan
  • 2,599
  • 1
  • 19
  • 33
9
votes
3 answers

How to persistently move the cursor in a buffer other than the current one?

NB: The post How to move point to the end of another buffer, using `with-current-buffer` and `goto-char`? presumably asks the same question as this one, but the answers given to it do not readily apply to my case here. E.g. those answers involve…
kjo
  • 3,145
  • 14
  • 42
6
votes
2 answers

org: move point to beginning of an item

When in org-mode, how to move point to the beginning of the current item? (in similar fashion like back-to-indentation) Example: Imagine following org buffer content * headline - [ ] Z this is an longer item | (Point) is here. And here is some…
jue
  • 4,476
  • 8
  • 20
6
votes
2 answers

Is there an emacs command to go to end of code line (before line comment and whitespaces start)

say you have that: stuff indented stuff # commented stuff We already got move-beginning-of-line and back-to-indentation for the left side. Now, for the right side... I'd love to know if you are aware of a function that goes at the end of the…
v.oddou
  • 163
  • 5
6
votes
1 answer

Point motion strategy for Emacs 25 and older

I've read What is inhibit-point-motion-hooks?. Assume some minor-mode my-mode that wants to do point-motion-y things. Assume my--point-entered and my--point-left functions that work fine in Emacs < 25, when my-mode sets point-entered and point-left…
Greg Hendershott
  • 1,483
  • 12
  • 17
6
votes
1 answer

backword-sentence and forward-sentence are moving over paragraphs

I use markdown-mode to edit markdown, but it's missing one very useful feature. Whenever I press M-a (backward-sentence) or M-e (forward-sentence) it takes me to the start or end of the paragraph, respectively. I want it to send me to start/end of…
Cristian
  • 233
  • 2
  • 6
6
votes
1 answer

How does previous-line/next-line "know" the column it should move to from the end of the line

When I am on a long line, beyond the end of an adjacent line, if I move up or down to the other line the point will go to end of the line, naturally. Then when I move back to the longer line, it goes to the same position I was originally…
Random832
  • 578
  • 3
  • 11
6
votes
3 answers

In shift selection, retain the mark if it's already active

Under shift-select-mode, cursor keys behave like many other text editing environments: Shift+motion starts selecting (sets and activates the mark, in Emacs terms), and motion without Shift stops selecting (deactivates the mark, in Emacs terms). So…
1
2 3
9 10