0

I'm trying to set unicode characters for the truncation and wrap slots in the standard display table (see code below) that are used in terminal mode or GUI when there is no fringe. It is working for truncated lines, but not for wrapped lines: the ↩︎ is not displayed and is replaced by an hollow box. I suspect I may have to use make-glyph-code but I'm not sure of the syntax.

(set-display-table-slot standard-display-table 'truncation ?…)
(set-display-table-slot standard-display-table 'wrap       ?↩︎)

Solution:

The problem was the "↩︎" glyph being substituted by the glyph from a fallback font (Fira Code in my case). I'm not sure this is a bug but here is the solution:

(defface fallback '((t :family "Fira Code"))  "Display")
(set-display-table-slot standard-display-table 'wrap
                        (make-glyph-code ?↩ 'fallback))
  • This is interesting ... The only word-wrap looking character I have seen is a bitmap image that appears on the fringe for GUI versions of Emacs, or built-in to the display for terminal versions and GUI versions with no fringe. How can we as forum participants generate a minimal working example of what you term as 'wrap or wrap slots? – lawlist May 11 at 13:49
  • Just to clarify, what do you mean by "it doesn't work"? Is there an error, or does it use the wrong character? I ask because your wrap character is a LEFTWARDS ARROW WITH HOOK followed by a VARIATIONAL SELECTOR-15, which give a syntax error; I guess the lisp parser doesn't like combining characters in that read syntax. – db48x May 11 at 13:59
  • For GUI, you need to remove the fringe and emacs will use the character in the display-table-slot for indicating a truncated (default is $) or wrapped line (default is `). The term slot comes from the documentation of the set-display-table-slot` function. – Nicolas Rougier May 11 at 14:01
  • @db48x Thansk, the VARIATIONAL SELECTOR-15 was an error. I clarified the question. – Nicolas Rougier May 11 at 14:09
  • ↩︎ cannot work, gui emacs only displays a bordered block, but ¬ works.Perhaps because ¬ belongs to : Latin-1 Supplement but ↩︎ is a complicated unicode? Arrows (Unicode block) - Wikiwand – wwulfric Aug 24 at 16:32
0

(set-display-table-slot·buffer-display-table 'wrap ?↩) works for me, with one caveat. In a terminal the arrow shows up correctly, but in the gui (with fringe-mode turned off), the glyph is drawn with a replacement character; apparently it couldn't find a glyph for the arrow in the chosen font. It does render correctly in the scratch buffer, but it's using a slightly different font in the fringe.

Note that in the code you put in your question, you have a second character after the ?, which makes it invalid syntax. I assume the error you're getting is (invalid-read-syntax "?"), since you didn't say.

| improve this answer | |
  • Thanks, you're right. describe-char tells me the font for the glyph is actually different. But I don't understand why the substitution is not made during the display. – Nicolas Rougier May 11 at 14:13
  • It apparently just doesn't use font fallback when drawing those characters. It might just be an oversight; you could use M-x report-emacs-bug and find out. – db48x May 11 at 14:19
  • Can you test with emacs-27 or emacs-master first, before opening a bug? – rpluim May 11 at 15:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.