0

In a GUI Emacs without fringes, I would like to get rid of the '$' at the end of truncated lines such that lines can use the fill width of the window. I've tried:

  1. (set-display-table-slot standard-display-table 'truncation 0) : this replaced $ with a space (or an empty slot).
  2. (set-display-table-slot standard-display-table 'truncation nil) : this fall back to $

My question is thus how to display truncated lines without any truncation symbol on the right?

Here is a small mockup:

a) |Truncated lin$| -> Normal behavior
b) |Truncated lin…| -> Truncation symbol set to ?\…
c) |Truncated lin | -> Truncation symbol set to 0
d) |Truncated line| -> What I would like to obtain
Nicolas Rougier
  • 487
  • 3
  • 15
  • 1
    Emacs really wants to show you that the line is truncated. When you turn off the fringes, that overrides any ellipsis setting such as `truncate-string-ellipsis`. You'd have to take this up with the Emacs developers to get it changed. – rpluim Aug 10 '20 at 10:47
  • Are there any hack around it ? Like pretending the window is actually wider than physical size? – Nicolas Rougier Aug 10 '20 at 12:40
  • If you want to go down that route, you might as well hack xdisp.c:init_iterator to not display the '$'. Look for the handling of `no_special_glyphs` – rpluim Aug 10 '20 at 12:47
  • I was thinking of taking advantage of bidirectional display and pretending my line must be displayed right to left. Such are lines are aligned ti the right edge. – Nicolas Rougier Aug 10 '20 at 13:07
  • See the line `SET_GLYPH_FROM_CHAR (glyph, '$');` within `xdisp.c`. – lawlist Aug 10 '20 at 17:59
  • In fact I managed to do what I want in a regular buffer by inserting a "RIGHT-TO-LEFT MARK" at the front of the line but it doesn't work in the echo are where I'm interested to display it. The corresponding log in the `*Message*` buffer it right aligned but not in the echo area. – Nicolas Rougier Aug 10 '20 at 19:52
  • meant "buffer _is_ right aligned" – Nicolas Rougier Aug 10 '20 at 20:06

1 Answers1

1

I found a solution by "abusing" the display table. In the below solution, msg is a string whose length is window width +1 (such as to display the truncation character). I then set the truncation character to the last character of the string.

 (set-display-table-slot
      (window-display-table (minibuffer-window))
      'truncation  (make-glyph-code (string-to-char (substring msg -1))))
 (message msg) 
Nicolas Rougier
  • 487
  • 3
  • 15