Starting from emacs -Q: - Go to a new buffer named "foo". - Set the mark with C-SPC. - Go to a new buffer named "bar". - Set the mark with C-SPC. - Go back to buffer foo. - Set the mark with C-SPC. - Check the value of the global-mark-ring variable, as with C-h v or giving its name to the eval-expression command. The first marker in the ring is the one in buffer bar, not in buffer foo, even though buffer foo is where the mark was most recently set. This behavior contradicts what is described here: https://www.gnu.org/software/emacs/manual/html_node/emacs/Global-Mark-Ring.html To wit: "Each time you set a mark, this is recorded in the global mark ring in addition to the current buffer’s own mark ring, if you have switched buffers since the previous mark setting." I've tracked the reason for this to the push-mark-command function, which does not push the mark unless it's not at the same place as point, or if it's given a true argument. set-mark-command calls push-mark-command, but passes nil to it unless, puzzlingly, the command's name is not "set-mark-command". For a bit of background, what I want to do is to set the mark at the beginning of a sexp (actually JSON) in one buffer, then go to the start of another sexp in a different buffer, and run a command that compares the two sexps, using the marker at the front of the global mark ring to find the first sexp. But this is unreliable since setting the mark does not necessarily update the global mark ring. Workarounds I've considered include: - Call push-mark-command manually with M-x, or bind it to a key sequence, and call it with a prefix argument. - Alias set-mark-command as a new command with a different name, and use that instead. - Use a custom marker, updated from a custom command. Obviously, none of these are as convenient as using the global mark ring. And in any event, there's still a bug in Emacs, even if only a documentation bug. 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.7.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: ELisp/l Minor modes in effect: 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 elisp-slime-nav-mode: t global-git-commit-mode: t magit-auto-revert-mode: t auto-revert-mode: t shell-dirtrack-mode: t server-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 paredit-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 eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t global-prettify-symbols-mode: t 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-20240925.49/inf-ruby /Users/sean/.emacs.d/elpa/transient-20241023.1537/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: (shadow mail-extr emacsbug japan-util kkc ja-dic-utl quail url-cache pulse vc-annotate expand-region subword-mode-expansions text-mode-expansions cc-mode-expansions the-org-mode-expansions ruby-mode-expansions python-el-fgallina-expansions js2-mode-expansions js-mode-expansions html-mode-expansions css-mode-expansions er-basic-expansions expand-region-core expand-region-custom mc-edit-lines goto-addr ag find-dired tabify org-datetree org-capture sh-script display-line-numbers delsel tramp-sh completion docker-tramp tramp-cache tramp tramp-loaddefs trampver tramp-integration files-x tramp-compat elnode db web time-stamp fakir dotassoc kv noflet cl-indent cl-print magit-bookmark bookmark shortdoc help-fns radix-tree recentf tree-widget misearch multi-isearch executable vc-hg vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs log-view bug-reference magit-extras face-remap 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 json-mode json-snatcher css-mode color sql view java-ts-mode yaml-ts-mode restclient smartparens-python python 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 kotlin-mode kotlin-mode-indent kotlin-mode-lexer 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 ruby-ts-mode gnus-dired perl6-detect 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 compat-30 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-filter-autoloads dired-launch-autoloads dired-ranger-autoloads dired-hacks-utils-autoloads docker-autoloads dtrt-indent-autoloads editorconfig-autoloads ein-autoloads anaphora-autoloads emms-autoloads enh-ruby-mode-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 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 oauth2-autoloads smartparens-autoloads swift-mode-autoloads swiper-autoloads ivy-autoloads terraform-mode-autoloads hcl-mode-autoloads transient-autoloads treemacs-autoloads posframe-autoloads treepy-autoloads treesit-auto-autoloads volatile-highlights-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 7653353 1099840) (symbols 48 86385 1) (strings 32 645539 137118) (string-bytes 1 21255905) (vectors 16 363777) (vector-slots 8 11459569 492070) (floats 8 4731 140) (intervals 56 408064 16183) (buffers 984 303))