Subject: bug#68900: closed (Re: bug#68900: 29.1; Inconsistent Cursor Behavior when Executed as Lisp Code vs. Run by Key Binding)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 04 Feb 2024 06:34:02 +0000

Your bug report

#68900: 29.1; Inconsistent Cursor Behavior when Executed as Lisp Code vs. Run by Key Binding

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
68900: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=68900
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#68900: 29.1; Inconsistent Cursor Behavior when Executed as Lisp Code vs. Run by Key Binding
From: Eli Zaretskii <[email-masked]>
To: Jaft <[email-masked]>
Cc: [email-masked]
Date: Sun, 04 Feb 2024 08:32:49 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

> Date: Sat, 3 Feb 2024 22:23:25 +0000 (UTC)
> From: Jaft <[email-masked]>
> Cc: "[email-masked]" <[email-masked]>
> 
> Ahhh; you know, I was looking at Invisible Text (GNU Emacs Lisp Reference Manual) but missed the
> end where it talks about Adjusting Point. While I'd been wondering if "relocat[ing] point to the other
> side of the text" might be affecting this, I don't think I'd grasped that it'd be after the command runs,
> either.
> 
> Thanks so much for clarifying it (and pointing out where to look, in the documentation). Do I need to
> close this, in any way, or was you tagging it as "notabug" sufficient?

I'm closing the bug with this message.

Subject: 29.1; Inconsistent Cursor Behavior when Executed as Lisp Code vs. Run by Key Binding
From: Jaft <[email-masked]>
To: [email-masked]
Date: Fri, 02 Feb 2024 16:47:57 -0600
List-Id: <debbugs-submit.debbugs.gnu.org>

I've witnessed this with "emacs -Q" so I'm just going to give
instructions from that since that'll be similar for everyone.

After running "emacs -Q", switch to the "*scratch*" buffer (I do not
think the buffer matters for this but it's the quickest path for our
test). On the first line, M-: – eval. expression – the code
"(put-text-property (pos-bol) (1+ (pos-eol)) 'invisible t)" in order
to make the first line look as if it isn't there, at all.

Go down to the third line of the buffer and get to the beginning of it
(using C-a works fine).

If we M-: (point), we'll get the value we'd expect (I believe 145, if
we haven't modified the "*scratch*" buffer, any).

This is where the inconsistent behavior is: if we M-: (forward-line -1)
or M-: (previous-line) and, then, M-: (point), we'll get what (I would
think) we'd expect: point 72, the point of the beginning of the second
line.

BUT, if we do the above via key-binding – i.e. if, from point 145, we
press C-p to get to the line above – and, then, run M-: (point), we
get back the number 1.

Even if we run the exact same function the key is bound to, we get
different behavior between manually running the Lisp code and
executing is through key-binding.

I first discovered this through a function I had written on my own and
bound to a key in my own mode so it seems this affects all functions
pretty uniformly.

You can get similar behavior by making the "*scratch*" buffer entirely
visible – again – ((put-text-property (point-min) (point-max)
'invisible nil)), put some text on the third line (just to be able to
better see what's going on), run (put-text-property (pos-bol) (1+
(pos-eol)) 'invisible t) on the /second/ line, and go to anywhere in
the middle of the third line.

If you run M-: (move-beginning-of-line 1) and then M-: (point), you'll
get 145 but doing C-a and then M-: (point) will yield you 72 (the
beginning of line 2).

In GNU Emacs 29.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.37,
cairo version 1.16.0)
System Description: Guix System

Configured using:
 'configure
 CONFIG_SHELL=/gnu/store/v9p25q9l5nnaixkhpap5rnymmwbhf9rp-bash-minimal-5.1.16/bin/bash
 SHELL=/gnu/store/v9p25q9l5nnaixkhpap5rnymmwbhf9rp-bash-minimal-5.1.16/bin/bash
 --prefix=/gnu/store/66zk4dm1as1lpvnnrjgvppl2fqq3jzj0-emacs-pgtk-xwidgets-29.1
 --enable-fast-install --with-xwidgets --with-pgtk --with-cairo
 --with-modules --with-native-compilation=aot --disable-build-details'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ
JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3
THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER XIM XWIDGETS GTK3 ZLIB

Important settings:
  value of $EMACSLOADPATH: /home/jaft/.guix-profile/share/emacs/site-lisp:/home/jaft/.guix-profile/share/emacs/site-lisp:/gnu/store/66zk4dm1as1lpvnnrjgvppl2fqq3jzj0-emacs-pgtk-xwidgets-29.1/share/emacs/29.1/lisp
  value of $LANG: en_US.utf8
  locale-coding-system: utf-8-unix

Major mode: ELisp/l

Minor modes in effect:
  smerge-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  auto-revert-mode: t
  text-scale-mode: t
  company-mode: t
  doom-modeline-mode: t
  server-mode: t
  projectile-rails-global-mode: t
  flycheck-mode: t
  shell-dirtrack-mode: t
  marginalia-mode: t
  all-the-icons-ivy-rich-mode: t
  ivy-rich-mode: t
  xterm-mouse-mode: t
  delete-selection-mode: t
  term-keys-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-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
  column-number-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:
~/MEGA/gits/Emacs-Klondike/klondike hides /home/jaft/.emacs.d/elpa/klondike-20240106.2235/klondike
/home/jaft/.emacs.d/elpa/transient-20240106.1457/transient hides /gnu/store/66zk4dm1as1lpvnnrjgvppl2fqq3jzj0-emacs-pgtk-xwidgets-29.1/share/emacs/29.1/lisp/transient
/home/jaft/.emacs.d/elpa/flim-20231214.2336/sasl hides /gnu/store/66zk4dm1as1lpvnnrjgvppl2fqq3jzj0-emacs-pgtk-xwidgets-29.1/share/emacs/29.1/lisp/net/sasl
/home/jaft/.emacs.d/elpa/hierarchy-20190425.842/hierarchy hides /gnu/store/66zk4dm1as1lpvnnrjgvppl2fqq3jzj0-emacs-pgtk-xwidgets-29.1/share/emacs/29.1/lisp/emacs-lisp/hierarchy
/home/jaft/.emacs.d/elpa/seq-2.24/seq hides /gnu/store/66zk4dm1as1lpvnnrjgvppl2fqq3jzj0-emacs-pgtk-xwidgets-29.1/share/emacs/29.1/lisp/emacs-lisp/seq

Features:
(shadow mew-varsx mew-unix mew-auth mew-config mew-imap2 mew-imap
mew-nntp2 mew-nntp mew-pop mew-smtp mew-ssl mew-ssh mew-net
mew-highlight mew-sort mew-fib mew-ext mew-refile mew-demo mew-attach
mew-draft mew-message mew-thread mew-virtual mew-summary4 mew-summary3
mew-summary2 mew-summary mew-search mew-pick mew-passwd mew-scan
mew-syntax mew-bq mew-smime mew-pgp mew-header mew-exec mew-mark
mew-mime mew-edit mew-decode mew-encode mew-cache mew-minibuf
mew-complete mew-addrbook mew-local mew-vars3 mew-vars2 mew-vars
mew-env mew-mule3 mew-mule mew-gemacs mew-key mew-func mew-blvs
mew-const mew emacsbug pym static poe apel-ver product elfeed-show
elfeed-search magit-bookmark bookmark elfeed-csv elfeed elfeed-curl
elfeed-log elfeed-db elfeed-lib xml-query jedi jedi-core
python-environment epc ctable concurrent deferred python treesit
markdown-mode edit-indirect mm-archive url-cache url-http url-auth
url-gw display-line-numbers mail-extr dictionary dictionary-connection
checkdoc dired-x apropos cus-edit cus-start cus-load dired-aux
web-mode macros mode-local align-let loadhist git-rebase pcmpl-args
pcmpl-linux pcmpl-unix tramp-adb tramp-archive tramp-cache time-stamp
tramp-cmds tramp-container tramp-ftp tramp-gvfs tramp-sh magit-popup
magit-bundle magit-gitignore magit-patch magit-subtree pp completion
rectangular-region-mode mc-hide-unmatched-lines-mode mc-mark-more
mc-cycle-cursors multiple-cursors-core guix-build-log guix-utils
bui-utils guix latexenc rect em-unix em-term term ehelp em-script
em-prompt em-ls em-hist em-pred em-glob em-extpipe em-cmpl em-dirs
esh-var em-basic em-banner em-alias esh-mode eshell esh-cmd esh-ext
esh-opt esh-proc esh-io esh-arg esh-module esh-groups esh-util
ac-geiser flymake-proc flymake auto-complete popup geiser-mode
geiser-xref geiser-compile geiser-racket geiser-guile info-look geiser
geiser-debug geiser-repl geiser-image geiser-capf geiser-doc
geiser-menu geiser-autodoc geiser-edit geiser-completion geiser-eval
geiser-connection tq geiser-syntax geiser-log geiser-popup view
geiser-impl geiser-custom geiser-base hideshow scheme find-dired
cl-print debug backtrace goto-addr shortdoc help-fns radix-tree vc-hg
vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs log-view vc bug-reference
oc-basic disp-table ol-eww eww 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 gnutls dig gnus-sum shr pixel-fill kinsoku url-file svg dom
gnus-group gnus-undo gnus-start gnus-dbus dbus xml gnus-cloud nnimap
nnmail mail-source utf7 nnoo gnus-spec gnus-int gnus-range gnus-win
gnus nnheader range ol-docview doc-view jka-compr image-mode exif
ol-bibtex bibtex ol-bbdb ol-w3m ol-doi org-link-doi magit-extras
network-stream nsm misearch multi-isearch hl-line vc-git vc-dispatcher
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 magit-diff smerge-mode diff diff-mode git-commit log-edit
pcvs-util add-log magit-core magit-autorevert autorevert filenotify
magit-margin magit-transient magit-process with-editor magit-mode
transient magit-git magit-base magit-section cursor-sensor crm bongo
lastfm-submit edmacro kmacro conf-mode ffap pulse face-remap
klere-theme company-oddmuse company-keywords company-etags
company-gtags company-dabbrev-code company-dabbrev company-files
company-clang company-capf company-cmake company-semantic
company-template company-bbdb company-robe company doom-modeline
doom-modeline-segments doom-modeline-env doom-modeline-core
shrink-path nerd-icons nerd-icons-faces nerd-icons-data
nerd-icons-data-mdicon nerd-icons-data-flicon nerd-icons-data-codicon
nerd-icons-data-devicon nerd-icons-data-sucicon nerd-icons-data-wicon
nerd-icons-data-faicon nerd-icons-data-powerline
nerd-icons-data-octicon nerd-icons-data-pomicon
nerd-icons-data-ipsicon flyspell ispell mizik sort mule-util libmpdee
wid-edit klondike disdis glise gamegrid klere-fos klere-fos--init-game
klere-fos--level1 klere-fos--town-maps klere-fos--maps
klere-fos--matrix-unit-metadata klere-fos--matrices
klere-fos--dialog-exposition klere-fos--game-data klere-fos--items
klere-fos--characters klere-fos--utils klere-fos--constants org-mime
message sendmail yank-media puny rfc822 mml mml-sec epa epg rfc6068
epg-config gnus-util mm-decode mm-bodies mm-encode mail-parse rfc2231
rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils
gmm-utils mailheader 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
org-element org-persist org-id org-refile avl-tree org ob ob-tangle
ob-ref ob-lob ob-table ob-exp org-macro org-src ob-comint
org-pcomplete org-list org-footnote org-faces org-entities
ob-emacs-lisp ob-core ob-eval org-cycle org-table ol org-fold
org-fold-core org-keys oc org-loaddefs cal-menu calendar cal-loaddefs
org-version org-compat org-macs noutline outline server pinentry
java-repl rust-repl projectile-rails rake f inflections inf-ruby
ruby-mode smie autoinsert projectile lisp-mnt grep ibuf-ext ibuffer
ibuffer-loaddefs flycheck-pyflakes tide tide-lv thingatpt imenu s
etags fileloop generator flycheck find-func dash text-reading-mode
derived smart-tabs-mode advice tramp tramp-loaddefs trampver
tramp-integration files-x tramp-compat shell pcomplete parse-time
iso8601 time-date format-spec marginalia compat globalff term/xterm
xterm cl counsel xdg xref project dired dired-loaddefs compile
text-property-search comint ansi-osc ansi-color swiper comp comp-cstr
warnings icons cl-extra help-mode all-the-icons-ivy-rich all-the-icons
all-the-icons-faces data-material data-weathericons data-octicons
data-fileicons data-faicons data-alltheicons ivy-rich ivy ring
ivy-faces ivy-overlay colir color ido window-size easy-mmode xt-mouse
delsel term-keys finder-inf guix-emacs 2048-game-autoloads
ac-alchemist-autoloads ac-cider-autoloads ac-geiser-autoloads
ac-html-autoloads ac-inf-ruby-autoloads alchemist-autoloads
align-let-autoloads all-the-icons-ivy-rich-autoloads
all-the-icons-autoloads android-mode-autoloads async-autoloads
async-await-autoloads auctex-autoloads tex-site
bash-completion-autoloads bongo-autoloads bundler-autoloads
ceylon-mode-autoloads circe-notifications-autoloads alert-autoloads
circe-autoloads company-restclient-autoloads counsel-autoloads
csv-mode-autoloads dap-mode-autoloads docker-compose-mode-autoloads
dockerfile-mode-autoloads doom-modeline-autoloads ejc-sql-autoloads
clomacs-autoloads cider-autoloads clojure-mode-autoloads
elfeed-autoloads elixir-mode-autoloads ement-autoloads
enh-ruby-mode-autoloads fira-code-mode-autoloads fireplace-autoloads
flycheck-guile-autoloads flycheck-package-autoloads
flycheck-pyflakes-autoloads flymake-elixir-autoloads
flymake-ruby-autoloads flymake-sass-autoloads flymake-easy-autoloads
fountain-mode-autoloads geiser-guile-autoloads geiser-kawa-autoloads
geiser-racket-autoloads gntp-autoloads gnus-desktop-notify-autoloads
google-translate-autoloads guix-autoloads rx edit-indirect-autoloads
bui-autoloads geiser-autoloads haskell-mode-autoloads
heex-ts-mode-autoloads hierarchy-autoloads iter2-autoloads
ivy-rich-autoloads ivy-youtube-autoloads javadoc-lookup-autoloads
jedi-autoloads auto-complete-autoloads jedi-core-autoloads
epc-autoloads ctable-autoloads concurrent-autoloads klondike-autoloads
know-your-http-well-autoloads log4e-autoloads lsp-docker-autoloads
lsp-treemacs-autoloads lsp-mode-autoloads lua-mode-autoloads
magit-autoloads pcase git-commit-autoloads magit-popup-autoloads
marginalia-autoloads markdown-mode-autoloads mastodon-autoloads
md4rd-autoloads meghanada-autoloads company-autoloads mew-autoloads
mines-autoloads minesweeper-autoloads mingus-autoloads
libmpdee-autoloads multiple-cursors-autoloads mvn-autoloads
mw-thesaurus-autoloads nerd-icons-autoloads nov-autoloads
esxml-autoloads kv-autoloads nyan-mode-autoloads outorg-autoloads
package-lint-autoloads parseedn-autoloads parseclj-autoloads
pcmpl-args-autoloads pcmpl-pip-autoloads persist-autoloads
pianobar-autoloads pinentry-autoloads plz-autoloads
podcaster-autoloads popup-autoloads projectile-rails-autoloads
inflections-autoloads projectile-autoloads promise-autoloads
python-environment-autoloads deferred-autoloads qml-mode-autoloads
queue-autoloads racer-autoloads pos-tip-autoloads
racket-mode-autoloads rainbow-blocks-autoloads
rainbow-delimiters-autoloads rake-autoloads request-autoloads
restclient-autoloads robe-autoloads inf-ruby-autoloads
ruby-end-autoloads rust-mode-autoloads scheme-complete-autoloads
sesman-autoloads shrink-path-autoloads simple-httpd-autoloads
snow-autoloads spinner-autoloads svg-lib-autoloads swiper-autoloads
ivy-autoloads taxy-magit-section-autoloads taxy-autoloads
magit-section-autoloads term-keys-autoloads tide-autoloads
flycheck-autoloads pkg-info-autoloads epl-autoloads
transient-autoloads tree-mode-autoloads treemacs-autoloads
cfrs-autoloads posframe-autoloads ht-autoloads hydra-autoloads
lv-autoloads pfuture-autoloads ace-window-autoloads avy-autoloads
ts-autoloads typit-autoloads mmt-autoloads f-autoloads dash-autoloads
s-autoloads w3m-load w3m-autoloads wanderlust-autoloads semi-autoloads
flim-autoloads oauth2-autoloads apel-autoloads
web-completion-data-autoloads web-mode-autoloads with-editor-autoloads
info compat-autoloads seq-autoloads yaml-autoloads yaml-mode-autoloads
yasnippet-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/pgtk-win pgtk-win
term/common-win pgtk-dnd 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
xwidget-internal dbusbind inotify dynamic-setting system-font-setting
font-render-setting cairo gtk pgtk lcms2 multi-tty
make-network-process native-compile emacs)

Memory information:
((conses 16 425358515 1451162)
 (symbols 48 70090 451)
 (strings 32 701621 234796)
 (string-bytes 1 23197571)
 (vectors 16 161184)
 (vector-slots 8 3322866 1066233)
 (floats 8 2876 7865)
 (intervals 56 220756 82095)
 (buffers 984 102))