28 votes
Accepted

Emacs point(cursor) movement lag

I have found an answer to my question through narrowing down the naughty bit and googling. I have managed to reduce the lag 10 TIMES!!!! I mean....It is insane on how much computing power next-line ...
Damian Chrzanowski's user avatar
18 votes

Find position in file by character number

Depending on what is that number, e.g., 47 (line, character-position, etc) you can do M-x goto-line 47 or M-x-goto-char 47.
Name's user avatar
  • 7,869
11 votes

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

This was a pretty cool question, I learned a lot that I didn't know while trying to figure this out. What I learned was that each window has its own value for point. This is important because it means ...
Jules's user avatar
  • 1,225
11 votes

What is the correct way skip to prev/next method/function definition?

Use C-M-a (beginning-of-defun) to move backward before each "defun" (top-level sexp). Use C-M-e (end-of-defun) to move forward after each "defun". To move across several by repeating, just hold down ...
Drew's user avatar
  • 77.6k
10 votes
Accepted

org: move point to beginning of an item

Consider to customize variable org-special-ctrl-a/e. Possibly that will ease your flow. From the documentation. Note in particular the "item" part. When t, ‘C-a’ will bring back the cursor to ...
Marco Wahl's user avatar
  • 2,876
9 votes
Accepted

Move to the beginning of a heading smartly in Org-mode

This is supported right out-of-the-box, by setting: (setq org-special-ctrl-a/e t) As a bonus C-e handles tags similarly to C-a handling asterisks.
user673592's user avatar
9 votes

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

M-C-f (or M-C-right) bound to forward-sexp should do that. I suggest you try all well-known motion commands with the prefix M-C- instead of C-. M-C-b (or M-C-left) gives backward-sexp M-C-u (or M-C-...
Tobias's user avatar
  • 33.2k
8 votes
Accepted

Move cursor to beginning of visible text in current buffer

Ah, you're looking to move point to the top or bottom of the window. M-r calls move-to-window-line-top-bottom which cycles through the top/middle/bottom positions. You can also use a prefix argument,...
phils's user avatar
  • 51.3k
7 votes

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

(Jules Tamagnan's answer identifies the problem, I'll expand on it.) Your solutions with save-excursion or save-excursion do in fact work! You can see it by checking the value of (point) in that ...
Gilles 'SO- stop being evil''s user avatar
7 votes
Accepted

Is there a hook I can use to run my function when point moves?

I think post-command-hook is what you wish to use. It is run every time a command has been run. And a command is basically any interactive action, such as clicking a mouse button, typing a letter (...
Harald Hanche-Olsen's user avatar
6 votes

Navigate by indentation

This feature exists in Emacs. Outline mode describes a document as containing heading lines with a level, and has facilities to move among levels. We can define every line as a heading line with a ...
Gilles 'SO- stop being evil''s user avatar
6 votes
Accepted

How to scroll to the beginning of the line in Emacs

The window has been scrolled left (scroll-left) for some reason. C-x < or C-<next> can get you into this state. C-x > or C-<prior> can get you out of this state. Note those commands ...
jue's user avatar
  • 4,576
5 votes
Accepted

Moving cursor to the middle of the line where it currently is

The following function moves the cursor to the middle of the current line: (defun my/move-to-middle () (interactive) (let* ((begin (line-beginning-position)) (end (line-end-position)) ...
Arnot's user avatar
  • 671
5 votes
Accepted

Move cursor left/right while entering isearch

You can run the command isearch-edit-string pressing M-e. See the documentation for details.
matteol's user avatar
  • 2,018
5 votes

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

Here's a quick command, lightly tested, that does what you're looking for. (defun eol-dwim () "Go to the end of the line, ignoring comments and trailing whitespace." (interactive) (let ((bol (...
Dan's user avatar
  • 33k
5 votes

How to calculate a point N lines from another point in elisp?

This can be done using save-excursion, then moving the cursor. (defun point-calc-lines-offset (pt lines) (save-excursion (goto-char pt) (forward-line lines) (point))
ideasman42's user avatar
  • 8,806
5 votes

How do I capitalize the first words of sentences in some buffer text?

(I assume you meant text in a buffer, and not a string (as the original question said). M-e M-c (press and hold Meta while hitting e, then c. The M-e moves forward-sentence. The M-c does capitalize-...
Drew's user avatar
  • 77.6k
5 votes
Accepted

How to move from one source block to another, in Org-mode?

Yes, there is, run M-x org-babel-next-src-block. The default keybindings for this function are C-c C-v C-n and C-c C-v n. See also the subsection Key bindings and Useful Functions in the orgmode ...
fjesser's user avatar
  • 66
5 votes

goto-char support for hexadecimal input

I can't imagine this very basic thing such as input a Lisp expression inside a value input is not possible. It is because there is no need to do that. In Emacs, this behavior can be changed easily: (...
shynur's user avatar
  • 5,308
4 votes

Navigate by indentation

The following three commands, minimally tested, should allow for basic navigation by indented lines. Apologies for the code repetition. (defun ind-forward-sibling () "Move forward to the next ...
Dan's user avatar
  • 33k
4 votes
Accepted

Navigate by indentation

Examining the four answers available currently (two on Super User and two on this question), I see the following issues: The ones on SuperUser by Stefan and Peng Bai (moving line-by-line, looking at ...
ShreevatsaR's user avatar
4 votes
Accepted

How to jump up or down to first non-whitespace character in same column

I use the following : (defun next-line-non-empty-column (arg) "Find next line, on the same column, skipping those that would end up leaving point on a space or newline character." (interactive "p"...
YoungFrog's user avatar
  • 3,526
4 votes

New line in cursor-intangible area and line-beginning position

Applying field property to intangible area solves the problem. Adding of field t to the properties of INTANGIBLE makes move-beginning-of-line putting point between INTANGIBLE and fooooo, like ...
Shmozart's user avatar
4 votes

How to use a menu to jump between sections of a document?

This is exactly what Imenu is for. You can define positions to jump to using a menu. The menu can be in the menu-bar or popup, or you can use completion against it as a popup (e.g. in buffer *...
Drew's user avatar
  • 77.6k
4 votes

Move cursor left/right while entering isearch

@matteol answered your question. Here is some further info about this. During Isearch, keys you press that are defined in isearch-mode-map act according to their bindings there. Keys that are not ...
Drew's user avatar
  • 77.6k
4 votes
Accepted

is there a keybinding to save curor position for returning after viewing other section of same buffer?

@Aaron answered well with the usual way to take care of this in Emacs: set a mark where you are now, then get back to it later using C-u C-SPC. Another way is to use a bookmark, in particular a ...
Drew's user avatar
  • 77.6k
4 votes
Accepted

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

The package mwim offers this functionality. By setting (global-set-key (kbd "C-e") 'mwim-end) you get behavior similar to what you described. The package also offers the corresponding mwim-...
clemera's user avatar
  • 3,471
4 votes
Accepted

Is it possible to ignore paste operation during `C-x C-x` to jump back?

Each command that sets the mark pushes the previous mark onto a stack. More precisely, the previous position is added to the mark ring (the difference between a mark and a ring is that accessing the ...
Gilles 'SO- stop being evil''s user avatar
4 votes

Jump to the end of body of headline

I'm not aware of a function that does this (someone will correct me if there is), but you can write your own by getting the :contents-end property from an org element and going to that buffer location....
kozina-adjacent's user avatar
3 votes

next/prev-imenu-item function

(defun my-imenu-goto--closest-dir (direction) "Jump to the closest imenu item on the current buffer. If direction is 1, jump to next imenu item. If direction is -1, jump to previous imenu item. See ...
AhLeung's user avatar
  • 1,083

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