Skip to main content

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
0 votes
1 answer
32 views

Zero padding numbers in org-num-mode?

I like to workingorg-num-mode enabled: ** 4 Actions *** 4.1 WAIT Lorem :visit: ▼ *** 4.2 WAIT ipsum :uni: ▼ *** 4.3 NEXT dolor :...
Garid's user avatar
  • 641
0 votes
0 answers
35 views

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
1 answer
28 views

Creating BIG multi-line characters

Is there a function I can grab from somewhere that turns a string of text into a multi-line string of the same text. For example "Hi" becomes: H H i H H HHHH i H H i H H i ...
bielawski's user avatar
  • 101
0 votes
0 answers
80 views

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
31 views

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
1 answer
45 views

Tide mode: how do I get it to stop running tide-format-before-save?

I'm at my utter wit's end with this hell-plugin lmao. I've tried (remove-hook 'before-save-hook 'tide-format-before-save t), and it doesn't work. How do I remove tide-format-before-save from the ...
Alexis Purslane's user avatar
3 votes
2 answers
276 views

How to ignore accents (À Â É Ê etc.) when sorting?

When sorting text with Emacs, the result is wrong for accented characters: Always Emerald Yesterday Zoo À la campagne Âge Écarlate Être Here is the result I would like instead: À la campagne Âge ...
Carapuce's user avatar
0 votes
1 answer
35 views

Is it possible to tune `fill-paragraph` to balance the lines?

Inspired by a recent addition of text-wrap: balance to CSS I've suddenly realized I'd like to have balanced comments in my code. Current behaviour of fill-paragraph (with my current settings) converts ...
Nikolai Prokoschenko's user avatar
0 votes
1 answer
73 views

Building a minor mode which makes buffer appear modified

You are an American in a British company. The company requires all your saved files to use the spelling "colour". You can't bear to look at anything other than "color" so you want ...
Tumok A. Byrd's user avatar
0 votes
0 answers
45 views

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
1 answer
139 views

Disable blacken-mode on certain projects

I have blacken-mode enabled on all python buffers like this: (add-hook 'python-mode-hook (lambda () (blacken-mode 1) ;; other config )) But on some ...
suvayu's user avatar
  • 1,638
1 vote
1 answer
37 views

How to get `Info-mode`'s text to horizontally fit the window like in the html version?

See images for a comparison. The emacs version line-wraps much before the horizontal space ends. Html version was screenshotted from here
habit's user avatar
  • 143
0 votes
2 answers
1k views

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
111 views

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
452 views

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
2 answers
784 views

How can I auto-format org-mode to have a newline in between TODOs?

In org-mode I have following TODOs: * TODO task1 do this * TODO task2 do that * TODO task3 Would it be possible to auto-format it to have new-line in between TODOs as: * TODO task1 do this * TODO ...
alper's user avatar
  • 1,370
1 vote
1 answer
176 views

How to keep a multi-line nested bullet list indentation (and bullets if possible) when pasting from Google Docs to emacs

I copy a nested list like this: - foo - bar - foo - bar from Google Docs to emacs, but the bullet points vanish and the indentation as well. The same happens in the normal Linux text editor....
questionto42's user avatar
0 votes
1 answer
106 views

How to bind a terminal command to a key for python code autoformatting using autopep8

I'd like to autoformat my python code from the buffer that contains it with a key. I was looking at this tutorial. One can autoformat the code from the terminal with the command: autopep8 --in-place --...
Schach21's user avatar
0 votes
1 answer
175 views

Emacs displays different formatting than what actually is

I have been using emacs for a while now, I am relatively new to it but while editing i noticed that sometimes emacs will show the code correctly formatted, when i open it with another text editor ...
user2742982's user avatar
3 votes
0 answers
397 views

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
1 vote
0 answers
143 views

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
0 votes
1 answer
258 views

Display the header that a TODO item belongs to?

In org mode, I'll have a file pertaining to some topic, and a few top level headings pertaining to instances of that topic, which may contain TODOs (also potentially nested). In the global TODO list, ...
user avatar
1 vote
1 answer
2k views

Python formatting not working on Doom Emacs

I activated the formatting on save in the init.el file uncommenting the following line (format +onsave) ; automated prettiness But when I save a Python file, I get the following error message: Error ...
Adrián Juárez's user avatar
0 votes
1 answer
210 views

Unable to set gofmt-args in Go mode

I am unable to set gofmt arguments to consume the following arguments -tabs=false -tabwidth=2 -w=true When I set the variable gofmt-args, I get the following error Invalid read syntax: "Trailing ...
hmehra's user avatar
  • 23
1 vote
2 answers
173 views

How to evaluate a list containing strings or un-evaluated blocks into a string? (like format-mode-line)

The mode-line-format can be a list of strings, but it can also include un-evaluated blocks, e.g: (setq mode-line-format (list "Hello" '(:eval (my-function-call)) "There&...
ideasman42's user avatar
  • 8,806
0 votes
0 answers
108 views

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
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
0 votes
0 answers
86 views

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
1 answer
512 views

Limiting the number of lines of org babel result

Is there an easy method to limit the number of lines in org-babel results? For example: I have the following org-babel block: #+begin_src js :exports both :results output for (let i = 1; i <= 100; ...
Sarthak Adhikari's user avatar
1 vote
1 answer
130 views

(Sudden) Weird behavior of M-q in auctex

I very much enjoying using the auto fill functionality that the key binding M-q provides. However, starting recently, I am experiencing a small (but annoying) change in its behavior when in LaTeX mode....
apprentice's user avatar
2 votes
1 answer
255 views

How do I stop tab from being electric in Text mode?

When editing a plain-text document in Text mode when I press tab emacs inserts spaces until the cursor appears directly beneath the beginning of a word it finds in the line above. I don't want it to ...
Georgina Davenport's user avatar
0 votes
1 answer
82 views

Apply Python formatting rules to files not ending in .py

I need to edit a few .pyt files, which are python code but specific to ESRI ArcGIS software. Is there a variable that lists the file ending that python formatting is applied to that I could add .pyt ...
Hugh_Kelley's user avatar
2 votes
1 answer
201 views

Getting rid of plain text timestamp entry in agenda export

I am trying to create a weekly agenda that I can print out and use without having to be at the computer To best explain my problem I will use some screenshots This is the normal org file that I will ...
user3145648's user avatar
0 votes
1 answer
207 views

Shortcut or function to un- or de-emphasize without manual selection

The function org-emphasize puts formatting on a region, e. g. * at the beginning end end of a bold sentence or word. To remove the bold attribute I can mark the same region, execute M-x org-emphasize ...
breathe_in_breathe_out's user avatar
1 vote
1 answer
210 views

How to type a^b in org-mode?

In an org-mode table, I want to write 2^3, but exporting to html turns it into 23. I prefer not to use inline verbatim, and I would like to not have a space between the ^ and the other text. Is ...
Alex Shroyer's user avatar
0 votes
2 answers
141 views

org-mode un-bold exported headlines

I use org-mode to translate, with source text lines on level 2 headlines and target text lines on level 3 headlines. However, the text of any headline that is exported is bold and italicised. I can ...
Jtrans's user avatar
  • 35
1 vote
1 answer
467 views

How can I lint a C file?

I have the following: int main() { int a = 1; int b = 2; return 0; }; I am expecting some lint to align the indentation. My file is open with (C/*l AC Abbrev). I try C-c . which asks me:...
Mittenchops's user avatar
0 votes
1 answer
184 views

bibtex customize sort-field in bibtex-entry-format

I am trying to customize the behavior of M-x bibtex-entry-format function to reformat a bibtex entry in a bib file. I want that the various fields in an entry are sorted to a given ordering. In my ...
PinkCollins'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,806
4 votes
1 answer
2k views

How to auto-format an Elisp file on save?

Having used clang-format to format the buffer when saving, I find this functionality useful. Are there tools to reformat an Elisp buffer when saving?
ideasman42's user avatar
  • 8,806
1 vote
1 answer
85 views

What does {:} in columnview specification mean?

A columnview org-columns specification may look like this: #+BEGIN: columnview :id local :format "%70ITEM(Task) %Effort{:} %CLOCKSUM{:}" #+END: Sometimes you can see variations without the {:} part. ...
Alexander Shcheblikin's user avatar
1 vote
1 answer
140 views

How to make strings literal when formatting?

When string formatting is supported, it's sometimes possible pass in a string which could contain a percentage symbol which would then be interpreted. For example, this frame-title-format has a bug ...
ideasman42's user avatar
  • 8,806
0 votes
2 answers
375 views

How to preserve linebreaks of MS-Word text pasted into an Emacs buffer

This is similar to There's a way to use emacs like MS Word, to make text permanently colored, stylized, etc...? However, I do only wish to preserve linebreaks so that the pasted raw text from word ...
JKRT's user avatar
  • 201
0 votes
3 answers
57 views

Automaticaly insert '~' Symbol before and after a "Marked Expression"

I am documenting Code a lot. For exporting purposes I often have to add a '~' infront and after an Expression. For Example "Adc_Cfg.c" needs to get "~Adc_Cfg.c~". That way the Export to PDF via latex ...
7ie7an's user avatar
  • 40
0 votes
0 answers
113 views

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
4 votes
2 answers
308 views

Disabling quote conversion in docstrings

(defun foo () "`bar'") The ASCII quotes in this docstring are displayed as typographical quotes by describe-function. Is it possible to have them displayed in their original form?
Toothrot's user avatar
  • 3,264
0 votes
0 answers
180 views

(line-pixel-height)

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
1 answer
325 views

forward-sexp confusion

The following code is an excerpt from the elisp tutorial, section 14.6. (while (re-search-forward "^(defun" nil t) (setq lengths-list (cons (count-words-in-defun) lengths-list))) Placing the ...
zugzwang's user avatar
  • 319
2 votes
1 answer
658 views

Automatically indent ONLY logical lines in Org-mode

I want this: ** This is a heading This is a logical line. But, because I have visual-line-mode on, lines will wrap at the edge, as is just and godly. But, such elegant formatting as you see here ...
Tina Russell's user avatar
5 votes
1 answer
1k views

Non-breaking space in Org-mode

In LaTeX one can use ~ to produce a non-breaking space. Is there an analogue in org-mode?
Dox's user avatar
  • 985