Questions tagged [text-editing]

Questions about editing or manipulating text inside of Emacs.

Filter by
Sorted by
Tagged with
1
vote
1answer
15 views

Which setting controls the replacing of selection with the character we type?

When wanting to replace a region of text with another, I usually mark them with C-SPC (set-mark-command), press some arrow/movement keys, then type the text that I want. To illustrate: I like biscuits....
1
vote
3answers
84 views

How copy current line to the clipboard?

This Emacs Wiki page says: ‘C-a C-SPC C-e M-w’ copies the current line without the newline. But it doesn't work to me. I'm using Emacs 26. Is there some other shortcut? P.S. I use CUA keys in my ...
0
votes
1answer
38 views

How can I insert some multiline text that respects the indentation at which it is inserted?

I have a function that reads a link from the clipboard and generates a metadata-ful markdown link from it, and inserts it: (defun night/unt () (interactive) (let* ((link (current-kill 0)) ...
3
votes
1answer
31 views

Centering within comment blocks or ASCII art

I have C comments like this: /****************************************************************************** * Includes * ***********...
0
votes
1answer
24 views

File within a root grandparent is detected by emacs as belonging to a directory that doesn't exists

I'm editing a file within a directory /parentdir/userdir/file with the following permissions: $ sudo namei -l $(pwd) drwxr-xr-x root root / drwx------ root root parentdir drwx--S--- ...
4
votes
1answer
53 views

how to do simple calculations on numbers in text

I have a Json file containing a quite a few coordinates like {x: 400, y:200} And I want to change the numbers for the y values in something like y:y_default + 120. (y_default = 80). Is there a quick ...
1
vote
1answer
46 views

How to enter overlined characters?

Example: R̅E̅S̅ What I already tried, to no avail: Type R, followed by C-x 8 RET OVERLINE RET What works but is not nice: Copy the example above and edit it.
1
vote
1answer
23 views

Add a border around the region by inserting a given character

There's here, for example, given text: WASP-41b 0.94 1.18 3.052404 0.04 1244 transit 590 0.93 5545 WASP-42b 0.527 1.122 4.9816819 0.0561 ...
1
vote
1answer
90 views

org — preserve white space on export to odt

i write poetic texts in org mode and i'd like to be able to export them to odt with their horizontal spacing preserved if possible. it's poetry but not of the traditional kind. text is often heavily ...
0
votes
1answer
88 views

orgmode: underscore automatically generates math-mode

When I type an underscore _ in org-mode, it automatically generates math mode, i.e. $_{}$ and it puts the cursor between the braces. Is there a way to disable this when in edit mode but not in math ...
0
votes
0answers
31 views

Emacs text-mode as generic, 2-space-<TAB>, plaintext editor: Trouble disabling relative-indent in text-mode, or auto-triggering outline-mode

I need some help getting custom indentation behavior with my .emacs config. In emacs text-mode / Fundamental Mode, by default a tab will take me to the location of the top line's next word (non ...
2
votes
1answer
53 views

Query replace regexp with a distant match?

I have a single transcript file for a set of course lectures I am watching. After doing some formatting on the file. I have it broken up into sets of lessons where the main heading is the lesson title ...
0
votes
0answers
10 views

How to read files with vt100 markup

One very pedestrian way to do this is to M-x term cat file ; exit But this does not show me the entire document.
0
votes
1answer
29 views

Insert aligned multi-line text in current buffer regardless of position?

I'm creating a function to easily insert ditaa boxes while drafting reports in org-mode. I have the meat of the function accomplished, but not sure how to implement it so that boxes can be inserted ...
0
votes
1answer
86 views

need help with very complex find and replace

I have a very complex (at least to my mind) text replacement task. ideally this would be a function or macro I could run over every org header in a buffer. I want to 1. move over any TODO state to a ...
0
votes
0answers
15 views

How to remove all console.logs() from the buffer and also how to comment all console.logs from the buffer?

When I do a regex-replace and replace with the empty string, the console.logs() are removed but the empty lines still remain. How would I remove these empty lines? Furthermore, how would I replace all ...
0
votes
2answers
50 views

how to convert 4 lines block text to 1 line space interrupted

I have a text file (name, surname, phone number) than I would import in excel and the play with column (name, surname...) The file was previously a docx file. I've converted it on as a text file. But ...
1
vote
1answer
32 views

Insert White-space to Right to Even Out Region

Lets say I have the following block of text: ---- ## ---- ## ---- There is no white space after the # character. Is there some command to insert white space to the right of lines to even them with ...
1
vote
1answer
60 views

How to sort comma separated (or otherwise) text?

Suppose I have the following text: int z; int a; int c; int g; or the following text: z, a, c, g How can I sort them to: int a; int c; int g; int z; and a, c, g, z respectively?
0
votes
1answer
37 views

`Alt-f` or `Alt-b` then `d` deletes the forward word rather than putting character 'd' in front of the word. Why does emacs behave in this way?

I was doing some editing in Emacs. I was using Alt-f and Alt-b to traverse by word. I wanted to add the character d in front of a word. So I pressed Alt-b to get to the front of the word and then ...
4
votes
1answer
64 views

How to replace the buffer without slowing down the undo system?

Say I have a command that operates on the entire buffer. The simple solution is to: Run the command taking the entire buffer as input. Store the output. Clear the current buffer. Insert the new ...
0
votes
2answers
34 views

Prepend to block of text, but ignore blank lines

How to add the string 'export ' to the beginning of each line of this text, with emacs: RBENV_VERSION="2.n.0" AUTHORIZE_NET_API_LOGIN_ID=example AUTHORIZE_NET_TRANSACTION_KEY=example # Google ...
0
votes
0answers
17 views

Electric pair delete with text between?

Suppose I have the piece of text (hello world). How can electric pair be made to work such that deleting the opening parenthesis automatically deletes the closing parenthesis? Some examples (the ...
2
votes
2answers
125 views

How to transpose words, keeping the cursor at the same relative location to the word it moves?

When transposing words, the cursor moves to the end of the word, how can the cursor be kept at the same location relative to the word?
0
votes
1answer
44 views

How to transpose words backwards?

Transpose words (M-t) always swaps the word with the next. How can this be performed with the previous word?
1
vote
2answers
44 views

Temporarily restrict editing to whitespace only

Sometimes I make whitespace cleanups to source code. I'd like to be certain that I do not accidentally introduce real code changes (let us assume that the programming language is one where removing ...
3
votes
3answers
67 views

Why multiple-cursor ask me on every line? How avoid this?

emacs 26.1, multiple-cursor https://github.com/magnars/multiple-cursors.el Here my custom Elisp function that add some number(by default 1) to number. (defun increment-number-at-point(number) (...
0
votes
1answer
43 views

Punctuation abbrevs for writing prose, and automatic full stops at the end of line?

I'm a beginner Emacs user, and English isn't my first language so please bear with me. I use Emacs for writing prose, and I need help with punctuation. To put it short, I want to turn this: --hello ...
0
votes
1answer
88 views

Why does emacs not apply some config settings when editing tex files?

I'm facing a rather peculiar situation where my emacs settings seem to be lost every time that I open a .tex file. That's doesn't happen when I'm editing .el or .py files. Heres some examples with ...
1
vote
1answer
48 views

Replace placeholder by incremental value [duplicate]

Windows 10 Emacs 26.1 I has the next text [ { "id": N, "name": "Agent#N", "address": "N Tabernacle St, London EC2A 4DD, UK" }, { "id": N, "name": "Agent#N", "address": "...
1
vote
0answers
78 views

Edit a portion of YAML file (a multi-line string) with a different mode

I'm constantly editing a big yaml file with many multi-line strings, which are BASH scripts. In org-mode I would use something like: #+begin_src sh echo "cool" #+end_src And then just to C-c ' (org-...
3
votes
3answers
156 views

Is it possible to shuffle paragraphs?

I'd like to be able to quickly "shuffle" the order in which all paragraphs in a region occur. Can this be easily accomplished in emacs? For example, consider the following region. Hello world. This ...
1
vote
0answers
28 views

fixed file size mode

Is there an emacs mode/package/whatever where a specific file size (and/or number of lines) is enforced in a visual way? Something like this: 1st line 2nd line where adding some text to the 2nd ...
0
votes
1answer
82 views

smartparens how to stop behaviour of inserting backslash \ before I type a single quote '

I'm in C major mode, editing source files. Whenever I want to type a single quote ' smartparens automatically gives me the following: \'|\' , where | is the cursor position. What I want exactly is ...
1
vote
1answer
45 views

Dual-language text mode using the original interpretation of tabs

Does there exist an Emacs mode that replaces the contemporary interpretation of tabs (move to 8, 16, 24, .. or a multiple of some constant) with their original typewriter interpretation (set stops at ...
3
votes
1answer
163 views

How remove lines which are not equal in two buffers?

Consider the following buffers buffer_1: 11111111 22222222 33333333 44444444 buffer_2: 55555555 66666666 22222222 44444444 I need to remove all lines which are not equal in buffer_1 and buffer_2. ...
7
votes
3answers
98 views

How to blockquote text in one go

With this text: Play with it a few times you will see my point. The command you need is: $ echo hello How do I make it into: > Play with it a few times you will see my point. The > command ...
0
votes
4answers
300 views

Can someone recommend a good text editor for Emacs? [closed]

I'm looking for a good way to edit text within Emacs. Can someone give some good recommendations for text-editors for Emacs.
7
votes
1answer
623 views

How do I delete all blank lines in a buffer? [duplicate]

Emacs 26.1 In buffer 1 2 3 4 I use command "delete-blank-lines". But it NOT delete ALL BLANK LINES. It's delete ONLY ONE BLANK LINE. Why? I need to delete ALL BLANK LINES. The result must be ...
0
votes
1answer
39 views

Stop automatic removal of space before point when inserting `.` (dot)

The following gif shows the behaviour quite nicely: Whenever I type a space followed by a dot (.) in any mode derived from text-mode, emacs will replace the space with the dot. I could not want this ...
2
votes
2answers
159 views

How keep only duplicate lines?

Emacs 26.1. Windows 10 In buffer I has text like this: 3333333 1111111 $PAC_LTC 1337_BTC 1337_LTC 404_BTC 42_BTC 222222 42_LTC 808_ETH 8BIT_BTC ...
0
votes
1answer
166 views

Why after save *Occur* buffer I can't edit editable file? [duplicate]

Emacs 26.1, Windows 10 (64 bit) I open file trace.log. User occur to find text. Save occur buffer to file NXS_ETH.txt. Do some manipulations. See screenshots. But I can't edit EDITABLE file. Here ...
7
votes
3answers
745 views

What is the difference between refill-mode and auto-fill-mode?

I tried to read the documentation, but in practice, I could not tell the difference. I feel they are doing the same thing. I can turn both modes on, but I am not sure in what circumstance I need to do ...
2
votes
2answers
99 views

Result of math. operation - replace math. formula

If I want to do some math. operation I do next: (* 5 3) C-x C-e (eval-last-sexp) Here result: As you can see the result is in the minibuffer. Nice. But I need result to REPLACE math. formula. I ...
4
votes
1answer
67 views

Compose characters

I have some copied text from a pdf which renders like this with my current font: I know I could use a different font that handles Unicode characters better, but I would rather find a function to ...
3
votes
5answers
768 views

How to swap strings in all lines?

Emacs 26.1 I have this text: "ADA-SGD" "ADT-SGD" "ADX-SGD" "AID-SGD" "AMP-SGD" "ANT-SGD" "ARDR-SGD" "ARK-SGD" I want to swap text in all these lines. The result must be like this: "SGD-ADA" "SGD-...
1
vote
0answers
18 views

Why I can't delete first line after save *occur* buffer to separate file? [duplicate]

Windows 10, Emacs 26.1 I have file - file_first.txt: I want to find all line content word hello. So I use occur for this Nice. Now I want to save result to SEPARATE file: file_second.txt To do ...
4
votes
2answers
326 views

Next word prediction

Autocomplete and company completes the word . But is there any package which helps predict the next word expected in the sentence.
0
votes
1answer
48 views

How to combine change `key: foo`, `key: bar`, `key: baz` to `key: foo bar baz`?

To clarify this is what I'd like to do: Text Before: key: foo key: bar key: baz Text After: key: foo bar baz Wondering if anyone has a good technique for this type of operation (simpler the ...
1
vote
0answers
82 views

Align elements of a matrix to the right

I have a matrix in C++ Matrix<double> A = { {31, -13, 0, 0, 0, -10, 0, 0, 0}, {-13, 35, -9, 0, -11, 0, 0, 0, 0}, {0, -9, 31, -10, 0, 0, 0, 0, 0}, {0, 0, -10, 79, -30, 0, 0, 0, -...

1
2 3 4 5