From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.bugs Subject: bug#35546: 27.0.50; setf return value for new alist entries is wrong Date: Fri, 03 May 2019 15:49:11 +0200 Message-ID: <87lfznzm08.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="12051"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: 35546@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri May 03 23:18:01 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hMfZ4-0017On-Bf for geb-bug-gnu-emacs@m.gmane.org; Fri, 03 May 2019 23:17:54 +0200 Original-Received: from localhost ([127.0.0.1]:41010 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hMYZn-0002Jc-8c for geb-bug-gnu-emacs@m.gmane.org; Fri, 03 May 2019 09:50:11 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:37455) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hMYZg-0002JM-Jy for bug-gnu-emacs@gnu.org; Fri, 03 May 2019 09:50:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hMYZe-0007sJ-UN for bug-gnu-emacs@gnu.org; Fri, 03 May 2019 09:50:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34574) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hMYZe-0007sA-Q9 for bug-gnu-emacs@gnu.org; Fri, 03 May 2019 09:50:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hMYZe-00073z-G6 for bug-gnu-emacs@gnu.org; Fri, 03 May 2019 09:50:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tassilo Horn Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 03 May 2019 13:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 35546 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.155689136527098 (code B ref -1); Fri, 03 May 2019 13:50:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 3 May 2019 13:49:25 +0000 Original-Received: from localhost ([127.0.0.1]:48117 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hMYZ3-00072y-3y for submit@debbugs.gnu.org; Fri, 03 May 2019 09:49:25 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:51145) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hMYZ1-00072m-KO for submit@debbugs.gnu.org; Fri, 03 May 2019 09:49:24 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:41547) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hMYYw-0007Lk-7S for submit@debbugs.gnu.org; Fri, 03 May 2019 09:49:18 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:37292) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hMYYu-0002ED-It for bug-gnu-emacs@gnu.org; Fri, 03 May 2019 09:49:18 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:48222) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hMYYu-0007Je-EY for bug-gnu-emacs@gnu.org; Fri, 03 May 2019 09:49:16 -0400 Original-Received: from auth2-smtp.messagingengine.com ([66.111.4.228]:33533) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.82) (envelope-from ) id 1hMYYu-0003yu-2Q for bug-gnu-emacs@gnu.org; Fri, 03 May 2019 09:49:16 -0400 Original-Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailauth.nyi.internal (Postfix) with ESMTP id F0B3622694 for ; Fri, 3 May 2019 09:49:14 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Fri, 03 May 2019 09:49:14 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrjedugdejvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkfgfgggtgfesthhqredttd erjeenucfhrhhomhepvfgrshhsihhlohcujfhorhhnuceothhsughhsehgnhhurdhorhhg qeenucfkphepudefgedrudduledrvdegrdduleehnecurfgrrhgrmhepmhgrihhlfhhroh hmpehthhhorhhnodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdekieejfeek jeekgedqieefhedvleekqdhtshguhheppehgnhhurdhorhhgsehfrghsthhmrghilhdrfh hmnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Original-Received: from jiffyarch (j289989.servers.jiffybox.net [134.119.24.195]) by mail.messagingengine.com (Postfix) with ESMTPA id 1F5EEE4649 for ; Fri, 3 May 2019 09:49:14 -0400 (EDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:158709 Archived-At: The docs of setf state: --8<---------------cut here---------------start------------->8--- setf is an autoloaded Lisp macro in =E2=80=98gv.el=E2=80=99. (setf PLACE VAL PLACE VAL ...) Probably introduced at or before Emacs version 24.3. Set each PLACE to the value of its VAL. This is a generalized version of =E2=80=98setq=E2=80=99; the PLACEs may be = symbolic references such as (car x) or (aref x i), as well as plain symbols. For example, (setf (cadr x) y) is equivalent to (setcar (cdr x) y). The return value is the last VAL in the list. --8<---------------cut here---------------end--------------->8--- According to the last sentence, I'd assume that (setq my-alist nil) (setf (alist-get 'foo my-alist) "foo-value") would return "foo-value", but infact it returns ((foo . "foo-value")). As soon as there is an association for 'foo, it returns the new value, i.e., "foo-value". So I'd say the return value is incorrect when setf adds a new entry to an alist. In GNU Emacs 27.0.50 (build 9, x86_64-pc-linux-gnu) of 2019-05-03 built on jiffyarch Repository revision: 9ae94ebdfa80cf3983c254696b5ab998f7296aec Repository branch: master System Description: Arch Linux Recent messages: 20190503T153517.050> Expiring articles... 20190503T153517.469> Expiring articles...done 20190503T153519.125> Saving Gnus registry (7833 entries) to ~/.gnus.d/.gnus= .registry.eieio... 20190503T153521.663> Saving Gnus registry (size 7833) to ~/.gnus.d/.gnus.re= gistry.eieio...done 20190503T153521.663> Saving /home/horn/.gnus.d/.newsrc.eld... Saving file /home/horn/.gnus.d/.newsrc.eld... Wrote /home/horn/.gnus.d/.newsrc.eld 20190503T153521.927> Saving /home/horn/.gnus.d/.newsrc.eld...done Making completion list... Configured using: 'configure --without-x --without-x-toolkit' Configured features: SOUND GPM DBUS NOTIFY INOTIFY ACL GNUTLS LIBXML2 ZLIB XIM THREADS LIBSYSTEMD PDUMPER GMP Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Group Minor modes in effect: hl-line-mode: t gnus-topic-mode: t rcirc-track-minor-mode: t intero-global-mode: t beacon-mode: t global-aggressive-indent-mode: t recentf-mode: t which-key-mode: t global-company-mode: t global-magit-file-mode: t magit-auto-revert-mode: t global-git-commit-mode: t async-bytecomp-package-mode: t shell-dirtrack-mode: t override-global-mode: t icomplete-mode: t minibuffer-depth-indicate-mode: t electric-pair-mode: t global-subword-mode: t subword-mode: t save-place-mode: t savehist-mode: t show-paren-mode: t gnus-undo-mode: t tooltip-mode: t global-eldoc-mode: t electric-indent-mode: t global-prettify-symbols-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t buffer-read-only: t column-number-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow emacsbug pp sort gnus-cite gnus-bcklg gnus-async gnus-ml hl-line nndraft nnmh nnagent rot13 utf-7 nnml nnnil gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-cache gnus-demon nntp spam spam-stat gnus-uu yenc gnus-msg gnus-gravatar mail-extr gravatar url-cache gnus-topic gnus-registry registry eieio-base gnutls network-stream rcirc-color th-private rcirc term/screen term/xterm xterm company-oddmuse company-keywords company-etags company-gtags company-dabbrev-code company-dabbrev company-files company-capf company-cmake company-xcode company-clang company-semantic company-eclim company-template company-bbdb highlight-symbol org-rmail org-mhe org-irc org-info org-gnus nnir org-docview doc-view jka-compr image-mode image org-bibtex bibtex org-bbdb org-w3m paredit auto-package-update finder-inf generic fish-mode cargo cargo-process rust-mode intero flycheck hindent haskell-mode haskell-cabal haskell-utils haskell-font-lock haskell-indentation haskell-string haskell-sort-imports haskell-lexeme haskell-align-imports haskell-compat haskell-complete-module haskell-ghc-support flymake-proc flymake mwheel etags fileloop xref project compile dabbrev haskell-customize web-mode disp-table beacon aggressive-indent rainbow-mode vc-git vc-dir ewoc vc vc-dispatcher epa-file org-element avl-tree generator org org-macro org-footnote org-pcomplete org-list org-faces org-entities org-version ob-emacs-lisp ob ob-tangle org-src ob-ref ob-lob ob-table ob-keys ob-exp ob-comint ob-core ob-eval org-compat org-macs org-loaddefs find-func cal-menu calendar cal-loaddefs dired-x boxquote rect smtpmail-multi smtpmail sendmail ecomplete yasnippet auto-dictionary flyspell ispell recentf tree-widget tramp tramp-loaddefs trampver tramp-integration files-x tramp-compat ucs-normalize which-key highlight-parentheses company-restclient know-your-http-well http-status-codes http-relations http-methods http-headers company restclient forge-list forge-commands forge-semi forge-bitbucket buck forge-gogs gogs forge-gitea gtea forge-gitlab glab forge-github ghub-graphql treepy graphql pcase ghub let-alist forge-notify forge-revnote forge-pullreq forge-issue forge-topic bug-reference forge-post markdown-mode color thingatpt noutline outline forge-repo forge forge-core forge-db closql emacsql-sqlite emacsql emacsql-compiler magit-submodule magit-obsolete 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 magit-core magit-autorevert autorevert filenotify magit-margin magit-transient magit-process magit-mode transient git-commit magit-git magit-section magit-utils crm log-edit pcvs-util add-log with-editor async-bytecomp advice async shell pcomplete comint regexp-opt ansi-color ring server dash visual-filename-abbrev debbugs soap-client url-http url-auth url-gw nsm url url-proxy url-privacy url-expand url-methods url-history url-cookie url-domsuf url-util warnings rng-xsd rng-dt rng-util xsd-regexp xml use-package-ensure use-package-bind-key bind-key easy-mmode icomplete mb-depth rx bs windmove elec-pair cap-words superword subword saveplace savehist paren smiley gnus-art mm-uu mml2015 mm-view mml-smime smime dig mailcap gnus-sum gnus-group gnus-undo gnus-start gnus-cloud nnimap nnmail mail-source utf7 netrc nnoo parse-time gnus-spec gnus-int gnus-range message rmc puny dired dired-loaddefs format-spec rfc822 mml mml-sec epa derived epg mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader gnus-win gnus wid-edit nnheader gnus-util rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums text-property-search time-date mm-util mail-prsvr mail-utils edmacro kmacro dracula-theme cl-extra help-mode use-package-core mule-util info tool-bar package easymenu epg-config url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache json subr-x map url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer select 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 threads dbusbind inotify multi-tty make-network-process emacs) Memory information: ((conses 16 1027720 149343) (symbols 48 45019 2) (strings 32 263584 14021) (string-bytes 1 8434902) (vectors 16 86395) (vector-slots 8 1343237 56812) (floats 8 599 889) (intervals 56 23553 1660) (buffers 992 50))