Skip to main content
17 votes
Accepted

How to make emacs align and indent a bibtex entry?

When the cursor is somewhere in the entry, run the command bibtex-fill-entry (bound to C-c C-q), which will align the fields. You may also want to set variable bibtex-align-at-equal-sign to a non nil ...
Dan's user avatar
  • 33.2k
6 votes
Accepted

How to align specific columns, for several lines simultaneously?

You can use M-x align-regexp RET like RET. Thereby like stands for the regexp identifying the part of the line that should be aligned. Note that the variable align-to-tab-stop influences the ...
Tobias's user avatar
  • 33.4k
6 votes
Accepted

How to right-align with align-regex?

You use the "complex align"-form of align-regexp, i.e., call it as with universal prefix argument C-u M-x align-regexp RET. Use \(\s-*&[[:alnum:]_]+\) as regexp and -1 as group number. ...
Tobias's user avatar
  • 33.4k
5 votes

How to get align-regexp to help line up Markdown tables properly?

I wouldn't use align-regexp but the wonderful orgtbl-mode for this: if you enable this minor mode, it will automatically recognize the table, and change its size as needed (use tab to move around in ...
Rémi's user avatar
  • 1,617
4 votes

Understanding of emacs align-regexp

Not a deep answer to the original question, but I wrote a bit of code in response to a different question that shows how to make multiple columns out of a single column: https://emacs.stackexchange....
Kevin's user avatar
  • 1,328
3 votes
Accepted

Org mode tag column setting is ignored

Doom is meant to be configured via ~/.doom.d/config.el. Try setting the org-tags-column in that file. E.g.: ;; in ~/.doom.d/config.el (after! org (setq org-tags-column -80) ;; ... other org ...
mbil's user avatar
  • 46
3 votes

How to make emacs align and indent a bibtex entry?

As mentioned by @JonatanLindén, fill-prefix is set to a string containing 18 spaces. This is because bibtex-clean-entry is using fill-prefix to align continuing text after equal sign. Setting fill-...
Saddle Point's user avatar
3 votes

How to make emacs align and indent a bibtex entry?

I had a similar issue, when using the smartparens package in bibtex-mode, where shameful amounts of spaces where inserted. For some reason unknown, bibtex-mode sets the fill-prefix variable to a ...
Jonatan Lindén's user avatar
3 votes
Accepted

How to align grep output?

Here is the complete solution: (setcar (car grep-regexp-alist) "^\\(.+?\\)\\(:[ \t]*\\)\\([1-9][0-9]*\\)[ \t]*\\2") (defun eab/grep-align () (interactive) (read-only-mode -1) (toggle-...
artscan's user avatar
  • 445
3 votes

function to reshape a 1-column buffer list into N-columns with align-regexp

If you are on a UNIX-type system (Linux, BSD, OSX) you can use the paste command. Select the region in Emacs, then call shell-command-on-region with an argument (to replace the selection with the ...
Juancho's user avatar
  • 5,475
2 votes
Accepted

function to reshape a 1-column buffer list into N-columns with align-regexp

Here's my elisp function that shows how to make multiple columns out of a single column. Limitations include list elements cannot have whitespaces, and the width of the columns cannot be adjusted. My ...
Kevin's user avatar
  • 1,328
2 votes
Accepted

how to get web-mode to ignore alignment in favor of indentation during method chaining?

ah, turns out it's the web-mode-indentation-params list: (add-to-list '(web-mode-indentation-params) '("lineup-calls" . nil))
Dan O's user avatar
  • 161
2 votes
Accepted

emacs align-regexp

With indent-tabs-mode set to nil1, the following will do most of that: C-uM-x align-regexp RET ,\(\s-*\) RET RET y Dealing with the initial parameter is decidedly trickier. If you can guarantee the ...
phils's user avatar
  • 51.8k
2 votes
Accepted

shell script: emacs does not align case if pattern involves $

Based on the comments, it seems clear that there was a bug in sh-mode in Emacs 23.1 which was fixed in some subsequent version (certainly by 24.5). So that explains "what is wrong". If you cannot ...
phils's user avatar
  • 51.8k
2 votes
Accepted

Align the values of a JavaScript map

align-regexp is called non-interactively like that: (align-regexp BEG END REGEXP &optional GROUP SPACING REPEAT) The argument REGEXP of align-regexp is a regexp that should contain at least one ...
Tobias's user avatar
  • 33.4k
2 votes
Accepted

align doesn't indent multiple lines of C code correctly

align is aligning those // comments to the value of comment-column in that buffer, which will be column 32 by default. Your for statement extends beyond that column, so it is out of alignment. See C-...
phils's user avatar
  • 51.8k
2 votes

How to align both of comments and macro of multiple lines with space instead tabs for C/C++ code?

Without really knowing anything about this, can't you just define your own my-align or my-align-regexp command that invokes the standard command after binding indent-tabs-mode to nil? If, in that ...
Drew's user avatar
  • 78.1k
2 votes

Removing alignment in LaTeX align environment

I think you can get rid of any extra space that auctex adds, if you write it like this: \begin{align*} \|a+b+c\|^4 &= \left(\|a\|^2 + \|b\|^2 + \|c\|^2 + 2 \langle a, b \rangle + 2\langle ...
NickD's user avatar
  • 31.4k
2 votes
Accepted

Doom-emacs - How to align chinese characters in org-tables

Just use Hiragino Sans GB font! (setq doom-font (font-spec :family "Source Code Pro" :size 15 :weight 'normal :width 'normal) doom-variable-pitch-font (font-spec :family "Source ...
Ishmael7's user avatar
2 votes
Accepted

How can I create an Emacs keyboard macro to make Clojure code easier for humans to read it?

Spacemacs has a function named spacemacs/align-repeat that can almost do what you want. The way it works is that you highlight a region and then run this function on it interactively. It will ask ...
g-gundam's user avatar
  • 1,291
2 votes

How can I create an Emacs keyboard macro to make Clojure code easier for humans to read it?

Another way to do this in a more editor-agnostic way is to use zprint. It's a clojure formatter that's kind of crazy configurable, and there is a way to have it justify code. From emacs, you can ...
Chris Clark's user avatar
1 vote

How can I align indents for condition statements in AucTex algorithm section?

AUCTeX is able to indent conditionals better with this change. At the same time, the code in algpseudocode.el was adjusted to take advantage of this feature. If I take your example, indent the line ...
Arash Esbati's user avatar
  • 2,030
1 vote
Accepted

How can I align indents for condition statements in AucTex algorithm section?

Add the following to your init file: (with-eval-after-load 'latex (add-to-list 'LaTeX-indent-environment-list '("algorithmic" current-indentation))) That's the equivalent of the ...
NickD's user avatar
  • 31.4k
1 vote

Evenly spaced table-cells

If you use a mono-space font, the columns should align. There is no clear way to align columns in emacs using a variable-spaced font.
jeffkowalski's user avatar
1 vote
Accepted

Removing alignment in LaTeX align environment

You can remove ("align*" LaTeX-indent-tabular) from LaTeX-indent-environment-list and get the standard indent behaviour like multilines environment. You can get more information about this variable ...
gigiair's user avatar
  • 2,251
1 vote
Accepted

Lining up text with proportional fonts

See the Elisp manual, node Specified Space: To display a space of specified width and/or height, use a display specification of the form (space . PROPS), where PROPS is a property list (a list ...
Drew's user avatar
  • 78.1k
1 vote
Accepted

How do I align code on dot/period (.)?

Running the same command with different parameters: Complex align using regexp: \(\.\) Parenthesis group to modify (justify if negative): -1 Amount of spacing (or column if negative): 0 Repeat ...
choroba's user avatar
  • 2,085
1 vote

Go Lang Struct Align Text

M-x gofmt does this. Here is the output applied to your examples. package main type person struct { firstname string lastname string age int address string } const ( ...
Dusty's user avatar
  • 53
1 vote

Re-align text after a bigger symbol

I found a solution that basically uses this question to get the width of one char (based on font-get-glyphs), and then I use default-font-width to get the width of a column, and then I add a space ...
tobiasBora's user avatar
1 vote

How to make emacs align and indent a bibtex entry?

Usually, you would use the align-regexp command (or the align command if bibtex-mode supported it). But that won't help you with the broken indentation.
Nova's user avatar
  • 1,119

Only top scored, non community-wiki answers of a minimum length are eligible