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 ...
19
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.
12
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 ...
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 ...
9
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,...
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-...
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 ...
6
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 ...
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))
...
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.
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♦
- 33.4k
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))
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-...
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:
(...
4
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 ...
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 ...
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 *...
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 ...
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 ...
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-...
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 ...
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....
3
votes
Moving cursor to the middle of the line where it currently is
While this doesn't directly answer your question (I think Amot already covered that part just fine), I'll just point out that many Emacs users solve these kinds of problems by navigating with C-s, i.e....
3
votes
Accepted
Navigating lisp
Please check out Moving in the Parenthesis Structure, specifically:
C-M-f, which runs the command forward-sexp
C-M-b, which runs the command backward-sexp
C-M-d, which runs the command down-list
To ...
3
votes
Accepted
How to make end-of-buffer move to the last line not beyond it?
The command end-of-buffer uses a variation on (goto-char (point-max)) to go to the last position in the buffer. If the buffer ends with a newline, end-of-buffer will leave you on the empty line at the ...
3
votes
Accepted
Point motion strategy for Emacs 25 and older
The two systems work in fundamentally different ways, so you can't easily have a 100% solution that unifies the two, but your approach looks OK. The only thing I'd recommend is to do the emulation ...
3
votes
Accepted
Finding Like Variables or Functions
Different modes (e.g. languages) have different notions of variables and functions, so finding them can be mode-specific.
A general answer, which lets you move forward among occurrences of the name ...
3
votes
Emacs point(cursor) movement lag
I'm not absolutely sure what is the problem, but your profiler report seems to indicate that posn-at-point performs more redisplay than expected, which in turns causes recomputation of the mode-line, ...
3
votes
is there a keybinding to save curor position for returning after viewing other section of same buffer?
Whenever I make a large jump in a file, I press C-SPC C-SPC first. That sets the mark to the current value of point*, effectively remembering the current cursor position. Then, once I'm done ...
3
votes
Accepted
How to tell Occur to show the line in the top of the buffer
You can scroll the window in occur-mode-find-occurrence-hook such that point is at the top of the window:
(defun my-occur-recenter ()
"Scroll point to the top of the window."
(recenter 0))
(add-...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
motion × 145evil × 17
key-bindings × 16
cursor × 12
org-mode × 11
buffers × 7
search × 6
navigation × 6
point × 6
spacemacs × 5
commands × 5
scrolling × 5
sexp × 5
region × 4
sentences × 4
hooks × 3
comment × 3
newlines × 3
words × 3
window-point × 3
elisp × 2
dired × 2
window × 2
functions × 2
highlighting × 2