(set-default 'truncate-lines t), and when moving to the end of the long line, is it possible to make Emacs scroll only that line, while the other lines stand still?
nano does this.
Emacs 26 has a new feature to horizontal scroll the current line when the variable
truncate-lines is also non-nil. The variable to control that new feature is
auto-hscroll-mode and the relevant portion from the doc-string reads: "... The value
'current-line means the line displaying point in each window is automatically scrolled horizontally to make point visible." The
auto-hscroll-mode variable is global. The variable
truncate-lines is buffer-local when set. My personal preference is to use
auto-hscroll-mode on a buffer-local basis, which generally means that the major-mode must be activated in the buffer before setting these variables:
(setq truncate-lines t) (setq-local auto-hscroll-mode 'current-line)
As suggested in a comment by @Basil hereinbelow, it would behoove anyone who is interested in the horizontal scrolling feature to read the relevant portion from the Emacs manual: https://www.gnu.org/software/emacs/manual/html_node/emacs/Horizontal-Scrolling.html [Inasmuch as Emacs 26 has not yet been officially released, it may be a few months before the on-line manual is updated with this particular new feature.]
In a comment by the O.P. underneath an alternative answer, there was a question about exclusions to a variable such as
truncate-lines. The way in which that particular variable is used does not contemplate exclusions. The default value is
nil. One could change the default value to a non-nil value using
setq-default, and override that setting on a buffer-local basis by using a major-mode hook to set the value to
Not with out-of-the-box Emacs, I believe. But maybe someone will kindly provide an answer (e.g. code) that does that.
My suggestion is to use
M-x report-emacs-bug to request this as an enhancement (that command is also for enhancement requests). Essentially, you want to be able to scroll a single line (or perhaps selected lines - the lines in the active region). That might be useful.