Questions tagged [selection]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
4 answers
116 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?
0 votes
0 answers
23 views

Copying text from 'emacs -nw' with split windows to gui apps

I often need to select text from the terminal running Emacs in no window mode, with split windows. But the selection is not aware of the window boundaries, so the whole line across both windows get ...
  • 1,456
0 votes
0 answers
13 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. ...
  • 1,414
5 votes
1 answer
205 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 ...
  • 165
1 vote
1 answer
85 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
36 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 ...
0 votes
2 answers
141 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 ...
  • 7,441
7 votes
1 answer
233 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 ...
  • 7,441
1 vote
1 answer
47 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 ...
4 votes
2 answers
240 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 ...
  • 1,069
5 votes
1 answer
246 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 ...
  • 469
0 votes
1 answer
58 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-...
  • 308
2 votes
2 answers
201 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
533 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'...
  • 499
1 vote
1 answer
288 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 ...
  • 3,997
2 votes
1 answer
78 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.
  • 1,001
0 votes
0 answers
64 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.
user avatar
5 votes
3 answers
392 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 ...
  • 151
0 votes
1 answer
207 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 ...
0 votes
2 answers
162 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?
  • 1,001
0 votes
2 answers
369 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,111
0 votes
1 answer
42 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 ...
1 vote
2 answers
359 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 ...
  • 7,441
1 vote
0 answers
96 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 ...
  • 1,001
2 votes
0 answers
49 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 ...
  • 1,001
2 votes
2 answers
164 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?...
  • 101
9 votes
2 answers
715 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 ...
  • 567
7 votes
3 answers
4k 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 ...
  • 1,429
8 votes
3 answers
729 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 ...
  • 1,282