Questions tagged [formatting]

is for text formatting and manipulating text attributes. Emacs formatting facilities include adding, changing, and describing fonts, faces, and colors. The complexity of the formatting functions depends on the major mode and customizations. Use this tag for questions about formatting time strings and mode-line also.

25 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4 votes
0 answers

Like JavaScript prettier but for Elisp

(N00b question.) Is there command/package/snippet to format elisp code (like in my init file) in a standard(-ish) way, like what Prettier does for JavaScript? I'm not only concerned about ...
agentofuser's user avatar
4 votes
0 answers

Add spaces between braces and content

I would like to automatically add spaces between braces and content when using emacs, for example: std::vector<std::string> values{"content", "moreContent", "andMoreContent"}; becomes std::...
jagged's user avatar
  • 41
3 votes
0 answers

Org-mode: custom syntax for smallcaps, like *bold* and /italic/

I use org-mode a lot to export PDFs through LaTeX. How can I define a custom syntax for org-mode to mark small caps—so, for example, ^this^ gets translated to \textsc{this}, the way *this* gets ...
Sophie Weigle's user avatar
3 votes
0 answers

how can i configure sgml-mode to format open and close tags on same line?

I set up my emacs to use sgml-mode so that I can format xml with M-x reformat-xml, but it puts the closing tags on the line below, rather than on the same line. instead of this: <mytag>stuff &...
Adam's user avatar
  • 241
2 votes
0 answers

Quoting selected text using email conventions?

Is there any existing elisp function which will quote any selected text using email quoting conventions? For example, suppose the following text appears in a buffer ... This is some text that I want ...
HippoMan's user avatar
  • 596
2 votes
0 answers

Source code pretty-printer / beautifier / formatter for minified HTML/CSS/JS using only code I can trust?

I am reverse engineering foreign web site and have a lot of minified code for CSS/HTML/JS. What package or tricks allow to beautify code? I am usually replace \([{}]\) to \1\n and C-x h C-M-\ (...
gavenkoa's user avatar
  • 3,452
2 votes
0 answers

Can emacs beautify existing tcl source code?

I'm just getting started with tcl; what sort of beautifier, or prettifier, or formatter, is there for tcl with emacs? My main interest would be to fix existing scripts so that particularly the ...
Thufir's user avatar
  • 121
1 vote
0 answers

Why does lsp-haskell format some projects and not others?

This is the message I get when I use lsp to format the current project: lsp-request: No plugin enabled for STextDocumentFormatting, available: [] And then on another project: LSP :: Applying 22 edits ...
dmvianna's user avatar
  • 392
1 vote
0 answers

Customize-like form

I'd like to create a form, like the one displayed by customize, in order to ask to the user some information. The form should let me provide a description, a default value, and eventually display a ...
tobiasBora's user avatar
1 vote
0 answers

Format Haskell type signatures to be multi-line

I want to have the following functionality on a save hook. Given a buffer that has type signatures like this… add :: Integer -> Integer -> Integer add x y = x + y …I want to have them ...
Matthew Piziak's user avatar
1 vote
0 answers

Is there a way to get copy & paste to be context-aware wrt whitespace and formatting?

When I copy a word and paste it at the end of an existing sentence (between the last word and the full stop), I'd like it to be pasted in such a way that the space between the pasted word and the ...
tmalsburg's user avatar
  • 2,570
0 votes
0 answers

fill-paragraph for Google style docstrings

When editing an existing docstring in Google style you need to call a function like fill-paragraph to cut the long lines while preserving the proper indentation. However fill-paragraph will not work ...
olivaw's user avatar
  • 151
0 votes
0 answers

how to turn off python formatting in emacs

I have a python program that I edit in emacs. However, sometimes when I save it, it gets re-indented, and in doing so, messes up the indentation of sections, where I have some code and then some ...
Christopher Clark's user avatar
0 votes
0 answers

How do I trim spaces and indentations after traversing a DOM tree?

The following traverse the dom tree and provide an iterative custom formatting. However during the formatting, there are empty spaces and indentations which I needed to trim. ;;; This is where the ...
alexander's user avatar
  • 133
0 votes
0 answers

Run clang-format in org source block

I have some org files with cpp source blocks. I want to format the code in the source blocks using clang-format. Consider this complete org file: This is a test: #+begin_src cpp struct Foo ...
Lukas Barth's user avatar
0 votes
2 answers

Doom - setting code formatter for specific file type

How can I change formatter used for specific file type in doom-emacs format module? So far I've been happy with using mostly doom defaults and haven't gotten into writing custom configurations and ...
AnonymousBadger's user avatar
0 votes
0 answers

format a region of text file with cc mode

I have a textfile.txt with content like the following *decltype with two or more arguments decltype does not take two arguments. Simply it can have an expression as its argument, and the comma ...
emacs-user-2021's user avatar
0 votes
1 answer

How to customize the vertical spacing between an org-mode heading and its content in the folded view?

Subtree View: * Header 1 ** Header 2 Children View: * Header 1 ** Header 2 Desired Children View: * Header 1 ** Header 2 Is there a way to treat the blank line between Header 1 and Header 2 ...
StackExchanger's user avatar
0 votes
0 answers

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

Emacs python-mode language formatting does not reapply on buffer on newly typed text

When I open a .py file for the first time the formatting is perfect, colors match special words as expected in Python But when I type new text in the buffer, it inherits the color of the same ...
AmazingMiki's user avatar
0 votes
0 answers

Convert gnu indent options to emacs indentation settings

I've worked at two places where code is supposed to be indented/formatted according to gnu indent (ie there's a prescribed set of options to gnu indent that's to be used). Is there an easy way to set ...
skyking's user avatar
  • 101
0 votes
0 answers


I've a block of 10 or so lines. Some show 19 pixels using M-x eval-expression (line-pixel-height) - this looks normal for my settings. Others, however, appear about 3 lines high and show 66 pixels ...
Dave P's user avatar
  • 111
0 votes
0 answers

What methods are available for formatting text pragmatically for an info style display?

I want to create a temporary buffer and output some formatted text into the buffer, so indentation perhaps column type layouts. I have written some lisp code that returns a load of lists so I want to ...
Oly's user avatar
  • 593
0 votes
0 answers

Human-readable time interval function for Elfeed

Is there some built-in or third-party function I can use for the following? The function (elfeed-entry-date entry) returns the timestamp for an RSS feed entry, e.g. 1518282912.0. I would like to ...
american-ninja-warrior's user avatar
0 votes
0 answers

wiki and twiki major modes

Is there an emacs mode for editing and typsetting wiki wiki modes? What I am looking for is something that could help me writing a properly formatted document for wikipedia.
Andrea Borga's user avatar