Skip to main content
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
6 votes

Replacing buffer content without losing point

If you're using emacs 26 or newer, replace-buffer-contents might be what you're looking for. The documentation states: (replace-buffer-contents SOURCE) Replace accessible portion of current ...
jpi's user avatar
  • 116
6 votes
Accepted

Making a region without point

(You say "a region", not "the region", so a guess is that you do not really mean the Emacs region.) If your question is really about the Emacs region then the answer is no. Point (the cursor position)...
Drew's user avatar
  • 78k
4 votes

save-excursion does not work with `org-sort-entries`

This post provides a work-around, but not an answer to "why does save-excursion not work here?" The problem is interesting. I find org internals to be baroque, and a skim through the source code for ...
Dan's user avatar
  • 33.2k
4 votes

Quick jump to a specific line of a file

If you added a trailing colon to each line like so: /folder/subfolder/file.xml:435: Then enabling M-x compilation-minor-mode will have the desired outcome, such that you can type RET or use mouse-1 ...
phils's user avatar
  • 51.7k
4 votes

Quick jump to a specific line of a file

You can add this functionality to find-file-at-point with the following elisp snippet in your init file. Please be aware that this method does not take into account that /folder/subfolder/file.xml:...
Tobias's user avatar
  • 33.3k
3 votes
Accepted

Replacing buffer content without losing point

You can restore point with (let ((old-point (point))) (erase-buffer) (insert text) (goto-char old-point)) I use atomic-chrome as well. If you want the new behavior in your init file, you can ...
xuchunyang's user avatar
  • 14.6k
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, ...
Stefan's user avatar
  • 26.5k
3 votes
Accepted

Weird (point) and (point-max) values in IELM

IELM allows you to set another the current buffer, take a look at your Mode Line to see which buffer your IELM is running on, I guess you changed the current buffer. You can change it back with C-c C-...
xuchunyang's user avatar
  • 14.6k
3 votes
Accepted

Help Buffer on Hover Possible?

For years I've used the rgr/context-help solution from the EmacsWiki for this, with some slight tweaks. A few aspects still bothered me, though, so this question inspired me to write a new variant of ...
phils's user avatar
  • 51.7k
3 votes

Mouse pointer between characters and the text cursor misplacement

I suggest you file this as a bug or a feature request with M-x report-emacs-bug. It can probably be fixed to some extent in Elisp by tweaking mouse-set-point as Vladimir suggested: this function ...
Stefan's user avatar
  • 26.5k
3 votes

Storing previous cursor positions

You are describing a use case of bookmarks. For example, have a look at the visual bookmark package at https://github.com/joodland/bm. You get functions to toggle bookmarks at point and move back and ...
Heikki's user avatar
  • 3,076
3 votes

Storing previous cursor positions

The simplest option, although it does not keep positions in a ring, is to save positions to registers. The docstring for the command point-to-register: It is bound to C-x r SPC, C-x r C-SPC, C-x r ...
Dan's user avatar
  • 33.2k
3 votes
Accepted

Store the cursor position relative to surrounding text, make edits, then insert text at the stored location

From your description, you don't want to return to a particular buffer position. You want to return to a particular text position, that is, a position in context, a position relative to the text ...
Drew's user avatar
  • 78k
3 votes
Accepted

Put the cursor in the center of the screen in emacs

By default in Emacs, the M-r key is bound to move-to-window-line-top-bottom which, I think, does what you want. It jumps to the beginning of the center line of the current window. If you invoke it ...
Tristan Riehs's user avatar
2 votes

Keep point position between re-opening files with recentf/ido

Seems that I used deprecated way for activating minor mode (this works across Emacs 21-24): (setq-default save-place t) (require 'saveplace) Today way to activate this minor mode is: (save-place-...
gavenkoa's user avatar
  • 3,462
2 votes

Replacing buffer content without losing point

You can use compare-strings to find the shared prefix of the before&after strings. Then you can use compare-strings again but on the reverse of those strings to find the shared suffix. Then only ...
Stefan's user avatar
  • 26.5k
2 votes

Quick jump to a specific line of a file

I think you can just use the go-to line function in emacs. below is its brief help doc: goto-line is an interactive compiled Lisp function in ‘simple.el’. It is bound to s-l, M-g g, M-g M-g, . (...
lhstat's user avatar
  • 65
2 votes

Is arbitrary buffer position at the beginning of a line?

You can also use the function bolp: bolp is a built-in function in `../editfns.c'. (bolp) Return t if point is at the beginning of a line. This function does not change global ...
xuchunyang's user avatar
  • 14.6k
2 votes
Accepted

Catch invalid calc expression

As it says in the documentation of calc-eval, Return value will either be the formatted result in string form, or a list containing a character position and an error message in string form. So ...
Gilles 'SO- stop being evil''s user avatar
2 votes

Accessing the character in the line below

(defun char-below () (let ((col (current-column))) (save-excursion (if (not (zerop (forward-line 1))) nil (move-to-column col) (and (not (eolp)) (char-after)))))...
Drew's user avatar
  • 78k
2 votes
Accepted

Accessing the character in the line below

Maybe something like this? I haven't tested it with tabs though... (defun char-below () (setq temporary-goal-column nil) (ignore-errors (save-excursion (next-line) (string (...
Erik Sjöstrand's user avatar
2 votes

How to get line number for a given buffer position in a performant way?

For a faster method to get line number at position -- (with-current-buffer BUFFER (goto-char POSITION) (string-to-number (format-mode-line "%l"))) -- see the following thread, which cites some ...
lawlist's user avatar
  • 19.2k
2 votes

Show me where cursor is

You can use Crosshairs Highlighting (crosshairs.el) to highlight point using crosshairs. Command crosshairs does this (there are other, related commands). But if you want to have crosshairs show up ...
Drew's user avatar
  • 78k
2 votes
Accepted

Show me where cursor is

I personally use beacon mode. Whenever the window or frame gets focus, or the point changes position, the point is momentarily highlighted with a color gradient background of your choice.
Juancho's user avatar
  • 5,465
2 votes
Accepted

How to move point to an invisible line (to access an org property when heading is folded)?

You should check out the Using the Property API section of the manual. In particular, doing (org-entry-get (point) "SCHEDULED") with point at the beginning of the headline returns the scheduled date ...
NickD's user avatar
  • 31k
2 votes
Accepted

Select to the sentence of line in a shortcut

Command mark-end-of-sentence does what you request. It's not bound to a key by default, but you can bind it to one. C-h f mark-end-of-sentence tells you: mark-end-of-sentence is an interactive ...
Drew's user avatar
  • 78k
2 votes

How to memorise the cursor position and return to it?

Yes, C-SPC calls set-mark-command, which pushes the current location of point onto a stack. If called with a prefix argument (C-u C-SPC) it pops the stack and returns point to the popped location. A ...
db48x's user avatar
  • 18.4k
2 votes

How to check if point moved or is on a different line in a buffer since the last user command?

You say: "post-command-hook triggers after every command, not just user-invoked commands." And in comments you say that by "user-invoked" you really mean invoked interactively. It'...
Drew's user avatar
  • 78k
2 votes
Accepted

How to get a character's face if one cannot move point to it?

There’s no universal method (though perhaps there ought to be, perhaps based on the mouse cursor rather than moving point), but you can definitely find out for the mode line. Just run (format-mode-...
db48x's user avatar
  • 18.4k

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