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

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 ...

0
votes
1answer
43 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 ...
0
votes
1answer
73 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 ...
0
votes
0answers
52 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?
1
vote
0answers
25 views

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

yas-new-snippet showing a bad formatted file

I use yasnippet a lot, all of the sudden, if I call yas-new-snippet I get a bad formatted snippet template, look at the screenshot. I have also inserted the screenshot with whitespace-mode enabled. ...
4
votes
1answer
96 views

Format fails to copy text properties from the format-string for adjacent %-sequences

Take a look at this example: (format (concat "%s" (propertize "%s" 'face 'error)) "foo" "bar") "foobar" (format (concat "%s " (propertize "%s" 'face 'error)) "foo" "bar") #("foo bar" 4 7 (face error)...
2
votes
1answer
33 views

yaml-mode empties whitespace lines

Our project has a large yaml file edited by multiple developers in multiple environments. When I edit the file in emacs, yaml-mode (I assume?) will trim any whitespace lines: Value: ...
0
votes
0answers
88 views

clang-format malfunctioning(?) Or am I not fully understanding how clang-format works?

I installed the clang-format package from melpa. I then added the following lines to my init file: (require 'clang-format) I then created a test directory, cpp-proj with one file, main.cpp. main....
2
votes
1answer
21 views

In M-x Info (C-h i), tables are not correctly aligned

Problem When trying to browse documentation in M-x info ≡ C-h i, the table of contents is not correctly aligned. One would expect * Introduction This is the etc etc etc etc etc . * Details ...
3
votes
0answers
61 views

Emacs automatically insert spaces to format source-code

In Visual Studio, there is a setting column, where you can tell VS to (e.g.) insert space after comma insert space after semicolon insert space before and after binary operators insert space around ...
0
votes
0answers
27 views

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

Weird reformatting, cannot tell what is responsible

In my code I have bindings for two reformatters that are supposed to be applied upon saving relevant code: (add-hook 'tuareg-mode-hook (lambda () (add-hook 'before-save-hook 'ocp-indent-buffer ...
0
votes
1answer
118 views

format java source code natively based on CodeFormatterProfile

Is there an emacs tool to format java code according to a Java Code Formatter Profile (xml) spec, such as the one below? https://github.com/google/styleguide/blob/gh-pages/eclipse-java-google-style....
0
votes
0answers
46 views

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 ...
2
votes
0answers
27 views

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 &...
1
vote
0answers
31 views

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 ...
1
vote
1answer
33 views

Is it possible to “protect” strings from formatting?

I'm working on a latex document \documentclass{exam} \printanswers % to use the tag % \usepackage{catchfilebetweentags} % \ExecuteMetaData[file.tex]{tag} %<*afterclass> \begin{document} \...
2
votes
1answer
106 views

Is there a way to recognize `— vim: et:sw=4:ts=8:sts=4:tw=80` in emacs?

I'm working on a project with all source files appended with this vim formating rule -- vim: et:sw=4:ts=8:sts=4:tw=80. Is there a way to make Emacs setup the correct indentation for me automatically? ...
1
vote
2answers
153 views

What prevents emacs from indenting and how can I force it to?

In certain modes, such as Python I have noticed that Emacs will not indent how I want it it to. It is getting "smart". For instance, in this block of code: def vec_select(veclist, k): ...
1
vote
0answers
97 views

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

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 '(...
0
votes
1answer
176 views

Org-Mode - Fix LaTex export

I've written a document in Org-mode but when exported it became like this: In the image on top, I've inserted a \bullet but it wont show and the text is not alligned: And in the image on bottom, the ...
4
votes
0answers
102 views

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 ...
0
votes
2answers
97 views

Automatically break long function signatures, calls, etc

void parse(std::vector<float>& io_vertices, std::vector<unsigned>& io_indices) {} Oftentimes when we code we need to break lines repeatedly as new expressions and statements enter ...
1
vote
1answer
45 views

fill-paragraph in programming

Is it possible, or does some function exists, to get the equivalent of the alt-q command, but in programming? Suppose I've just written this in python: group_parser.add_argument('-n',nargs=1, ...
0
votes
0answers
20 views

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

Cannot find elpy-format-code

I have yapf installed, and would like to run it automatically. Documentation says there is a way: http://elpy.readthedocs.io/en/latest/ide.html#command-elpy-format-code but I don't see it in the ...
1
vote
0answers
288 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 ...
1
vote
2answers
102 views

CSS mode won't indent values across multiple lines

When a line in my CSS file appears to be too long (typically a property followed by a bunch of values), I want to split them in to several new lines like this: But I have to manually enter spaces ...
2
votes
0answers
33 views

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

I want to make format out its result to a variable instead of printing it

I am trying to build a URL from several components, format function seems to do what I want. However, it prints the url instead of assigning it to a variable. How do I do in Emacs equivalent of (...
4
votes
1answer
405 views

How to export org files to plain text files as it looks like in clean view?

I want to print org files or share them with in emails. Clean view looks good for these purposes. Is it possible to export org files so that the output text file looks exactly like clean view (of ...
6
votes
1answer
199 views

Formatting of usepackage commands in LaTeX document

I'm trying to use AUCTeX edit LaTeX files. The beginning of the document I just wanted to edit looks like this: It's not neatly organized, inconsistent in many ways, and I should probably change it ...
0
votes
1answer
447 views

How do you correctly escape characters in string for example %

I am trying to escape some text for a shell command, but i am gettig stuck with this error. Not enough arguments for format string From what i can tell its trying to interpret the % symbols. This ...
3
votes
1answer
261 views

Automatically reformat org buffers

I make intensive use of org-mode and it boosts my productivity significantly. But I'm missing the possibility to adjust the space between headings automatically. On the one hand I want to define the ...
2
votes
1answer
67 views

Why does M-x underline-region doesn't work?

I don't know if I'm using the command correctly or not. I select the region to be underlined and then pass the command M-x underline-region and it doesn't work. For example if the text is SAMPLE ...
0
votes
0answers
238 views

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-\ (...
3
votes
2answers
255 views

How can I use par as my paragraph formatter

I'm coming from vim, which has a gq operator that acts much like emacs' fill-paragraph function (M-q). There's a 'formatprg' setting that allows you to point gq at an external program for its ...
11
votes
1answer
592 views

How to keep indented under plain list items in org-mode

While regular paragraphs are happily indented under plain list items (using [SPACE] bar to indent the first line takes the rest along with) I have noticed that code blocks do not like to cooperate. Is ...
0
votes
2answers
30 views

How to format a string variable to only show the first x number of characters?

I have a string variable, specifically the emacs-version variable that can be quite long and I am only using message with the first 4 of those characters. Is there a way to format the variable in a ...
1
vote
1answer
196 views

How to set project-specific javscript indentation using js2-mode

I have several Javascript projects, where some projects use 2 spaces for indentation and other projects use 4 spaces for indentation. Is there a project-specific way to set the indentation? I am able ...
3
votes
0answers
231 views

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 ...
2
votes
0answers
38 views

Can one define custom delimiters for inline formatting in org mode? [duplicate]

The title says it quite straight, what I am looking for is the following: while *this* is bold, `that` should appear in a custom format Edit: This question is no duplicate of that although the ...
5
votes
1answer
614 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 ...
4
votes
0answers
101 views

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::...
1
vote
1answer
146 views

Transform selected text like a Python macro

I've only just started with Emacs (about 6 weeks now) so I'm not really familiar with its coding language. I was wondering if it was possible to write, for Emacs, the equivalent of a Python macro I ...
4
votes
2answers
504 views

Incrementing characters in Emacs, next to numbers?

You can place a pointer on a number, like 1, and increment it to 2. There are many alternatives on this. See also the Emacs Wiki: https://www.emacswiki.org/emacs/IncrementNumber 7 alternatives to ...
1
vote
1answer
282 views

Emacs indent AngularJS code to wrong level

It's really sad not to write well formatted angularJs code inside emacs, the image below shows what I am saying. What is happening inside the photo is that the code is already well formatted as it is,...
1
vote
5answers
291 views

How to swap two tab-separated values on a line, and generalize the process?

My file has one book listed per line, title first followed by a tab character, followed by the author's name. TITLE<TAB>AUTHOR TITLE<TAB>AUTHOR ... I want to swap the two fields, such ...
2
votes
1answer
223 views

How can I hide formatting marks after the formatting they define has been applied in markdown mode?

I am using markdown mode with the modifications suggested in the excellent answer I received to a previous question. My aim is to have basic rendering capabilities within emacs itself so I can ...
7
votes
1answer
80 views

Library that converts a Python output string to an Elisp data structure?

Say that I evaluate the following Python code: import inspect import scipy.ndimage.filters list (inspect.getargspec (scipy.ndimage.filters.gaussian_filter1d)) # => [['input', 'sigma', 'axis', '...