Subject: bug#72862: 29.1; Strange interaction between append-next-kill and kill-whole-line

From: Sean McAfee <[email-masked]>
Date: Wed, 28 Aug 2024 14:12:11 -0700

Starting from emacs -Q:

- Enter the text "12345\n" in the scratch buffer.
- Kill the text by any means, eg: C-SPC C-p C-w
- Enter the text "ABCDE" and put point on the C.
- Run append-next-kill with C-M-w and then kill-whole-line with
C-S-<backspace>.
- Yank the most recent kill with C-y.

The text I get back is "AB12345\nCDE".  Apparently the killed whole line
is being wrapped around the preceding kill, at the place where point
was, rather than being appended to it.

Looking at the documentation for append-next-kill, I now see that it
prepends to the most recent kill in some circumstances, which I hadn't
been aware of.  So, the wrapping behavior I see from kill-whole-line
could be the result of two separate kills, one backward from point to
the beginning of the line and one forward from point to the end of the
line.  But this seems to be pretty unintuitive behavior, and hard to
think of a good use case for.  kill-whole-line has its own
killing-forward and killing-backward semantics, which I would expect to
carry over to append-next-kill.

In GNU Emacs 29.1 (build 1, aarch64-apple-darwin21.6.0, NS
 appkit-2113.60 Version 12.6.6 (Build 21G646)) of 2023-08-16 built on
 armbob.lan
Windowing system distributor 'Apple', version 10.3.2487
System Description:  macOS 14.6.1

Configured using:
 'configure --with-ns '--enable-locallisppath=/Library/Application
 Support/Emacs/${version}/site-lisp:/Library/Application
 Support/Emacs/site-lisp' --with-modules 'CFLAGS=-DFD_SETSIZE=10000
 -DDARWIN_UNLIMITED_SELECT' --with-x-toolkit=no'

Configured features:
ACL GLIB GMP GNUTLS JPEG JSON LIBXML2 MODULES NOTIFY KQUEUE NS PDUMPER
PNG RSVG SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Slack Thread Message

Minor modes in effect:
  async-bytecomp-package-mode: t
  emojify-mode: t
  recentf-mode: t
  emms-mode-line-mode: t
  emms-playing-time-display-mode: t
  emms-playing-time-mode: t
  tracking-mode: t
  volatile-highlights-mode: t
  projectile-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  shell-dirtrack-mode: t
  server-mode: t
  cursor-sensor-mode: t
  cursor-intangible-mode: t
  global-flycheck-mode: t
  flycheck-mode: t
  minibuffer-depth-indicate-mode: t
  ido-vertical-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  override-global-mode: t
  desktop-save-mode: t
  winner-mode: t
  electric-pair-mode: t
  savehist-mode: t
  ido-everywhere: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  global-prettify-symbols-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
~/emacs/copilot.el/copilot hides ~/emacs/copilot
~/emacs/inf-ruby/inf-ruby hides
/Users/sean/.emacs.d/elpa/inf-ruby-20240627.2135/inf-ruby
/Users/sean/.emacs.d/elpa/transient-20240626.947/transient hides
/Applications/Emacs 3.app/Contents/Resources/lisp/transient
/Users/sean/.emacs.d/elpa/use-package-20230426.2324/use-package-jump hides
/Applications/Emacs
3.app/Contents/Resources/lisp/use-package/use-package-jump
/Users/sean/.emacs.d/elpa/use-package-20230426.2324/use-package-ensure
hides /Applications/Emacs
3.app/Contents/Resources/lisp/use-package/use-package-ensure
/Users/sean/.emacs.d/elpa/use-package-20230426.2324/use-package-core hides
/Applications/Emacs
3.app/Contents/Resources/lisp/use-package/use-package-core
/Users/sean/.emacs.d/elpa/use-package-20230426.2324/use-package-delight
hides /Applications/Emacs
3.app/Contents/Resources/lisp/use-package/use-package-delight
/Users/sean/.emacs.d/elpa/use-package-20230426.2324/use-package-diminish
hides /Applications/Emacs
3.app/Contents/Resources/lisp/use-package/use-package-diminish
/Users/sean/.emacs.d/elpa/use-package-20230426.2324/use-package hides
/Applications/Emacs 3.app/Contents/Resources/lisp/use-package/use-package
/Users/sean/.emacs.d/elpa/use-package-20230426.2324/use-package-bind-key
hides /Applications/Emacs
3.app/Contents/Resources/lisp/use-package/use-package-bind-key
/Users/sean/.emacs.d/elpa/bind-key-20230203.2004/bind-key hides
/Applications/Emacs 3.app/Contents/Resources/lisp/use-package/bind-key
/Users/sean/.emacs.d/elpa/use-package-20230426.2324/use-package-lint hides
/Applications/Emacs
3.app/Contents/Resources/lisp/use-package/use-package-lint
/Users/sean/.emacs.d/elpa/flim-20240221.1353/sasl hides /Applications/Emacs
3.app/Contents/Resources/lisp/net/sasl
/Users/sean/.emacs.d/elpa/seq-2.24/seq hides /Applications/Emacs
3.app/Contents/Resources/lisp/emacs-lisp/seq
/Users/sean/.emacs.d/elpa/eldoc-1.15.0/eldoc hides /Applications/Emacs
3.app/Contents/Resources/lisp/emacs-lisp/eldoc

Features:
(mailalias mailclient textsec uni-scripts idna-mapping uni-confusable
textsec-check shadow mail-extr emacsbug swiper ivy delsel ivy-faces
ivy-overlay colir ffap cus-start cal-move cl-print macros mode-local
ox-org ox-odt rng-loc rng-uri rng-parse rng-match rng-dt rng-util
rng-pttrn nxml-parse nxml-ns nxml-enc xmltok nxml-util ox-latex
ox-icalendar org-agenda ox-html table ox-ascii ox-publish ox
tramp-archive tramp-gvfs helm-unicode helm-utils helm-help helm
helm-global-bindings helm-easymenu helm-core async-bytecomp helm-source
helm-multi-match helm-lib async conf-mode tmm smartparens-markdown
markdown-mode display-line-numbers sh-script goto-addr vc-hg vc-bzr
vc-src vc-sccs vc-cvs vc-rcs log-view bug-reference shortdoc help-fns
radix-tree magit-extras face-remap ag vc-svn find-dired vc-annotate
misearch multi-isearch tramp-sh magit-bookmark bookmark tabify
org-datetree org-capture executable mc-edit-lines emojify apropos
tar-mode arc-mode archive-mode ht network-stream slack slack-company
slack-unread slack-websocket slack-thread-event slack-room-event
slack-star-event slack-reaction-event slack-reply-event slack-typing
slack-slash-commands slack-message-event slack-event
slack-dialog-edit-element-buffer slack-dialog-buffer slack-dialog
slack-stars-buffer slack-search-result-buffer
slack-thread-message-compose-buffer slack-file-list-buffer
slack-file-info-buffer slack-all-threads-buffer slack-message-buffer
slack-user-profile-buffer slack-pinned-items-buffer slack-pinned-item
slack-thread-message-buffer slack-room-info-buffer slack-room-buffer
slack-message-share-buffer slack-message-edit-buffer
slack-room-message-compose-buffer slack-message-compose-buffer
slack-message-attachment-preview-buffer slack-action slack-star
slack-reminder slack-search slack-message-reaction slack-message-editor
slack-message-sender slack-message-notification alert log4e
notifications gntp slack-buffer slack-message-formatter slack-thread
slack-im slack-channel slack-group slack-conversations
slack-create-message slack-attachment slack-selectable slack-bot-message
slack-user-message slack-file slack-message slack-message-faces
slack-unescape slack-block slack-mrkdwn slack-usergroup slack-reaction
slack-modeline slack-room slack-counts slack-user slack-bot
slack-dnd-status slack-emoji slack-image slack-request slack-log lui
flyspell ispell slack-team slack-team-ws slack-util websocket diary-lib
diary-loaddefs recentf tree-widget docker-tramp tramp-cache time-stamp
tramp tramp-loaddefs trampver tramp-integration files-x tramp-compat
mhtml-mode css-mode color java-ts-mode restclient protobuf-mode sql view
smartparens-python python yaml-ts-mode web-mode cap-words superword
subword smartparens-scala scala-mode scala-mode-prettify-symbols
scala-mode-imenu scala-mode-map scala-mode-fontlock scala-mode-indent
scala-mode-paragraph scala-mode-syntax scala-mode-lib org-bullets
oc-basic org-element org-persist org-id org-refile avl-tree ol-eww eww
xdg url-queue mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect
gnus-art mm-uu mml2015 mm-view mml-smime smime dig gnus-sum shr
pixel-fill kinsoku url-file svg gnus-group gnus-undo gnus-start
gnus-dbus gnus-cloud nnimap nnmail mail-source utf7 nnoo parse-time
gnus-spec gnus-int gnus-range gnus-win ol-docview doc-view jka-compr
image-mode exif ol-bibtex bibtex iso8601 ol-bbdb ol-w3m ol-doi
org-link-doi smartparens-org org org-macro org-pcomplete org-list
org-footnote org-faces org-entities noutline outline ob-emacs-lisp
org-table org-loaddefs cal-menu calendar cal-loaddefs perl6-detect
ruby-ts-mode gnus-dired copilot editorconfig editorconfig-core
editorconfig-core-handle editorconfig-fnmatch jsonrpc ert ewoc debug
backtrace warnings emms-idapi-browser emms-idapi emms-idapi-musicbrainz
emms-mpris dbus emms-librefm-stream xml emms-librefm-scrobbler
emms-playlist-limit emms-i18n emms-history emms-score emms-stream-info
emms-metaplaylist-mode emms-bookmarks emms-cue emms-mode-line-icon
emms-browser sort emms-volume emms-volume-sndioctl emms-volume-mixerctl
emms-volume-pulse emms-volume-amixer emms-playlist-sort emms-last-played
emms-player-xine emms-player-mpd tq emms-lyrics emms-url emms-streams
emms-show-all emms-tag-editor emms-tag-tracktag emms-mark emms-mode-line
emms-cache emms-info-native emms-info-native-spc emms-info-native-mp3
emms-info-native-ogg emms-info-native-opus emms-info-native-flac
emms-info-native-vorbis bindat emms-info-exiftool emms-info-tinytag
emms-info-metaflac emms-info-opusinfo emms-info-ogginfo
emms-info-mp3info emms-playlist-mode emms-player-vlc emms-player-mpv
emms-playing-time emms-info emms-later-do emms-player-mplayer
emms-player-simple emms-source-playlist emms-source-file locate
emms-setup emms emms-compat scribd-sentry scribd-airflow scribd-github
request scribd-devkube scribd-aws ob-ruby ob ob-tangle ol org-src ob-ref
ob-lob ob-table ob-exp ob-comint ob-core org-cycle org-fold
org-fold-core ob-eval org-keys oc org-compat org-version org-macs hmac
csv let-alist smartparens-config smartparens-javascript smartparens-text
smartparens-ruby smartparens-html smartparens-c smartparens loadhist
robe url-http url-auth url-gw nsm inf-ruby ruby-mode smie git-link
yasnippet git-timemachine vc-git whitespace dash-functional gnutls
tracking shorten ibuf-macs chruby treesit-auto xref-js2 vc vc-dispatcher
js2-mode js c-ts-common treesit cc-mode cc-fonts cc-guess cc-menus
cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs dired-filter f
dired-hacks-utils dired-aux dired-x shell-pop term disp-table ehelp
beginend volatile-highlights iedit iedit-lib
mc-hide-unmatched-lines-mode mc-mark-more tagedit s sgml-mode facemenu
dom mc-cycle-cursors multiple-cursors-core rect dtrt-indent advice
projectile lisp-mnt grep ibuf-ext ibuffer ibuffer-loaddefs
elisp-slime-nav etags fileloop generator xref project magit-submodule
magit-blame magit-stash magit-reflog magit-bisect magit-push magit-pull
magit-fetch magit-clone magit-remote magit-commit magit-sequence
magit-notes magit-worktree magit-tag magit-merge magit-branch
magit-reset magit-files magit-refs magit-status magit magit-repos
magit-apply magit-wip magit-log which-func imenu magit-diff smerge-mode
diff-mode git-commit log-edit message sendmail yank-media puny dired
dired-loaddefs rfc822 mml mml-sec epa derived mm-decode mm-bodies
mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev
gmm-utils mailheader pcvs-util add-log magit-core magit-autorevert
autorevert filenotify magit-margin magit-transient magit-process
with-editor shell pcomplete server magit-mode transient benchmark
magit-git magit-base magit-section format-spec cursor-sensor crm compat
ido-completing-read+ memoize cus-edit pp icons minibuf-eldef flycheck
find-func diminish gnus nnheader gnus-util time-date mail-utils range
mm-util mail-prsvr wid-edit autoinsert misc hl-line cus-load mb-depth
ido-vertical-mode undo-tree diff ack compile text-property-search
paredit edmacro kmacro dash cl-extra help-mode use-package
use-package-ensure use-package-delight use-package-diminish
use-package-bind-key bind-key easy-mmode use-package-core desktop
frameset finder-inf winner elec-pair savehist hippie-exp comint ansi-osc
ansi-color ring thingatpt ido cl company-autoloads counsel-autoloads
csv-autoloads cyberpunk-theme-autoloads dired-launch-autoloads
dtrt-indent-autoloads editorconfig-autoloads ein-autoloads
anaphora-autoloads emms-autoloads expand-region-autoloads fix-word
flycheck-autoloads folding-autoloads ghub-autoloads git-link-autoloads
git-timemachine-autoloads epg rfc6068 epg-config gnu-elpa-keyring-update
go-mode-autoloads helm-swoop-autoloads helm-autoloads
helm-core-autoloads async-autoloads htmlize-autoloads
ido-completing-read+-autoloads inf-ruby-autoloads json-mode-autoloads
lsp-metals-autoloads dap-mode-autoloads lsp-docker-autoloads
lsp-treemacs-autoloads lsp-ui-autoloads lsp-mode-autoloads f-autoloads
magit-autoloads pcase git-commit-autoloads magit-section-autoloads
markdown-mode-autoloads multiple-cursors-autoloads paredit-autoloads
pcre2el-autoloads pdf-tools-autoloads rx polymode-autoloads
popup-autoloads projectile-autoloads protobuf-mode-autoloads
sbt-mode-autoloads scala-mode-autoloads semi-autoloads flim-autoloads
apel-autoloads shell-pop-autoloads log4e-autoloads circe-autoloads
smartparens-autoloads swift-mode-autoloads swiper-autoloads
ivy-autoloads terraform-mode-autoloads hcl-mode-autoloads
transient-autoloads treemacs-autoloads posframe-autoloads
treesit-auto-autoloads dash-autoloads web-mode-autoloads
wfnames-autoloads with-editor-autoloads info compat-autoloads
xref-js2-autoloads js2-mode-autoloads yaml-mode-autoloads
yasnippet-autoloads zenburn-theme-autoloads package browse-url url
url-proxy url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs password-cache json subr-x
map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc
iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/ns-win ns-win
ucs-normalize mule-util term/common-win tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine 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 emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads kqueue cocoa ns multi-tty
make-network-process emacs)

Memory information:
((conses 16 12700605 1547711)
 (symbols 48 108731 71)
 (strings 32 926674 175903)
 (string-bytes 1 31629847)
 (vectors 16 310300)
 (vector-slots 8 10087589 1196626)
 (floats 8 5282 813)
 (intervals 56 617485 45290)
 (buffers 984 379))