Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

The tag has no usage guidance.

0
votes
1answer
19 views

elisp regex newline escape confusion

Shown below is a simple function, which was run in the middle of a text file that contained multiple instances of repeated blank lines. The output of the function is also shown below. The only ...
0
votes
1answer
30 views

How to remove empty lines of a selected region of code in Emacs?

Is there a way to remove blank lines from a region of code I select? I am asking because I copy/pasted code and it seems to have several blank lines I want to get rid off.
-1
votes
1answer
79 views

How to find all characters, newlines included?

I have this LaTeX code: %%% 10 \bibitem{bib2} W.~Kockelmann, G.~Burca, J.F.~Kelleher, S.~Kabra, S.-Y.~Zhang, N.J.~Rhodes et~al., \emph{Status of the neutron imaging and diffraction instrument IMAT},...
1
vote
1answer
43 views

Imitate paragraph spacing in visual line mode

I write long texts using org-mode and visual-line-mode. Each long line, wrapping over several visual lines, looks like a "paragraph", and behaves similarly to a paragraph in a traditional word ...
1
vote
1answer
85 views

How to improve the `M-! command` output

I found this really cool in emacs M-! t t is ~/bin/t, and runs tests for whatever thing I'm working on. I added ~/bin/ to my /etc/path.d/, and I always use emacs -nw. My issue is, the command ...
1
vote
4answers
146 views

Recursively insert a new line character in every line at a certain column

I was just going to ask how to accomplish this, but through a few DuckDuckGo searches, I was able to answer a lot of my question. I have a buffer of part numbers and part number descriptions each in a ...
4
votes
6answers
133 views

Search for “foo bar” ignoring comments and newlines

How do I search for "foo bar" ignoring comments and newlines in emacs? For example, given the tex file fragment blah blah foo % comment 1 % comment 2 bar blah blah I'd like to be able to type "foo ...
2
votes
2answers
361 views

How to set default encoding to utf-8, and default line ending to linux style?

I use this piece of code to set the default line ending to linux-style \n ;; https://www.emacswiki.org/emacs/EndOfLineTips (add-hook 'find-file-hook 'find-file-check-line-endings) (defun dos-file-...
6
votes
1answer
820 views

Insert line above/below

I have a couple of functions for inserting blank lines above and below the current line: (defun insert-line-below () (interactive) (move-end-of-line nil) (open-line 1)) (defun insert-line-...
3
votes
2answers
113 views

Mapping RET to use the same indentation level as the previous line

I code in Erlang, and I dislike the default indentation style that erlang.el provides: it tends to push code way too far to the right for my likings. I'd like to have a simple automatic indentation ...
0
votes
1answer
252 views

How to disable fill-column-indicator (fci) when it's outside the window?

The are various known bugs with the fill-column indicator, there is one well known bug that occurs when the window is too narrow for the window. Causing a column of $ to show on the right hand side ...
0
votes
1answer
79 views

How to get rid of the red areas and what are they?

I have some code I copy-paste from somewhere. What is this how to get rid of them all at once? My emacs is setup to automatically cut the orange areas, but to get rid of these? update: ...
7
votes
2answers
5k views

org-mode , export , how to 'force' newline on lines between paragraphs?

I have an org-mode file, some sub-sections have some big paragraphs. When I export as html the whole paragraphs are displayed as single lines. I understand that I have to put a '\\' on every line, a ...
3
votes
0answers
249 views

How to delete all white space during save except for final new line

I am aware that it is a good idea to have one blank line at the end of each file. I am also aware that extra white space in a file is bad. Currently in my .emacs file I have (add-hook 'before-save-...
1
vote
0answers
90 views

Auto-indent problems related to syntax in Haxe-Mode

In the Haxe programming language, you can specify the type of the return value of a function with a colon. function funcName() : ReturnType { } This becomes a problem when using emacs with haxe-mode....
-1
votes
1answer
317 views

yasnippet doesn't recognize $0 placeholder, why?

My emacs is running on Window 7 and I have just installed yasnippet via M-x package-list and added few lines to my .emacs file because I read around the web that it needs to be initialized. I tried ...
0
votes
0answers
48 views

Changing the definition of the paragraph

I would like to change the definition of the paragraph in such a way that every line to be considered as a paragraph. As I understand from the documentation, one should change the variables paragraph-...
4
votes
2answers
724 views

Difference between the physical “RET” key and the command 'newline in the minibuffer

The key "RET" is bound to 'newline in many modes in Emacs as described in M-x describe-binding. But in the minubuffer, they are different (try to send the command newline to the minibuffer). So this ...
5
votes
2answers
8k views

How to make a dot match a newline

Often I need to use regular expressions to match strings across multiple lines. In python and other languages, it's possible to ask that dots match newlines (as opposed to the default behavior). Is it ...
1
vote
1answer
313 views

Emacs whitespace mode doesn't show ^M characters

Somebody in my team has checked in a file with MS-DOS line endings into the git repo. with vi's binary mode, vi -b hello.py, i can see lines ending with ctrl character - ^M. In emacs, whitespace-...
2
votes
1answer
134 views

Weird spacing with whitespace newline mark “↴” [duplicate]

I have my whitespace newline mark set to the "↴" character, (setq whitespace-display-mappings '( (newline-mark 10 [8628 10]) ))...
3
votes
1answer
6k views

How to examine the new line characters in emacs?

I want to check if there is a "\r" at the end of a line of a plain text file (compressed as .gz file). I try the whitespace mode, and I don't find ^M shown. Is \r shown as ^M in whitespace mode? But ...
2
votes
1answer
193 views

Tramp file encoding for Unix

I have managed to setup Tramp to connect to a remote Solaris machine from a Windows machine using plink, which is very nice. (setq tramp-default-user "Beginner" tramp-default-host "the_host" ...
33
votes
2answers
16k views

How to disable auto-indentation of new lines?

I've recently upgraded emacs to version 24.4.1 and something has changed in the indentation of new lines. When I hit enter I expect just "bare" new line character at point where cursor was present, in ...
22
votes
2answers
10k views

How to convert DOS/Windows newline characters to Unix format within GNU Emacs?

Is there a way to tell GNU Emacs to convert DOS/Windows newline characters in a file to Unix format?
3
votes
1answer
221 views

Make `return` key more powerful

Normally return key is just newline, I believe a lot of people bind it to newline-and-indent, but return is relatively common used key, the C-u RET and C-- RET basically do nothing but same as return, ...
4
votes
1answer
280 views

Customize newline-and-indent function

I'd like to extends this function to work as usual in most cases but if current line starts with * then it should indent and then insert *. Particularly i want to use it in multi line comments, i.e: /...
3
votes
1answer
198 views

Bind C-e C-j and C-a C-o TAB to single key, aka insert and jump to newline

C-e C-j will insert a newline below and jump to it indented. C-a C-o TAB will insert a newline above and jump to it indented. Is there a single bind to these or where/how should I bind these commands?...
4
votes
2answers
926 views

Make the cursor stop at the last character of a line instead of the newline character

How to make cursor stop at the last character of a line instead of at the linefeed character? I use evil-mode. Steps to reproduce the issue: Start Emacs in shell via emacs -nw -Q. Press C-e to move ...
6
votes
3answers
552 views

How to insert a specific number of newlines in org-mode

Inside org-mode, RETURN is bound to (org-return &optional INDENT). This command apparently ignores C-u numeric prefixes and so if you want to enter 10 newlines, you can't just type C-u 1 0 RET and ...
11
votes
2answers
477 views

How can I suppress emacs' display of the final newline in a file?

One of vim's quirks is that it doesn't show an empty line at the end of a file if the file ends with the newline character. This way, if the file doesn't end with a newline, the display is the same, ...