Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Questions tagged [text-editing]

Questions about editing or manipulating text inside of Emacs.

Filter by
Sorted by
Tagged with
4
votes
4answers
1k views

How to add a suffix to every line of a text?

Windows 10, Emacs 25.1 Suppose I have the following text (about 100 rows): ic_m_sales ic_m_activity_report ic_m_messanges ic_m_products_name ic_m_change_store ic_m_faq ... How ...
4
votes
4answers
206 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
1answer
880 views

Drag selected text with the mouse

In many editors it is standard to move selected text by dragging and dropping it with the mouse. In emacs dragging selection with the mouse starts a new selection by default. This is extremely ...
4
votes
2answers
322 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
3answers
153 views

What kinds of mistakes does transpose fix?

The only times I've ever found a use for transpose-words or transpose-chars is when I accidentally hit one of them unintentionally, in which case a backward-word followed by transpose-words again ...
4
votes
2answers
135 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
131 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
50 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
205 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
127 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
492 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
532 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
175 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
828 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
413 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
147 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
118 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
653 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
888 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
85 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
111 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
94 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
126 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
3answers
143 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
587 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
192 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
170 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
186 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
559 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
136 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
115 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
206 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
560 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
633 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
669 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
252 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
435 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
575 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
112 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
69 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
143 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
66 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
72 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
284 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 ...
2
votes
3answers
763 views

Replacing columns in a delimited region of a file

Suppose I have a section in a file which is in csv form, e.g. a1, bbb1, cc1, ddd1, ee1 aa2, b2, ccc2, dd2, e2 aaa3, bb3, c3, d3, ee3 aa4, b4, cc4, ddd4, eee4 Then, ...
2
votes
1answer
95 views

How to know the first and second level heading above the cursor?

I'm editing a 4.7M pure-text document, the task is simple, every book have chapters, and every chapter have each of its lines enumerated at the begin of the line, what I'm doing it putting the name of ...