Subject: bug#29664: 26.0.90; Auto Hscroll Mode + Visual Line Mode + Truncate don't work well together

From: Kaushal Modi <[email-masked]>
Date: Mon, 11 Dec 2017 20:22:51 +0000

Hello,

I have noticed for a while that with auto-hscroll-mode set to the new value
'current-line, C-a and C-e do not work well with visual-line-mode and
truncation enabled.

I was able to recreate this consistently with this recipe:

1. Evaluate the below in emacs -Q scratch buffer

(defun do-setup ()
  (interactive)
  (setq auto-hscroll-mode 'current-line)
  (visual-line-mode)
  (toggle-truncate-lines 1)
  (end-of-buffer)
  (insert "\n\ndlkasdjf lkdkmnf kd aksdjkldj laksdjflkasdf aldksflakdjf
alksdjldf lksdfjldkj lkjdfad falksdflj asldkfjlasdf fjlaksdjflkj asdf
lasdkfalkds alsdfkj sdf lsdkfj sldkfjlksdjf asldkfjlksdjfowieur nxc"))

(global-set-key (kbd "C-c ;") #'do-setup)

2. Hit "C-c ;". That will set minor modes as in the do-setup function in
the scratch buffer and insert that arbitrary text, enough to wrap the lines
(and then show truncated). At this point, the point will be at the end of
the inserted text.

3. Now "C-a" won't work! It will only work after you do C-b at least once.
i.e. C-a does not work is point is at EOL.

4. Now with point at beginning of line after C-a, "C-e" will do something
weird.. it will take the point to the right only as far as shown in this
image (pasted/attached):

But the point will never reach the actual end of the line, no matter how
many times you hit "C-e".

In GNU Emacs 26.0.90 (build 27, x86_64-pc-linux-gnu, GTK+ Version 2.24.23)
 of 2017-12-11
Repository revision: 6a6e8e6e8d56fb8c4798ccfbabdf1f34d8857692
Windowing system distributor 'The X.Org Foundation', version 11.0.60900000
System Description:    Red Hat Enterprise Linux Workstation release 6.6
(Santiago)

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Mark set
do-setup [2 times]
Truncate long lines enabled

Configured using:
 'configure --with-modules
 --prefix=/home/kmodi/usr_local/apps/6/emacs/emacs-26
 '--program-transform-name=s/^ctags$/ctags_emacs/'
 --enable-checking=yes,glyphs --enable-check-lisp-object-type
 'CPPFLAGS=-I/home/kmodi/usr_local/6/include -I/usr/include/freetype2
 -I/usr/include' 'CFLAGS=-ggdb3 -O0' 'CXXFLAGS=-ggdb3 -O0'
 'LDFLAGS=-L/home/kmodi/usr_local/6/lib -L/home/kmodi/usr_local/6/lib64
 -ggdb3''

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK2 X11 MODULES

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=none
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  visual-line-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv
bytecomp byte-compile cconv dired dired-loaddefs format-spec rfc822 mml
easymenu mml-sec password-cache epa derived epg epg-config gnus-util
rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils edmacro kmacro cl-loaddefs cl-lib
elec-pair time-date mule-util tooltip eldoc electric uniquify ediff-hook
vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode elisp-mode lisp-mode prog-mode register page
menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core term/tty-colors frame cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote dbusbind inotify
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 97970 7858)
 (symbols 48 21030 1)
 (miscs 40 54 144)
 (strings 32 29288 1526)
 (string-bytes 1 786275)
 (vectors 16 15103)
 (vector-slots 8 514380 6572)
 (floats 8 51 77)
 (intervals 56 263 0)
 (buffers 992 11)
 (heap 1024 27119 866))

-- 

Kaushal Modi