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.

Filter by
Sorted by
Tagged with
23 votes
5 answers
7k views

Can I format cells in an org-mode table differently depending on a formula?

I have a column in an org-mode table with numbers in each cell. I'd like to change the background color of the cell to red if the number is below 1 or above 2. How can I do that?
Trevoke's user avatar
  • 2,440
19 votes
4 answers
4k views

Org mode - Parsing rich HTML directly when pasting?

Currently, for notetaking tools like Evernote and Quiver, I can directly copy HTML content from my favorite browser and then paste them into the app, with all the formatting + link preserved. However ...
xji's user avatar
  • 2,635
40 votes
3 answers
17k views

Command that formats (prettifies) Elisp code

Let's say I have a function that looks like the following (as is often the case when printing elisp output). (defun my-example-function () (let ((a (do-something)) (b (do-something))) (setq someone ...
Malabarba's user avatar
  • 23.2k
9 votes
4 answers
3k views

Print message in echo area with no "quotes"?

Q: how do I print a message in the echo area without surrounding quotes? Here's a simple command: (defun test-fn () (interactive) (message "Test message")) When I call it as an interactive ...
Dan's user avatar
  • 33k
34 votes
6 answers
23k views

How to prettify/format an XML buffer?

I have a file with xml all on one line. Does the functionality already exist to reformat this buffer to be somewhat user-readable?
wdkrnls's user avatar
  • 3,707
18 votes
4 answers
8k views

Automatically formatting SQL code

There are some general well-known coding standards and styles for SQL (e.g. capitalizing reserved words, placing main keywords in different lines, etc.). Does Emacs come with any modes for this, or ...
Amelio Vazquez-Reina's user avatar
14 votes
5 answers
7k views

How to auto-format the source code block in org-mode

When I'm using org-mode to take notes about a book, sometimes I'll copy/paste some code snippets into the note file. After pasting it, I'll 1. `C-c '` to call `org-edit-special` 2. `C-x h` to mark ...
CodyChan's user avatar
  • 2,649
13 votes
1 answer
3k views

Why does *compilation* buffer show control characters?

I'm using the *compilation* buffer to build a C++ application on Centos 5 and Centos 6. The buffer shows the build and includes references to files that are part of the build. However, I'm getting ...
WilliamKF's user avatar
  • 393
10 votes
3 answers
2k views

Org-mode export: indent first line of each paragraph, "literary" style

Is there a switch on org-mode I can use on export to ODT (or other format) to format my source file of This is a paragraph this is a paragraph this is a paragraph this is a paragraph this is a ...
Steven Arntson's user avatar
7 votes
1 answer
4k views

"Format Code" like in Eclipse

In Eclipse, I can hit CTRL + SHIFT + F which not only corrects the indentation but also whitespace (for example: c=a +b ; is corrected to c = a + b;) and the line length. I am looking for a similar ...
Monkey Supersonic's user avatar
5 votes
1 answer
2k views

How to run a custom formatting tool on save?

While there are packages that format on save, I'd like to be able to run a custom command that auto-formats a file on save. Upon saving it runs an external process that: Takes the buffer as stdin. ...
ideasman42's user avatar
  • 8,796
5 votes
0 answers
716 views

How to display and format leading spaces (spaces at the beginning of a line) with whitespace-mode? [closed]

I want to see all spaces at the beginning of a line as dots. Also tabs and line breaks. So I've set my init.el file as the following: (setq-default indent-tabs-mode nil) (setq whitespace-style '(...
fschuindt's user avatar
  • 161
5 votes
1 answer
1k views

How to break long lines automatically?

I have searched the googlewebs, but I have been unable to find an emacs package that will automatically break long lines in a (Python) language conforming way. For example: def ...
davidrmcharles's user avatar
1 vote
1 answer
167 views

Since update to org-mode 9.4 misaligned column view headers

I updated org-mode to 9.4. When I enter column view, the header is not in the correct size, so table columns are not below the respective header field. I use different font sizes for different org-...
breathe_in_breathe_out's user avatar
1 vote
0 answers
455 views

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