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

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
0answers
35 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
22 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
95 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)...
1
vote
1answer
27 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
54 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
39 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
28 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
91 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
44 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
24 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
30 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 ...
0
votes
0answers
38 views

Indentation of ternary expressions in C/C++ mode

Currently, I'm using a slight modified version of google-c-style package to deal with the format of my C++ code. Everything just fine except the indentation of the ternary expressions. What I want is ...
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
90 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
136 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
81 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
159 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
91 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
94 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
19 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
58 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
244 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
98 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
30 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
362 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
184 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
403 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
238 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
64 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
227 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
248 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 ...
10
votes
1answer
527 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
188 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
218 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
35 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
558 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
94 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
133 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
456 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
276 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
273 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
199 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
77 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', '...
1
vote
1answer
943 views

Org-mode font size changes with formatting

In Windows I've set my default font height to 120 with: (set-face-attribute 'default nil :height 120) This seems to not take effect in org-mode, however, when specially formatting is applied. For ...