1

Using a 80xN terminal, I'm seeing that lines that are exactly 80 characters long are wrapped and the 80th character is shown on a separate line:

wrapping

Is there some way to stop emacs from wrapping lines that are exactly 80 chars long? (Or rather, exactly $COLUMNS long?). And show them on one line while still wrapping lines that are > 80 chars long... After all, they do in fact fit on an $COLUMNS wide terminal.

A 2003 posting on help-gnu-emacs says:

Also, prior to Emacs 21, Emacs wasted a column for the "\" character that's used to indicate that a line has wrapped (Emacs 21 replaced this with a marker closer to the window border). So a line that's exactly the window's width would be wrapped -- the first n-1 characters would be on the line, then there would be a "\", and then the next line would contain the nth character.

Which describes my situation perfectly, except I'm running Emacs 24.4.1 according to (emacs-version).

(I'm investigating returning to Emacs after many years with Vim. And yes, I want to run Emacs in the terminal, as 99% of my development time I'm editing on remote servers)

  • 2
    Emacs has support for editing remote files using tramp, so you could run a local emacs under a windowing system. – rpluim Sep 10 '18 at 08:46
  • 1
    Note that "closer to the window border" isn't actually possible in a terminal. That text is describing how in GUI frames the fringe is now used to avoid unnecessary wrapping in such situations. – phils Sep 10 '18 at 09:40
  • I'm unfamiliar with all the mechanisms involved here, but I can see in the documentation that the continuation marker can be a character defined by the display table, and that there is zero-width character display option for glyphless characters. It's possible (although I'm not at all certain) this would successfully hide the continuation marker -- however I'm not seeing an obvious way to do so contextually. – phils Sep 10 '18 at 10:05
  • Assuming it's not supported, it seems like a reasonable feature request. – phils Sep 10 '18 at 10:06
  • Following on from @phils comment, the following sets the line continuation character to a zero width space, so lines that are exactly 80 characters long are displayed without a continuation. Unfortunately lines longer than that get truncated (let ((disptab (or buffer-display-table (setq buffer-display-table (make-display-table))))) (set-display-table-slot disptab 'wrap (gethash "ZERO WIDTH SPACE" (ucs-names)))) – rpluim Sep 11 '18 at 10:08
  • @rpluim: When I try your (let...), I get this in *Messages*: set-display-table-slot: Wrong type argument: hash-table-p, (("BELL (BEL)" . 7) ("VARIATION SELECTOR-256" . 917999) ("VARIATION SELECTOR-255" . 917998) ("VARIATION SELECTOR-254" . 917997) ("VARIATION SELECTOR-253" . 917996) ("VARIATION SELECTOR-252" . 917995) ("VARIATION SELECTOR-251" . 917994) ("VARIATION SELECTOR-250" . 917993) ("VARIATION SELECTOR-249" . 917992) ("VARIATION SELECTOR-248" . 917991) ... – Peter V. Mørch Sep 11 '18 at 11:11
  • 1
    Sorry, I'd forgotten that ucs-names used to be an alist. Try this instead (let ((disptab (or buffer-display-table (setq buffer-display-table (make-display-table))))) (set-display-table-slot disptab 'wrap (cdr (assoc "ZERO WIDTH SPACE" (ucs-names))))) – rpluim Sep 11 '18 at 11:43
  • @rpluim: Thanks yes I see. Sorta works, but doesn't wrap long lines, so I would've been better off with toggle-truncate-lines, which also is not what I want. – Peter V. Mørch Sep 11 '18 at 14:42
  • I don't think there's a good solution for what you want in -nw mode – rpluim Sep 11 '18 at 15:04

0 Answers0