Questions tagged [text-editing]

Questions about editing or manipulating text inside of Emacs.

Filter by
Sorted by
Tagged with
5
votes
2answers
783 views

Incrementing characters in Emacs, next to numbers?

You can place a pointer on a number, like 1, and increment it to 2. There are many alternatives on this. See also the Emacs Wiki: https://www.emacswiki.org/emacs/IncrementNumber 7 alternatives to ...
5
votes
1answer
173 views

Edit simultaneously many buffers and save all of them after edit

Windows 10, Emacs 25.1, Helm I open 3 different files: I need: Edit simultaneously all buffers. Add text "customer/" to the node "bodyFileName"in all buffers. After edit save all buffers, Here ...
5
votes
1answer
712 views

How do I get a TOC sidebar of my current buffer?

I would like to write in markdown mode for example and then have a sidebar that shows me a table of contents of the buffer I am currently in.
4
votes
4answers
215 views

Append region to the end of the lines of another region of same length

Here are two cases i am interested in: Case 1: lines of identical length Given some lines const int name1 const int name2 const int name3 const int name4 and some other lines = 1 = 2 = 3 = 4 I ...
4
votes
2answers
326 views

Automatically replace C++ operators

In some projects I'm working with, there are coding rules that don't allow C++ operators such as == (for fear of being confused with = I suppose, but oh well...). Instead, special macros such as _EQ_ ...
4
votes
1answer
54 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 ...
4
votes
2answers
175 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.
4
votes
1answer
135 views

How can I execute a function every time I insert certain characters in the buffer?

I write a lot of text in German and English and I'm getting tired of switching the dictionary of my spell-checker all the time. In true Emacs spirit, I decided to do something about this and dusted ...
4
votes
3answers
118 views

How can I normalize sentence-endings?

Say I have the following text: A. U. Thor writes: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam est elit, pulvinar sit amet erat nec, finibus sagittis ex. Mauris dictum elementum ...
4
votes
1answer
52 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 ...
4
votes
2answers
215 views

how change behavior of kill-sentence based on position in sentence?

I'd like to modify the behavior of kill-sentence (which I have bound to M-k) according to context, in the following way: If the point is at the beginning of a sentence, then kill the sentence in the ...
4
votes
2answers
130 views

Hi-lighting common grammar mistakes in all prose across modes with English text

I already make extensive use of flyspell-mode to keep my errant spelling in check. However I'm currently trying to break the bad habit of using "it's" for possessive statements. I've had a brief look ...
4
votes
0answers
537 views

Send a text from Emacs to Grammarly

Is there a nice way to bind Emacs and Grammarly. This is what I wrote to myself. A very simple plugin that helps you to send a marked text to Grammarly. It is a very simple plugin, is there a better ...
3
votes
5answers
586 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-...
3
votes
2answers
178 views

Equivalent of Sublimes text expansion

I am trying to move from Sublime to Emacs. (Because free and all that.) One thing that I miss is the convenient text expansion available by default in Sublime where it picks up similar strings in the ...
3
votes
2answers
2k views

How can I kill a line after a certain character?

Each line in my file has a character ; followed by information that I want to delete. What is the best way to do it? Example: I like phat beatsies; but Mark does not like them I also like dogsies; ...
3
votes
4answers
865 views

Reshape a list into rows

I am looking for an easy way to turn a list such as this: one, two, three, four, five, ... into something more like this: one, two, three, four, five, six, seven, eight, nine,...
3
votes
1answer
429 views

Auto-indent without creating indentation in empty lines

Is there a way to use auto-indentation in Emacs without creating indentation on empty lines? For an example from C, if I have if (true) { printf("word"); } and then insert a newline after the ...
3
votes
1answer
150 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. ...
3
votes
1answer
123 views

Emacs auto fill on period

How can I tweak Emacs auto-fill to fill when a period is inserted? For example, with a (setq fill-column 10) the following will auto-fill when I press the space after "fill". ;; good fill ;; good ;;...
3
votes
1answer
751 views

Prevent Emacs from overwriting text

In this example: If I add for example '0.5' where the cursor is, instead of adding '0.5' while moving the remaining text to the right, Emacs will delete the part '}{ckt1}' while adding '0.5'. Is it ...
3
votes
1answer
49 views

is there a `transpose-page` command?

Does Emacs or any packages provide a transpose-page command? I know the C-x [ and C-x ] and forward or backward page, but many times I just want to transpose two adjacent pages, especially when in ...
3
votes
3answers
931 views

Make evil-mode more lisp friendly?

I'm asking for several tips to make editing lisp like languages in evil mode better. In particular there is one feature that I would really like but couldn't manage to get it to work. For example ...
3
votes
2answers
87 views

How to copy or move code in current scope to end of another file

I find myself refactoring code fairly frequently and my screen space is at a premium. I'd like to be able to move to a particular scope (class, function, or even if-statement/for-loop blocks) and ...
3
votes
1answer
113 views

Swap columns in a mediawiki table

I have a mediawiki table with three columns and some rows, eg.: {| class="sortable" ! Column header (one) !! Middle column !! Last column |- | value 1 || loong value ... and some more || another ...
3
votes
3answers
117 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 ...
3
votes
2answers
143 views

kill the current line and preserving cursor position

I'm using the slick-cut function (as answered here by itsjeyd) for killing the entire line with minimal keystrokes. It's defined like so :- (defun slick-cut (beg end) (interactive (if mark-...
3
votes
2answers
82 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?
3
votes
3answers
185 views

How to paste-then-copy?

I'm not sure whether anyone has ever implemented what I'm looking for, but maybe I'm just using the wrong terms to search for it. What I want to achieve is essentially a reverse copy and paste: I'm ...
3
votes
2answers
601 views

Always remove brackets by pairs - fix hungry-delete-mode and smartparens-strict-mode conflict

Enabling smartparens-strict-mode breaks hungry-delete-mode as it overrides the hungry-delete remaps for C-d and C-h with smartparens specific functions. Hence, I have disabled smartparens-strict-mode ...
3
votes
2answers
202 views

Detect changed files by content

When working with files changed on disk, there are two warnings ... changed on disk; really edit the buffer? ... has changed since visited or saved. Save anyway? They're useful, but get very ...
3
votes
2answers
177 views

how to do action on *next* word?

Is there a function (or some kind of prefix command) that will allow me to do an action to the next word I type, not the word under point or the region? Currently: upcase-word puts the word under ...
3
votes
1answer
191 views

Moving line with move-text-up doesn't move point

Disclaimer: I'm using Emacs Prelude, but I don't think this is a problem of that specific distribution. Some time ago I discovered that pressing M-S-up or C-S-up with no selection just swaps the line ...
3
votes
1answer
634 views

Printing/exporting to PDF from text-mode

I have been googling and searching for the answer to this question for a while but cannot find a definitive solution. In fact I am more confused than ever. I have no doubt that I am not the first ...
3
votes
1answer
166 views

Move selected sentence, word left/right by equivalent unit?

More broadly, should work by the selected semantic unit (incl. paragraphs in text mode, and the relevant units in other modes). I.e., if a sentence is selected, then the notional "move-left" would ...
3
votes
0answers
118 views

Edit any input field in emacs buffer

Is it possible to make emacs as an input middle man for any text field in the system? It should work like this: 1 user focus the text input field of any gui program 2 a system hotkey brings up a ...
2
votes
1answer
750 views

Can I write elisp code to act on the text in a buffer [closed]

I am fairly new to emacs and I want to learn emacs Lisp. In particular, is it possible to write elisp functions in, say, the scratch buffer to do some complex text-processing on my program file ...
2
votes
1answer
212 views

How does “transpose-sentences” work?

How does M-x transpose-sentences work? I tested it by executing the command with point at various places (as indicated) in the following: this is sentence 1. this is sentence 2. this is sentence 3. ^ ...
2
votes
3answers
624 views

org - keyboard shortcut to promote text to heading

How to promote a text line to a heading in org-mode? ie: I start writing text and only later wants to structure it: here's a start typing some text. and continue on a 2nd line and even a 3rd line. ...
2
votes
1answer
642 views

How can I use Emacs in a SSH sever that I logged in through emacs terminal?

I really like the emacs terminal but each time I use it to log into my server. I don't know how to use emacs to edit files on the server. Or it is not possible to do it? I can only edit files on ...
2
votes
1answer
259 views

Can you mark-word backwards?

There is a very convenient function M-@ Mark-word. However, I usually find my self typing things, than marking things backwards to copy it some place else. Is there something equivalent for mark-...
2
votes
2answers
460 views

function to reshape a 1-column buffer list into N-columns with align-regexp

I wanted to display a list of strings in the emacs completing-read style, which displays a list of completion strings in a nicely aligned multi-column display. But I could not find an easy answer or ...
2
votes
2answers
601 views

How can I make backward-kill-word stop at special character such as paratheses and line breaks?

Is it possible to change the behavior of backward-kill-word (bound to M-DEL by default) to stop at special characters? Quite often it deletes parentheses and line breaks against my will.
2
votes
2answers
122 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 ...
2
votes
2answers
83 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 ...
2
votes
1answer
148 views

Emacs - Lisp to parser text block to plantuml

Some document said emacs-lisp is more powerful than perl/Python to parser text file, but I still didn't see good example for reference. For example, if input below text block: 12-22 07:43:14.699 ...
2
votes
3answers
67 views

Rearranging whitespace in sexps

When writing Lisp, I often encounter a long line such as the following. (map function (|apply append long-list-name1 long-list-name2 long-list-name3)) (where '|' denotes the point). This can be a ...
2
votes
1answer
76 views

Upcase whole buffer but ignore quoted strings

I want to type everything in lowercase, but have a command to turn the whole buffer into uppercase except for quoted strings. What is the command to tell emacs to ignore quoted strings?
2
votes
1answer
290 views

Executing emacs shortcuts when keyboard is set to Greek

Writing Greek in emacs is proving to be quite inconvenient. If my keyboard is set to Greek, normal shortcuts do not work and I have to switch to latin just to navigate around the buffer. As an ...