Questions tagged [text-editing]

Questions about editing or manipulating text inside of Emacs.

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

Packages to move a line up and down in the text

Please don't call me lazy, but has anybody compared all the available packages that allow to move a line up or down in the text? I have found: move-lines move-text move-dup drag-stuff Or, just, to ...
julio's user avatar
  • 41
0 votes
1 answer
20 views

Creating BIG multi-line characters

Is there a function I can grab from somewhere that turns a string of text into a multi-line string of the same text. For example "Hi" becomes: H H i H H HHHH i H H i H H i ...
bielawski's user avatar
  • 101
0 votes
1 answer
27 views

Wrap a region with up / below code

From the following code (defun foo () (defun bar1 () (do-something))) (defun bar2 () (do-something)) I want to make the following (defun foo () (defun bar1 () (do-...
eugene's user avatar
  • 489
1 vote
0 answers
30 views

extra chars with emacs -nw

when emacs -nw opens a file from term (gnome-terminal, alacritty), there are extra chars like [I If I move the mouse in and out of the terminal, we get more of these [I[I[I (the brackets can be paired ...
pradesigner's user avatar
2 votes
3 answers
79 views

Protect a buffer from accidental editing

Sometimes I want to prevent myself from accidentally editing a buffer. How can I write-protect the buffer?
henning's user avatar
  • 92
0 votes
0 answers
32 views

How to get tempo to work?

I am trying to get some simple snippets to work with tempo, but I can’t get it to do anything. I am currently using this code, which I partly copied: (require 'tempo) (defvar c++-tempo-tags nil &...
Philipp Ludwig's user avatar
3 votes
2 answers
232 views

How to ignore accents (À Â É Ê etc.) when sorting?

When sorting text with Emacs, the result is wrong for accented characters: Always Emerald Yesterday Zoo À la campagne Âge Écarlate Être Here is the result I would like instead: À la campagne Âge ...
Carapuce's user avatar
0 votes
1 answer
81 views

Swap two pieces of text

I often find myself swapping pieces of text. How can I make a command to replace the current text with the latest kill, then put the text I just replaced at the position of the previous kill? Or is ...
Zaz's user avatar
  • 123
1 vote
1 answer
108 views

Why Emacs as an editor leaves all the ad hoc packages development work to the community rather than professional parties?

I have been using Emacs for daily editing and programming for several years. I am deeply attracted to the fast and efficient input method as well as the customizability. But recently I find that it is ...
yatse's user avatar
  • 13
1 vote
1 answer
45 views

How to have something similar to org-ctrl-c-minus but instead of adding just "-" Emacs would add "- [ ]"?

Suppose I have the following snippet inside an .org file: The Need to Read What You (Want to) Want After selecting the region with the mark command and executing org-ctrl-c-minus, I can convert the ...
Pedro Delfino's user avatar
0 votes
0 answers
24 views

Controlling Placement of Ellipses in Outline Mode: At End of Line or On Separate Line?

I have the following file opened in outline mode: * Heading 1 body ** Sub-heading 1 body *** Child 1 body *** Child 2 body **** Buried Deep body ** Sub-heading 2 body *** Child 1 body When I ...
StackExchanger's user avatar
1 vote
1 answer
227 views

How to transpose a pair of words?

Suppose I have the following text: :lacerte-attach-statement-type "suffix" :data-automation-id "OSICtrlE15-140" And I would like to have: :data-automation-id "OSICtrlE15-140&...
Pedro Delfino's user avatar
1 vote
1 answer
57 views

How to find out where the message comes from?

I'm trying to use Espanso in Emacs GUI. But nothing expands and Emacs echoes the message: "Beginning of buffer". The same snippet works everywhere except Emacs. I want to know where the ...
Tokubara's user avatar
  • 197
1 vote
1 answer
42 views

Search and replace to merge or eliminate text lines

A WinRAR command (rar vt -pmypassword -v myarc.part01.rar >source.txt) produces detailed information on files contained in .rar files or segments (e.g., filename.part01.rar). Here's an example for ...
Ray Woodcock's user avatar
2 votes
1 answer
121 views

How to get emacs count text words only without counting words in comments, code blocks, and markups in markdown?

Publishers set a word count limit you have to meet in writing a manuscirpt. I am trying to write up the manuscript using markdown in emacs. Consider the example below. MWE # Results {-} ## Topic 1 {-}...
doctorate's user avatar
  • 1,799
1 vote
1 answer
46 views

How to remove the whitespace on the beginning of every expression on this Clojure code snippet?

I have the following Clojure code snippet: { :id "SchK-Cash-contributions-(60%)" :description "Schedule K - Cash contributions (60%)" :line "L12a" :ultratax-...
Pedro Delfino's user avatar
1 vote
1 answer
82 views

Programatically update org-mode properties values

I have a handful of org-remark highlight-annotations which, before a bug in the code-base got fixed, consistently got displaced by 40 characters when I left and returned to the buffer. In order for ...
Sati's user avatar
  • 775
0 votes
0 answers
64 views

Get cursor to jump briefly to open paren when I type close paren

Emacs on my computer at work behaves in the following way: When I type a close paren, the cursor briefly jumps to the matching open paren. I like this behavior, but I can't get Emacs on my Mac at home ...
Rodney Price's user avatar
0 votes
1 answer
162 views

How to convert string to ascii or unicode hex?

I somewhat routinely need to convert an arbitrarily long string to hex, usually encoded as ascii or unicode. Is there a way to quickly and easily do this using vanilla Emacs? If not, is there a go to ...
holocronweaver's user avatar
1 vote
0 answers
55 views

How to open file with it being editable but not writeable?

I teach, and I like to use real files as examples in class. I want to be able to edit the buffer to show student things, but I don't want to risk accidentally writing the changes on the file. What I ...
elPolloDiablo's user avatar
2 votes
1 answer
95 views

Masking text / replacing a region with one character

I often find I want to "mask" text in a text file, such as overwriting a secret value in an example file. For example, I want to change SECRET_PASSWORD=123abc456 to SECRET_PASSWORD=XXXXXXXXX....
Rich Smith's user avatar
3 votes
1 answer
496 views

How can I insert the backslash character ( \ ) before quotation marks (" ") in Emacs?

I am running Emacs and writing on the scratch-buffer. This is my config file. After executing describe-mode, this is the list of minor modes running: Enabled minor modes: Auto-Composition Auto-...
Pedro Delfino's user avatar
0 votes
4 answers
96 views

Text representing a Python vector of numbers: how to append a comma to each numeral but the last?

The printed value of Python vector of numbers is displayed in a buffer: [0.00000024 0.00000024 0.00000024 0.00000024 0.00000024 0.00000023 0.00000024 0.00000024 0.00000024 0.00000024 0.00000023 0....
lawlist's user avatar
  • 18.9k
2 votes
0 answers
52 views

How to edit keyboard macro saved in file?

Here is my custom keyboard macro: (fset 'gen-numbers (lambda (&optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item (...
a_subscriber's user avatar
  • 3,906
1 vote
0 answers
40 views

How to cycle between literals at the cursors point?

Are there packages that can quickly toggle/cycle values under the cursor? For example: t <-> nil <= <-> >= + <-> - when <-> unless ... using a list of preset values for ...
ideasman42's user avatar
  • 8,546
1 vote
1 answer
140 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....
questionto42's user avatar
2 votes
2 answers
97 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 (...
kjo's user avatar
  • 3,207
0 votes
1 answer
218 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-<...
user avatar
0 votes
1 answer
79 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,...
clo_jur's user avatar
  • 101
1 vote
2 answers
1k 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 ...
Romário's user avatar
  • 133
0 votes
2 answers
55 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-...
HappyFace's user avatar
  • 791
1 vote
0 answers
166 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 ...
DPD-'s user avatar
  • 251
2 votes
1 answer
156 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 ...
Evgeny's user avatar
  • 133
1 vote
2 answers
79 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 &...
hrkshr's user avatar
  • 133
0 votes
1 answer
95 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
hrkshr's user avatar
  • 133
1 vote
1 answer
63 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, } ...
zoldseges's user avatar
0 votes
0 answers
87 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?
DoctorDoom338's user avatar
0 votes
0 answers
101 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 ...
linuxfan's user avatar
  • 209
1 vote
1 answer
2k 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 ...
linuxfan's user avatar
  • 209
7 votes
1 answer
321 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 ...
ideasman42's user avatar
  • 8,546
0 votes
0 answers
24 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 ...
zwol's user avatar
  • 272
1 vote
0 answers
271 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'&...
Kepi's user avatar
  • 259
5 votes
4 answers
672 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 ...
Navidot's user avatar
  • 762
1 vote
1 answer
181 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....
Budiman Snowman's user avatar
2 votes
3 answers
452 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 ...
a_subscriber's user avatar
  • 3,906
1 vote
1 answer
123 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)) ...
HappyFace's user avatar
  • 791
3 votes
1 answer
125 views

Centering within comment blocks or ASCII art

I have C comments like this: /****************************************************************************** * Includes * ***********...
Vercingatorix's user avatar
0 votes
1 answer
46 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--- ...
ABu's user avatar
  • 280
4 votes
1 answer
128 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 ...
dr jerry's user avatar
  • 321
1 vote
1 answer
182 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.
feklee's user avatar
  • 1,049

1
2 3 4 5