Emacs word wrap not working in horizontal split mode - emacs

I am looking at some C++ code and when using horizontal split screen toggle-truncate lines does not seem to work.

For narrow windows, Emacs takes the value of the variable truncate-partial-width-windows into account. By default, it truncates windows that are narrower than 50 characters, but you can set it to always truncate horizontally split windows (t), or set it to nil to respect the value of truncate-lines (which toggle-truncate modifies).

Related

Select * from showing blank in PSQL shell after changing data type to binary

I'm using Ecto/Elixir with Postgres and I created a field with the binary datatype. Everything is working OK except that now when I make a simple query: Select * from "table name"; the sql shell shows only blank and seems that didn't like it...
What should I do to see these contents?
By default, psql display contents in cells aligned inside a grid. Each column is made wide enough to accodomate the largest value in it, and the smaller contents get blank-padded. When a column is much wider than the size of its containing window, entire pages of contents appear to be blank because of all the padding inside giant column(s) and the wrapping across consecutive lines.
The simplest workaround against that is to turn off alignement, with
\pset format unaligned or the on/off shortcut \a
Sometimes it's also interesting to use horizontal scrolling. Personally I use less as a pager with LESS=-FX as options and occasionally run inside psql:
\setenv LESS -FXS
then when displaying a result larger than the window, it does not wrap horizontally and the left and right cursor keys allow to scroll horizontally.
Also even when not using -S and when horizontal wrapping occurs, it's still possible with less to switch to horizontal scrolling/paging by hitting the right cursor key → or ESC) :
ESC-) or RIGHTARROW
Scroll horizontally right N characters, default half the screen width (see the -#
option). If a number N is specified, it becomes the default for future RIGHTARROW
and LEFTARROW commands. While the text is scrolled, it acts as though the -S option
(chop lines) were in effect.

increase 'buffer' column width in buffer list view

I am working with rather longish file names and when viewing the buffer list, the width of the Buffer column is too short for my purposes.
How can I increase that width (at the expense of, say, the width of the Mode or the File columns).
Width I am trying to increase marked with yellow in the screenshot below:
In Emacs 24.3 and later, this is controlled by the variable Buffer-menu-name-width, which defaults to 19 on my system. Something like
(setq Buffer-menu-name-width 40)
should help. Alternatively, you can use something like M-x customize-variable to change it.
In older Emacs versions, Buffer-menu-buffer+size-width should be modified instead. Thanks to the OP for his edit pointing this out.
It looks like the File column fills up whatever space is left over, so this change should take space away from it. If you prefer to take space from the Mode column, you could also modify the Buffer-menu-mode-width variable to something smaller.

Display consecutive whitespace as dots in Emacs

This answer nicely provides a way to display characters rather than tabs (in the example it suggests ">", but I confirmed it works for ".").
It uses setting the active window display table to do it.
Now my goal is to display 4 spaces as 4 dots. Using the font-face and a regular expression, I am confident that I can display it nicely. I am aware that I could have Emacs automatically use tab characters rather than whitespaces, but I always prefer to have whitespace characters in my files.
I've also looked at whitespace mode, but I tweaked many parameters and in the end I never get the simple dots (with a face that makes it a little less "jump" out).
So: how can I, rather than display tab characters as dots, display 4 spaces elegantly as dots in Emacs?
OK, here's how to mark 4 or more spaces at beginning of line
(setq whitespace-space-regexp "^\\( \\{4,\\}\\)")
And here's how to get rid of the centered dot character for space:
(setq whitespace-display-mappings
'((space-mark ?\ [?\ ] [?.])
(space-mark ?\xA0 [?\ ] [?_])
(newline-mark ?\n [?$ ?\n])
(tab-mark ?\t [?\u00BB ?\t] [?\\ ?\t])))
The changes take effect not immediately but when you revert-buffer or
close it and open again with customizations above already set.

Is there a quick way in Emacs to word wrapping?

Is there a quick and easy way to word wrap like "Apply Word Wrap" function of KDE's Kate?
Enter to wrapping mode = M-x auto-fill-mode
Wrap text = select text -> M-q
While the mishadoff's answer is great for default word wrapping, I once had to re-implement it because I wasn't content with the way Emacs did it, so I tried to scratch the bits of it together and here it is: http://pastebin.com/75q65hRf in case you need it.
With that bit of code you can configure what characters to wrap on, what characters terminate words, and also set exception rules for when the characters that would've otherwise break the line won't do it. It may also pad the created column on the right and on the left (I was using this function to format and display documentation text).

Emacs - fixed tab width

I'm editing a text-document styled on its own way of which Emacs doesn't recognize the markup, and opens it in fundamental-mode. Tab indentation is the most problematic behaviour.
Can I fix tab width with a runtime command, only for the current session?
Particularly I'd avoid any permanent in-file configuration.
You can use M-x set-variable to set variables at runtime and only for that buffer and session, ideally you can set the offset variable (for instance in c-common-mode it's c-basic-offset) and you can change this value to the desired tab width (although I recommend you use spaces instead of tabs for consistency as tab characters \t are usually 8 spaces wide.