Subject: bug#49651: 28.0.50; setf bug

From: Devon Sean McCullough <[email-masked]>
Date: Mon, 19 Jul 2021 16:25:22 -0400

$ /Applications/Emacs-28.0.50.app/Contents/MacOS/Emacs -Q --batch --eval '(setf (getenv "FOO") "BAR")'
Debugger entered--Lisp error: (void-function \(setf\ getenv\))
   (\(setf\ getenv\) "BAR" "FOO")
   (setf (getenv "FOO") "BAR")
   eval((setf (getenv "FOO") "BAR") t)
   command-line-1(("--eval" "(setf (getenv \"FOO\") \"BAR\")"))
   command-line()
   normal-top-level()

		Peace
			--Devon

P.S. The fix is obvious:

lisp/emacs-lisp/cl-lib.el
⋮
;; These used to be in cl-macs.el since all macros that use them (like setf)
;; were autoloaded from cl-macs.el.  But now that setf, push, and pop are in
;; core Elisp, they need to either be right here or be autoloaded via
;; cl-loaddefs.el, which is more trouble than it is worth.
⋮
(gv-define-simple-setter getenv setenv t)

P.P.S.  Perhaps describe-function, M-. and the like should mention setters?

In GNU Emacs 28.0.50 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60 Version 10.14.6 (Build 18G95))
  of 2021-06-20 built on builder10-14.porkrind.org
Windowing system distributor 'Apple', version 10.3.1671
System Description:  Mac OS X 10.14.6

Configured using:
  'configure --with-ns '--enable-locallisppath=/Library/Application
  Support/Emacs/${version}/site-lisp:/Library/Application
  Support/Emacs/site-lisp' --with-modules'

Configured features:
ACL GMP GNUTLS JSON LIBXML2 MODULES NOTIFY KQUEUE NS PDUMPER THREADS
TOOLKIT_SCROLL_BARS ZLIB

Important settings:
   value of $LANG: en_BE@currency=USD.UTF-8
   locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
   tooltip-mode: t
   global-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
   blink-cursor-mode: t
   auto-composition-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t
   buffer-read-only: t
   line-number-mode: t
   transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml mml-sec epa derived epg epg-config gnus-util rmail
rmail-loaddefs auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json map text-property-search time-date
subr-x seq byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs
cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
iso-transl tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type 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 elisp-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 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 cl-preloaded nadvice button
loaddefs faces cus-face macroexp files window text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads kqueue cocoa ns multi-tty
make-network-process emacs)

Memory information:
((conses 16 51228 5390)
  (symbols 48 6521 1)
  (strings 32 18238 2346)
  (string-bytes 1 608421)
  (vectors 16 13471)
  (vector-slots 8 183176 10992)
  (floats 8 21 47)
  (intervals 56 198 0)
  (buffers 992 11))