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

Unable to change cursor type in terminal

On a terminal, you can't change the shape of cursor. From the Emacs manual: On a text terminal, the cursor’s appearance is controlled by the terminal, largely out of the control of Emacs. Some ...
goedson's user avatar
  • 173
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

How do I move the cursor in helm?

You can use the standard Emacs commands C-f and C-b for forward and backward char. It's convenient to learn those, as you can also navigate canditates with C-n and C-p. You can also use C-l to go up ...
Daniel's user avatar
  • 3,653
5 votes
Accepted

Is it possible to wrap a small package not listed on MELPA/ELPA via use-package? How to do it?

Yes, it is possible to use use-package, and it will be less verbose than including the entire snippet. You will need to basically add the centeredpoint.el file to Emacs load-path. One option is to ...
Swarnendu Biswas's user avatar
4 votes

Can cursor jump back to the previous position?

For users of Doom Emacs (or evil users in general) vim functionality 'jump lists' is implemented and bound to C-i and C-o for O[ut] and I[n] - or backwards from drill down jumps and inwards Your could ...
Nefedov Efim's user avatar
4 votes
Accepted

Cursor colour based on input method

That's exactly what you get with library cursor-chg.el. Just turn on minor mode change-cursor-mode, and leave option curchg-change-cursor-on-input-method-flag with its default value of t. The cursor ...
Drew's user avatar
  • 78k
4 votes

How do I keep the cursor from going to the beginning of the line when there's no text on said line?

You can try quarter-plane-mode (available from GNU ELPA), but beware. Emacs's underlying engine is basically unable to do what you want; it can only place cursor where there is some text), so the ...
Stefan's user avatar
  • 26.5k
4 votes
Accepted

Make Emacs keep empty rectangle for cursor even when buffer is selected

Set or customize the cursor-type to hollow. (setq cursor-type 'hollow) Or you might prefer to set it to any of the other options.
dalanicolai's user avatar
  • 7,880
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....
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

kill the current line and preserving cursor position

Here's a version that does what you want. Just bind it to a key. (defun xah-cut-line-or-region () "Cut current line, or text selection. When `universal-argument' is called first, cut whole buffer (...
Xah Lee's user avatar
  • 1,766
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
Accepted

Using ggtags tag lookup along with centered-cursor-mode

This worked. (add-hook 'ggtags-find-tag-hook #'ccm-position-cursor)
SFbay007's user avatar
  • 584
3 votes
Accepted

How can I make the cursor change to block in overwrite mode?

Rather than define a new command that you bind to the same key, you'll be better off using the minor mode's hook: (add-hook 'overwrite-mode-hook (lambda () (setq cursor-type (if ...
Stefan's user avatar
  • 26.5k
3 votes
Accepted

How to scroll using mouse while keeping cursor on same line/position?

If you add the built-in scroll-lock-mode to your code, you should get behavior like what you want. Here's a slightly more-expansive update to your mode that fixes two other issues I found (the buffer-...
jirassimok's user avatar
3 votes
Accepted

Cannot change cursor type on Windows 10

Found the answer on stackoverflow. ;; Disable the system cursor caused by screen reader etc. (setq w32-use-visible-system-caret nil) Helps to know that you need to search for "caret" instead of "...
Kevin Wright's user avatar
3 votes
Accepted

How to make a thin red cursor

Since cursor-type is a buffer-local variable, if you use setf (or setq) you only change its value in the temporary buffer used while reading the init file (ref.). When a variable's doc string says &...
Arch Stanton's user avatar
  • 1,707
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

Can cursor jump back to the previous position?

You can use `Registers'. From emacs info file 13.1 Saving Positions in Registers C-x r <SPC> R' Record the position of point and the current buffer in register R (point-to-register')...
joe's user avatar
  • 37
2 votes

Keybinding conditional on cursor location?

Another method is to use menu-item: (defun my-at-beg-of-line () (interactive) (message "Only at beg of line")) (global-set-key [home] '(menu-item "" nil :filter (lambda ...
clemera's user avatar
  • 3,486
2 votes

Can't remove cursor blinking in console mode

This is an old question but I ran to this issue just today, in Debian 10. Terminals used are Konsole in Debian on the metal and wsltty in WSL. For me setting visible-cursor variable to nil worked. The ...
anssi's user avatar
  • 51
2 votes

Emacs cursor color is different in daemon and non-daemon modes

The hypothesis The problem should come from Xressources. The Xressources are set via xrdb calls. The user-space place to store Xressources settings is ~/.Xressources (that usually are read and ...
Tormen's user avatar
  • 21
2 votes

Can cursor jump back to the previous position?

For me it was much easier than current answers describe it. Most of Emacs Lisp functions (like goto-line, lsp-find-implementation or isearch, counsel-search), that significantly modify the cursor ...
Viaceslavus's user avatar
2 votes
Accepted

Move the cursor backwards to the end of the 1st word on it's between 2 words

You could call forward-whitespace with a negative prefix argument. You can bind this to a key with a lambda. For example, bind it to M-B: (global-set-key (kbd "M-B") (lambda () (interactive) (forward-...
glucas's user avatar
  • 20.7k
2 votes

Move the cursor backwards to the end of the 1st word on it's between 2 words

You could move cursor to the beginning of the first word with M-b (backward-word) and then move forward with M-f (forward-word), which place cursor after the end of the first word. For example (* ...
Konstantin Morenko's user avatar
2 votes
Accepted

How can I highlight cursor or line in unselected frames?

global-hl-line-mode, from standard library hl-line.el highlights the current line. If option global-hl-line-sticky-flag is non-nil then it does this in all windows. Library crosshairs.el (see ...
Drew's user avatar
  • 78k
2 votes

Skip vertical whitespace/non-whitespace blocks (sort of vertical M-f / M-b)

Here's another approach. (defun my-down () (interactive) (when (eq this-command last-command) (line-move-visual 1)) (while (not (looking-at "[[:digit:]]")) (line-move-visual 1))) (defun my-up (...
Drew's user avatar
  • 78k
2 votes

Save place in files but don't move the cursor to the saved position automatically

I have written something that after some quick testing seems to be working. save-place-mode does the automatic restoring of the cursor position by adding save-place-find-file-hook – which takes the ...
Arch Stanton's user avatar
  • 1,707

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