Skip to main content

Questions tagged [selection]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
112 views

How to select a visual block with the mouse

Old Vimmer and wannabe Doom Emacs user here. I'm trying to set up my init.el/custom.el file so that I can select a visual block (a.k.a rectangle or column) in evil mode with my mouse in combination ...
0 votes
2 answers
123 views

How to indent-region with TAB key?

I want to detect if selection made was activated and bind appropriate code for indent-region or ifselection mode was not activate - other code.
0 votes
1 answer
65 views

Why Does The Highlighted Region Go Away?

I want to be able to select multiple lines and move them up and down as a block, while "jumping" over the line in the direction of moving. Here's the code for moving up: (defun on-ctrl-shift-...
0 votes
1 answer
48 views

How to extract markups?

Sorry for the vagueness of the question, I hope the following explanation will be clear enough. I often keep notes of my readings and most of these notes are composed of extracts of these readings. I ...
0 votes
0 answers
51 views

How can I make `fill-paragraph` on selected text respect indentation in AUCTeX?

Using fill-paragraph in AUCTeX normally respects the given indentation. However, if I use fill-paragraph on a selection, only the first line will be indented, the other lines won't. Is there a way to ...
5 votes
4 answers
1k views

How to count the number of characters in the marked (selected) region?

I know how to count the number of words. How to count the number of characters in the marked (selected) region?
1 vote
1 answer
97 views

Strange behaviour using C-<spc> to select multiple lines - first line is skipped if it starts with whitespace

EDIT: The issue wasn't related to whitespace, rather it was my lack of understanding of how region selection works. The selected answer answers the question clearly. I'm basically looking for the same ...
0 votes
1 answer
40 views

Selecting phrases in Emacs rather than words or sentences

Notabene word processor has an interesting command that allows one to select phrases, i.e. one selects text up to the next punctuation mark. Hence, in this example: Lorem ipsum dolor sit amet, ...
1 vote
0 answers
59 views

Could not assert ownership over selection

Every time I select some text, I see the sentence "Could not assert ownership over selection: PRIMARY" in the minibuffer. Everything looks (?) working correctly though. Where it comes from? ...
0 votes
0 answers
118 views

(setq select-enable-primary t) breaks copy/paste in Emacs 28

After I updated Cygwin W32 to v28 selection of text started to copy the value to clipboard. I use selection to replace existing text with one from buffer but now the text is replaced with itself ...
2 votes
1 answer
49 views

Evil keyboard movement extends mouse selection

My Setup Emacs 28.1 Evil version 1.15.0 Gnome 42.4 wayland Observed Behavior In default emacs (GUI), with no init file, if you highlight a region with mouse 1 and then use a keyboard movement, the ...
0 votes
0 answers
20 views

Undo insertion and deletion in one step when undoing overwrite of selection

Undoing the insertion of a character while the region is active (and delete-selection-mode is non-nil) requires two steps: the first to undo the insertion and the second to restore the deleted region. ...
0 votes
2 answers
462 views

How to act on the currently highlighted search result with evil mode?

When using evil mode search, is there a way to act on the currently highlighted search result by... Converting it into a selection. Treating it as a text object. Having the ability to specify the end ...
5 votes
1 answer
295 views

Highlight rectangle and non-rectangle selection at the same time

By default, Emacs highlights the non-rectangular selection; alternatively, you can use (rectangle-mark-mode) to show the rectangular selection. Instead, I'd like to always show both, by highlighting ...
1 vote
1 answer
169 views

How to select and replace the content of all specific org-headings?

I am trying to select each content-heading extracted with org-noter and then remove all erroneous newlines. This is my function. (defun sanitize-noter-import () "Sanitizes org-noter imports. ...
0 votes
0 answers
115 views

xterm-mouse-mode inserting cursor information on drag

I'm running into a problem with emacs used via ssh. The problem occurs when I: Log in remotely using SSH on Konsole Run emacs -Q Invoke mouse mode with M-x xterm-mouse-mode When I click-and-drag on ...
7 votes
1 answer
440 views

Is there a convenient way to swap two words that aren't adjacent?

I've recently been editing some source code where I often want to swap elements in an array that spans multiple lines. Doing this manually is quite tedious, moving the cursor between both locations ...
1 vote
1 answer
74 views

Replace selection in one movement

I'm getting started using spacemacs with vim bindings for editing and one thing I would like to do sometimes is replace some text with some other text. For example I might have k x = (1 + 1) * x and ...
1 vote
2 answers
489 views

How to evaluate the selection through Python and replace the selection with it's result?

Being more familiar with Python then elisp, I'd like to evaluate the selection as as Python snipped - as a short-cut to opening a calculator or Python prompt and copy-pasting between them. Is there a ...
10 votes
3 answers
1k views

Use avy to select distant word or line and paste at point

Is there a way to use avy or a similar in-buffer selection tool to quickly select a word or line to paste at the current point? For the following buffer an example workflow for proposed functionality ...
4 votes
2 answers
339 views

Selecting punctuation, namely, periods, commas, question marks, exclamations, etc. in Emacs

I use Emacs mostly for writing text not code. This involves a great deal of selecting, deleting and editing, as one would expect. By default if I move forward by a word in Emacs, Emacs ignores basic ...
5 votes
1 answer
342 views

Select a word in a PDF by double-clicking on it (with pdf-tools)

I use pdf-tools in Emacs to view PDF documents. I would like to be able to select words (mark their region and then copy them to the kill-ring) in the PDF by double-clicking on them. Is there a ...
0 votes
1 answer
65 views

How can I fix shift-select-mode with own syntax-table

So I have modified syntax table for moving with C-<left>. (defvar my-wacky-syntax-table (let ((table (make-syntax-table))) (modify-syntax-entry ?\( "w" table) (modify-...
2 votes
2 answers
294 views

Select region between empty lines

If I use (thing-at-point 'paragraph) (or mark-paragraph, for that matter), the selection isn't necessarily aware only about the empty lines. Especially, with lists and code blocks in org-mode. So, I ...
2 votes
2 answers
731 views

How to run selected bash commands

I have a large bash script and I need to rerun certain lines of code. Normally I would comment out any line I don't want to run and then execute the file on the shell. But that is rather cumbersome. I'...
1 vote
1 answer
370 views

Identify buffer by part of its name

Is there a way to select a buffer by part of its name using elisp? For instance, the ag package may create a buffer called *ag search text:MyPtyhonClass dir:c:/projects/my_module/* or the realgud ...
5 votes
3 answers
551 views

How to select (and highlight) non-consecutive blocks? [duplicate]

The title says it all. I'm looking for a C- or M- built-in way to select non-consecutive lines and blocks of text, like usual consecutive lines with Shift or C-SPC. I.e. I need a switch that turn ...
2 votes
2 answers
198 views

How can I define a key to cancel selection only when I selecting something?

How can I define a key to cancel selection only when I'm selecting something? Because I use this key to do other thing in global-mode-map.. Is there any specific mode for mark and selecting something?...
0 votes
1 answer
261 views

auto-insert mode switch to new file

I managed to insert a template to certain sripts with autocomplete. Example: (auto-insert-mode) (setq auto-insert-query nil) (setq auto-insert-alist '(((ess-mode . "R script") nil "# R ...
5 votes
1 answer
162 views

How to select last pasted text

How can I select the last pasted text with regular Emacs? I would like to do the same thing as this Q&A, but I don't use evil mode.
0 votes
0 answers
73 views

C-S-a doesn't select text to the line beginning

The Key combination Ctrl + Shift + a doesn't work in my GUI-Emacs to select a region from the position of pointer to the line start. Doing C-h k and the above key combination shows no documentation.
9 votes
3 answers
6k views

How to select (and copy) a column of an org table *without* rectangle selection?

It seems to me that the normal way to copy a column of an org table is by rectangle selection (see here). That is, first the column is selected by marking all of it by hand, and then it is copied with ...
0 votes
2 answers
203 views

Function to highlight timestamp generated from org-time-stamp

We can create a timestamp (e.g., <2018-01-11 Thu>) by C-c . which runs the command org-time-stamp. How can we highlight (i.e., create a region) the whole timestamp when the cursor is on it?
0 votes
1 answer
49 views

How can I constrain a predefined replacement-function to selected text?

When using replace-string from the M-x while having some text selected, it only operates on that selection (specifically, on an Evil visual selection, in my case). However, if I put the same ...
0 votes
2 answers
526 views

How to save the text selection and keep the selection highlight

In Emacs 25 how can I save the text selection and keep the selection highlighting when using Transient Mark mode? If I use kill-ring-save, the highlighting is switched off and I have to switch it on ...
1 vote
0 answers
105 views

Make `insert` follow `(delete-selection-mode t)`

When I call helm-copy-to-buffer (which calls insert) with active region in my current buffer, the marked helm candidate is added after the active region. But I expect the active region to be replaced ...
9 votes
2 answers
878 views

Selecting (i.e., as the region) the current match in incremental search

When searching for a string with C-s, I want to be able to hit some key to exit search mode but still maintain the selection of the match. That way I can immediately start typing and replace the last ...
2 votes
0 answers
64 views

How to pre-select helm's pre-input?

In many other softwares (e.g., Chrome), when we initiate word search by Ctrl-F, the pre-input is pre-selected so that we can replace it by simply typing a new keyword, or append a new string to it by ...