Questions tagged [newlines]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
16 views

mu4e with default s/mime signature and point

I write e-mails with mu4e and sign them with an s/mime certificate by default. Do this end, I have defined mu4e with :enter-func (lambda () (mu4e-message "Switch to work context") (add-hook '...
user64060's user avatar
0 votes
1 answer
36 views

In an Elisp regexp, does anchor `^` not work with new line in front?

In an Elisp regexp, when I want to specify a pattern across two consecutive lines, I found that ^J^.* (^J is new line, and ^ is anchor of the beginning of a line) doesn't work, but ^J.* works. I was ...
Tim's user avatar
  • 4,997
0 votes
0 answers
40 views

How can I make a line-break work in a LaTeX export without any need for special characters?

What I want is to be able to write foo bar and have my LaTeX export recognise the line-break. Two line breaks rather than one would also be acceptable. #+OPTIONS: \n:t gives the behaviour that I ...
J. Mini's user avatar
  • 103
0 votes
1 answer
39 views

Is the '$' (end of line anchor) somehow concurrent with the '\n' (newline)? Please explain these results

In normal regex, I would expect the following to be true: (should (equal (string-match "^abc$\nx" "abc\nx ") 0)) ;; nope! nil (should (equal (string-match "^abc\n$x" &...
Jared's user avatar
  • 101
1 vote
2 answers
69 views

How can I make occur display only first line of match?

The context for this is that I was trying to write a function to help me write LaTeX, specifically I'd like to list all the future references, i.e. when you use a \ref{<something>} before \label{...
Alessandro Bertulli's user avatar
0 votes
1 answer
100 views

Add "carriage returns" (extra line) after all entries in document [examples added]

I've noticed that Emacs will preserve an extra line (carriage return) between items, but if I manually edit the file, this extra spacing can fall apart. For example, I've found that entries need 2 ...
charliesneath's user avatar
1 vote
3 answers
182 views

How to switch off showing a line break marking dollar sign $ at the end of a line?

One of the nice features of Emacs is that you can use Tab for in-line completions and Tab-Tab for showing possible completions to already typed text in a separate buffer if there are multiple of them. ...
Claudio's user avatar
  • 440
1 vote
1 answer
44 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
2 answers
529 views

How to repeat the last yank command N times?

I'm just not able able to replicate the answer on this. Starting with: lipsum I do (my interpretaton): Alt-W over the word (copy) Enter (new line) Ctrl-Y (paste) Alt-2 Ctrl-X z (repeat last two ...
user avatar
0 votes
0 answers
30 views

Using terpri to insert newlines in buffer

I am using (insert "\n") to insert a newline in a specified buffer. Is this the recommended way to do it? I have seen (terpri) but cannot get it to make a newline. (defun fire-clock (bufrn)...
Dilna's user avatar
  • 1
0 votes
1 answer
47 views

Calling c-electric-brace programmatically

I'm currently extending the tempo.el template insertion system to be sensitive to C styles. Specifically, I want to insert braces using c-electric-brace. How programmatically insertion of braces as ...
Nordlöw's user avatar
  • 497
0 votes
1 answer
49 views

Newlines when using message

Is this the way to add newlines to message string? (message "Some string \n Another string")
Dilna's user avatar
  • 1
0 votes
1 answer
71 views

Why does yasnippet insert a newline before the cursor?

This is my snippet, in org-mode: # key: quote # name: quote block # -- #+begin_quote `%`$0 #+end_quote Result: #+begin_quote | <- cursor #+end_quote Desired: #+begin_quote | <- cursor #+...
Josh Friedlander's user avatar
2 votes
1 answer
48 views

How can I make isearch match phrases across line breaks?

Suppose I have a text document (e.g. org-mode, Markdown, etc.) in which I would like to search for the phrase "hello world". Unfortunately, if paragraphs in this document are filled (e.g. ...
Ryan C. Thompson's user avatar
0 votes
1 answer
72 views

avoid unwanted newlines after running shr-render-region

i have a small amounts of text in html that i want to process. currently they are rendered with shr-render-region so that all html is out of the way, then copied and processed. this works fine except ...
martian's user avatar
  • 548
1 vote
0 answers
70 views

diff-mode: how to highlight whitespace characters?

with emacs -Q, I can use M-x whitespace-mode : But in diff-mode, if I use M-x whitespace-mode this is what I get: you can see the tabs/space/newlines aren't shown (highlighted). How can I make diff-...
John Doe's user avatar
  • 169
0 votes
1 answer
253 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
1 vote
1 answer
215 views

How to perform a multi-file regex-search with a regexp that encompass several lines?

Scenario: I want to detect all defcustom sexp that have a :set or :initialize keyword in all Emacs Lisp files inside a directory tree. Searching for newline can be problematic depending of the regexp ...
PRouleau's user avatar
  • 796
0 votes
0 answers
36 views

How to keep emacs from joining lines when pasting text into an ascii table cell?

I have this text : helo domain.com 250 OK mail from: <[email protected]> 250 OK rcpt to: <[email protected]> That I'd like to paste into this table cell +-------------------------------+-...
ychaouche's user avatar
  • 207
0 votes
1 answer
117 views

Is there a way to automatically indent a parenthesis in Slime REPL after pressing `C-m o`?

I am using Slime, Paredit, and SBCL to code in Common Lisp. While editing a .lisp file, suppose I have this code: (dotimes (i 4)) I will represent the cursor (point) as -!-. Having the cursor in this ...
Pedro Delfino's user avatar
0 votes
0 answers
36 views

Suddenly incorrect fontification of newlines

When a font style is applied to the newline character, certain styles - such as background colors - normally are extended to the end of the visual line. Suddenly this has changed for me, and the fonts ...
kdb's user avatar
  • 1,561
2 votes
2 answers
1k views

How to find a newline with a regular expression in query-replace-regexp?

I am trying to use find-name-dired and query-replace-regexp to find and replace some blocks of text across multiple HTML files. (Just what is explained here in the Emacs Manual.) query-replace-regexp ...
zcal's user avatar
  • 21
6 votes
1 answer
763 views

setq require-final-newline not working when setq-default does

I want all my files to end with only one newline, while trimming trailing whitespaces on regular lines. Like so : ($ is newline face) text$ $ last_line$ I use whitespace-cleanup in my init file, like ...
John Doe's user avatar
  • 169
-1 votes
1 answer
52 views

Emacs ignore \n in buffer

I would like to change the default behavior in emacs when '\n' meta-characters are encountered by the cursor. The default behavior is such that at '\n', (1) right-key sends the cursor to the beginning ...
user avatar
1 vote
1 answer
155 views

Insert text and step

I want to copy text from one buffer to another. With point in the source buffer, I want to insert text in the target buffer. In the target, the text should insert at point, a new line be opened, and ...
Lorem Ipsum's user avatar
  • 4,447
0 votes
1 answer
180 views

Whitespace-mode: highlight hidden indentation of empty lines

I use whitespace-mode, intend with tabs (colored pale yellow, which is what I want) and I am wondering about the situation where there is an empty line inside an indented block (see image below). I ...
Guillaume Brunerie's user avatar
0 votes
1 answer
69 views

Hardline wrap and Emacs key binding

The terminal interface to Emacs is marvelous and I like how it handles parentheses. I have two questions as I'm trying to move to Emacs as both a writing and coding environment. I installed a minimal ...
Xiotz's user avatar
  • 3
2 votes
2 answers
470 views

Remove multiple blank lines in a buffer, leave one

I'd like to take a buffer which looks like this: one two three four five And turn it into this one two three four five I've tried using delete-blank-line, however, it will only effect the area ...
oneself's user avatar
  • 341
1 vote
0 answers
111 views

Why does calling `term-send-backspace` (just pressing backspace) create a newline in the `*terminal*` buffer in `term-mode`?

Specs: i@debord:~$ emacs --version GNU Emacs 26.3.50 Copyright (C) 2019 Free Software Foundation, Inc. GNU Emacs comes with ABSOLUTELY NO WARRANTY. You may redistribute copies of GNU Emacs under the ...
John DeBord's user avatar
0 votes
1 answer
88 views

How to ignore emtpy lines on the bottom of the buffer?

When I jump to bottom part of the buffer using vi I does not show any empty lines. On emacs when I got to bottom of the buffer I see empty lines even there is no new lines exist. Is is possible to ...
alper's user avatar
  • 1,350
3 votes
1 answer
205 views

Continue comment while editing lisp and when hitting enter

If I'm writing a comment ;; this is a comment ;; this is its second line And I hit enter, I get a new line like this: ;; this is a comment ;; this is its second line Instead of getting a new line ...
Peeyush Kushwaha's user avatar
2 votes
1 answer
492 views

Spacemacs move cursor using word wrap, not line breaks

I would like to be able to move the cursor around using the visual buffer, but I don't want to add line breaks to the source file. I'm not sure a better way to describe it, so I got some gif examples. ...
GammaGames's user avatar
1 vote
1 answer
157 views

How to count the number of lines between two points? (ignoring word wrap)

Is there a convenient way to count the number of lines between two points? While I could search for \n in a loop and limit it to one of the points, this seems like an overly verbose way of doing it.
ideasman42's user avatar
  • 8,736
2 votes
2 answers
140 views

Define key binding for a single mode (Fundamental)

In light that this may be a duplicate, but I did not find the answer to my question scouring this site. The default behavior of GNU Emacs appears to have electric-indent-mode enabled, which is fine ...
Phoenix's user avatar
  • 351
2 votes
1 answer
46 views

Specify the number of blank lines

Upon leaving multiple blank lines (saying 4 lines of blanks), I have to strike four times of Enter. Tried C-u Enter or C-3 Enter, it does not work. How could specify the number lines like C-3 space?
Wizard's user avatar
  • 1,251
3 votes
1 answer
596 views

Search and replace two consecutive newlines

Running spacemacs 0.200. I am sorry if it is too basic. But I am just not able to get this. How do I convert two consecutive newlines with some text, say, 'there were two newlines here'? I could ...
deshmukh's user avatar
  • 1,912
1 vote
1 answer
358 views

Previous indentation is discarded on newline

Let's say I have the following code: void foo(){ ~ } I have marked point with ~. When I press enter the electric indentation works as normal but it doesn't keep the indentation for the previous ...
Nathan's user avatar
  • 13
0 votes
1 answer
2k 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 ...
zugzwang's user avatar
  • 319
5 votes
1 answer
2k 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.
Billal Begueradj's user avatar
-1 votes
1 answer
176 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},...
Onner Irotsab's user avatar
2 votes
1 answer
518 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 ...
9000's user avatar
  • 517
1 vote
1 answer
220 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 ...
american-ninja-warrior's user avatar
1 vote
4 answers
1k 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 ...
CigEmacs's user avatar
4 votes
6 answers
513 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 ...
Dominic's user avatar
  • 141
4 votes
2 answers
3k 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-...
puppon -su's user avatar
7 votes
1 answer
5k 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-...
Simon's user avatar
  • 421
3 votes
2 answers
598 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 ...
Vincent Foley's user avatar
1 vote
1 answer
743 views

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

*Edit* fci is no longer supported, emacs-27 supports this feature natively. The are various known bugs with the fill-column indicator, there is one well known bug that occurs when the window is too ...
ideasman42's user avatar
  • 8,736
0 votes
1 answer
565 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: ...
Johshi's user avatar
  • 131
26 votes
3 answers
24k 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 ...
xMris's user avatar
  • 361