0

In emacs when I scroll right and beginning of lines are truncated emacs inserts dollar sign same as it insert \ at the end of truncated line. I wish it would not insert these two signs. Can I disable this behavior?

Drew
  • 75,699
  • 9
  • 109
  • 225

2 Answers2

1

Are you asking how to turn off such line truncation? If so, the answer is M-x toggle-truncate-lines.

You can also set variable truncate-lines to nil in any given buffer. And you can set its default, global value using setq-default.

See the Emacs manual, node Line Truncation.

See also user option truncate-partial-width-windows.


You could discover this using command apropos-command or apropos with keyword truncate.


If you instead are asking how to change the chars used, $ and \, or how to have no chars indicate that truncation is in effect, I think the answer is that you cannot - that's coded in C source code.

Drew
  • 75,699
  • 9
  • 109
  • 225
  • To the extent that line truncation symbols appear in the `fringe` of a GUI version of Emacs, the symbols can be changed to another bitmap or eliminated using the `fringe-indicator-alist` with the cons-cell `car` of `truncation` / `continuation` and the `cdr` containing the bitmaps (another cons-cell for left/right indicators). – lawlist Jan 09 '20 at 23:59
  • @lawlist I feel like I need PHD to configure emacs. – Trismegistos Jan 10 '20 at 15:28
  • @Drew $ and \ are not hardcoded. When I enable fringe they dissapear but I don't want to see fringe either. – Trismegistos Jan 10 '20 at 15:29
  • If you think they're not coded in C then use or modify the Lisp code that you think they're coded in. – Drew Jan 10 '20 at 16:43
  • @Drew I would but $ and \ are distracting me – Trismegistos Jan 13 '20 at 15:32
0

What you're referring to is described in the manual:

As an alternative to continuation (*note Continuation Lines::), Emacs can display long lines by “truncation”. This means that all the characters that do not fit in the width of the screen or window do not appear at all. On graphical displays, a small straight arrow in the fringe indicates truncation at either end of the line. On text terminals, this is indicated with ‘$’ signs in the rightmost and/or leftmost columns.

It turns out this can be customized through the use of variable buffer-display-table whose docstring includes:

Display table that controls display of the contents of current buffer.

...

If this variable is nil, the value of ‘standard-display-table’ is used.

...

In addition, a char-table has six extra slots to control the display of:

the end of a truncated screen line (extra-slot 0, a single character);

the end of a continued line (extra-slot 1, a single character);

the escape character used to display character codes in octal (extra-slot 2, a single character);

...

See also the functions ‘display-table-slot’ and ‘set-display-table-slot’.

We follow the trail to the docstring of set-display-table-slot:

(set-display-table-slot DISPLAY-TABLE SLOT VALUE)

Set the value of the extra slot in DISPLAY-TABLE named SLOT to VALUE. SLOT may be a number from 0 to 5 inclusive, or a name (symbol). Valid symbols are ‘truncation’, ‘wrap’, ‘escape’, ‘control’, ‘selective-display’, and ‘vertical-border’.

So finally... If you haven't defined buffer-display-table you should set the truncation slot of standard-display-table to the wanted char, eg 32 for a space. To do so, you can add the following to your init file:

(set-display-table-slot standard-display-table 'truncation 32)
JeanPierre
  • 7,323
  • 1
  • 18
  • 37