Questions tagged [text-editing]

Questions about editing or manipulating text inside of Emacs.

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

How to keep a multi-line nested bullet list indentation (and bullets if possible) when pasting from Google Docs to emacs

I copy a nested list like this: - foo - bar - foo - bar from Google Docs to emacs, but the bullet points vanish and the indentation as well. The same happens in the normal Linux text editor....
1
vote
2answers
38 views

How to warn before editing or saving a buffer whose underlying file no longer exists?

(NB: In this post, I will use expressions like "a buffer's underlying file" to mean, in the Emacs' documentation's terminology, "the file a buffer is visiting", i.e. the value of (...
0
votes
1answer
55 views

How to make backward-kill-word and kill-word stop after it kills a newline character?

kill-word and backward-kill-word deletes too much text: foo(bar) <point> Now if I press C-<backspace>: foo(<point> What I want is: foo(bar)<point> after pressing C-<...
0
votes
1answer
19 views

debugging why emacs is autoformatting on save hook

I'm currently facing an issue where I am trying to save a file, but some save hook is triggering an auto formatting the file in a way that I do not want. I am not sure how to debug this issue. Ideally,...
0
votes
2answers
90 views

Filter text of buffer in a grep-like way

I want to filter the text of an emacs buffer, a bit like you can filter text with grep. Sounds simple, but I tried googling it and I only get results from people who want to search in a buffer or to ...
0
votes
2answers
22 views

Is there a way to delete the content under selected headers, but not the headers (and subheaders) themselves?

Is there a way to delete the content under selected headers, but not the headers (and subheaders) themselves? I.e., ** TOC *** PART 1: VECTORS AND GRAPHICS [[https://livebook.manning.com/book/math-...
0
votes
0answers
21 views

Edit wikitext using Doom Emacs

I might have to edit some wikitext files. I am using tiddlywiki but the syntax is similar to mediawiki. I looked up but could not find any specific mode to edit wikitext documents. HTML goes closest ...
1
vote
0answers
53 views

Really slow editing long org-mode blocks

When editing inside a long org-mode block (#+BEGIN_.... - #+END_....) Emacs is really slow (it can take several seconds to write a single character), while editing the rest of the buffer takes normal ...
2
votes
1answer
38 views

Unrestricted movement of lines Alt-Up/Down

I'm learning Orgmode and moving lines (headers, checkbox items) up and down. These movement are restrited to a tree part of the line (header section, checkbox list): * Here is a list - Item 1 - Item ...
1
vote
2answers
69 views

Text editing with parentheses

I have a text like Code1. I want to convert from Code1 to Code2, including parentheses and removing some texts. How do I edit this efficiently? Code 1 AAA & 0.076 & 0.053 & 0.053\\ AAA &...
0
votes
0answers
16 views

How can I display and edit an `.eld` file as if there were one item per line?

When looking at *.eld files such as stored by projectile (~/.emacs.d/projectile-bookmarks.eld), there's no line breaks which makes it hard to read. How can I view/edit the file as if there was one ...
0
votes
1answer
70 views

Change vertical characters to horizontal

I have the following data and want to change from Code 1 to Code 2. Is there any useful method to do that? Code 1 11130101 11130102 11130201 Code 2 11130101, 11130102, 11130201
1
vote
1answer
41 views

How to duplicate text but increment a numeric part of a name?

Say that I have rect1 one and I'll multiply it 3 times by yanking. let rect1 = Rectangle { width: 10, height: 40, } let rect1 = Rectangle { width: 10, height: 40, } ...
0
votes
0answers
48 views

How to format code similar to the way Vim has (select + "=")?

In Vim I can format code by the key =, with or without selecting a region. Is there a way to do it in Emacs in an easy way too?
0
votes
0answers
48 views

Adding custom text above and below a buffer

Is there an easy way to wrap a buffer in emacs with text of my choice? For e.g if my selected buffer is like this, This is the first line of a verse with । And here comes the second line ॥ 1.2 ॥ I ...
0
votes
1answer
566 views

Search and replace in evil mode

I'm an emacs newbie and am using evil mode for text formatting. I have some text in the following format: word1 = meaning with elaboration; word2 = simpler meaning; word3; word4 = much long ...
7
votes
1answer
183 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 ...
0
votes
0answers
19 views

Bug? Can get point into the middle of a run of characters with a replacing display spec

I'm implementing a minor mode that "folds" certain strings. It does this by adding a font-lock keywords rule to the buffer, that applies display properties that make it look like it's a ...
1
vote
1answer
33 views

How can I catch a block of text to be used in a replacement-part code?

I want to save a block of text in a variable and then do a replacement using that variable in the replacement part. For instance, suppose to do the following replacement: block_of_text ---> \...
1
vote
0answers
116 views

How can I convert an inline pseudo YAML dictionary to a valid multiline one?

Consider this code: - name: Cron set up cron: name=something something="anything" job="/bin/bash -c 'service=nslcd; [[ -x /usr/bin/$service ]] && systemctl restart $service'&...
5
votes
4answers
579 views

How to swap words `true` and `false` in buffer text?

I found myself switching the text true to false, and vice versa, while coding very often. It's quite tedious to mark the entire thing and replace it with opposite. It would be great to have a function ...
1
vote
1answer
40 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....
2
votes
3answers
192 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
56 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
49 views

Centering within comment blocks or ASCII art

I have C comments like this: /****************************************************************************** * Includes * ***********...
0
votes
1answer
33 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
73 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
70 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
27 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
2answers
244 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
186 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 ...
2
votes
1answer
65 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
1answer
33 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
88 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
3answers
86 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
164 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
174 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
48 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
90 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
47 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 ...
2
votes
2answers
153 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
66 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?
2
votes
2answers
71 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 ...
4
votes
3answers
144 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
54 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
98 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
68 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": "...
2
votes
0answers
126 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
208 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
32 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 ...

1
2 3 4 5