unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#49651: 28.0.50; setf bug
@ 2021-07-19 20:25 Devon Sean McCullough
  2021-07-20  0:29 ` Michael Heerdegen
  0 siblings, 1 reply; 14+ messages in thread
From: Devon Sean McCullough @ 2021-07-19 20:25 UTC (permalink / raw)
  To: 49651

$ /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))





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#49651: 28.0.50; setf bug
  2021-07-19 20:25 bug#49651: 28.0.50; setf bug Devon Sean McCullough
@ 2021-07-20  0:29 ` Michael Heerdegen
  2021-07-20 12:00   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Heerdegen @ 2021-07-20  0:29 UTC (permalink / raw)
  To: Devon Sean McCullough; +Cc: 49651

Devon Sean McCullough <Emacs-Hacker2020@jovi.net> writes:

> $ /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")

> 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)

So the error does only occur before you require cl-lib, and your
suggestion is to do what the comment describes as trouble - correct?

I'm not sure of what kind that trouble is, moving such definitions can
have effects on bootstrapping or startup, that's beyond my knowledge.

Any opinions?

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

I would like it when C-h f would tell about gv expanders.  Not trivial
though since most gv expanders are anonymous functions (like that of
`getenv').


Michael.





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#49651: 28.0.50; setf bug
  2021-07-20  0:29 ` Michael Heerdegen
@ 2021-07-20 12:00   ` Lars Ingebrigtsen
  2021-07-21  1:12     ` Michael Heerdegen
  0 siblings, 1 reply; 14+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-20 12:00 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: Devon Sean McCullough, 49651

Michael Heerdegen <michael_heerdegen@web.de> writes:

> I'm not sure of what kind that trouble is, moving such definitions can
> have effects on bootstrapping or startup, that's beyond my knowledge.

Yes, if we moved these elsewhere, then it would break for people who do
have (require 'cl-lib).  (Unless we autoload them.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#49651: 28.0.50; setf bug
  2021-07-20 12:00   ` Lars Ingebrigtsen
@ 2021-07-21  1:12     ` Michael Heerdegen
  2021-07-21 10:57       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Heerdegen @ 2021-07-21  1:12 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Devon Sean McCullough, 49651

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Yes, if we moved these elsewhere, then it would break for people who
> do have (require 'cl-lib).  (Unless we autoload them.)

In emacs -Q, env.el is loaded, cl-lib is not loaded, and gv.el is not
loaded.

When I require cl-lib, then the gv-expander for getenv has been defined,
while gv.el is still not loaded.  So far, so good.

Would anything break if the expander definition for getenv would be
moved to env.el (which would be a more natural place for it)?

Michael.





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#49651: 28.0.50; setf bug
  2021-07-21  1:12     ` Michael Heerdegen
@ 2021-07-21 10:57       ` Lars Ingebrigtsen
  2021-07-21 12:49         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 14+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-21 10:57 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: Devon Sean McCullough, 49651, Stefan Monnier

Michael Heerdegen <michael_heerdegen@web.de> writes:

> Would anything break if the expander definition for getenv would be
> moved to env.el (which would be a more natural place for it)?

Yes, moving the expanders to pre-loaded files would make the problem go
away, I think?  (And env.el is a good place for that one.)

But if we start doing that for some of those things, we should probably
do it for all of them, and I wasn't sure that that's what we wanted to
do.

It's certainly not very logical to load cl-lib to define a setter for,
say, `face-background', but that's where we're at today.

I think I'm in favour of moving all those out of cl-lib to preloaded
files.  I'm sure nobody else has an opinion here.

(3, 2...)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#49651: 28.0.50; setf bug
  2021-07-21 10:57       ` Lars Ingebrigtsen
@ 2021-07-21 12:49         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-07-21 13:28           ` Lars Ingebrigtsen
  0 siblings, 1 reply; 14+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-07-21 12:49 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Michael Heerdegen, Devon Sean McCullough, 49651

> It's certainly not very logical to load cl-lib to define a setter for,
> say, `face-background', but that's where we're at today.

Indeed, that was a mistake.  They should have gone to `cl.el` instead.
But if we don't want to move them to `cl.el` (and hence deprecate them)
we should move them to `gv.el`.


        Stefan






^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#49651: 28.0.50; setf bug
  2021-07-21 12:49         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-07-21 13:28           ` Lars Ingebrigtsen
  2021-07-21 13:53             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 14+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-21 13:28 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Michael Heerdegen, 49651, Devon Sean McCullough

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> Indeed, that was a mistake.  They should have gone to `cl.el` instead.
> But if we don't want to move them to `cl.el` (and hence deprecate them)
> we should move them to `gv.el`.

I don't think we don't want to deprecate them...

Let's see...  gv is dumped in Emacs, right?  (At least that's what
"emacs -Q" seems to tell me.)  In which case...  wouldn't it be just as
natural to move the setters to other preloaded files where they more
naturally belong, like env.el for the getenv setter, etc?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#49651: 28.0.50; setf bug
  2021-07-21 13:28           ` Lars Ingebrigtsen
@ 2021-07-21 13:53             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-07-21 14:02               ` Devon Sean McCullough
  2021-07-21 14:14               ` Lars Ingebrigtsen
  0 siblings, 2 replies; 14+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-07-21 13:53 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Michael Heerdegen, Devon Sean McCullough, 49651

> Let's see...  gv is dumped in Emacs, right?

No.  `push` and `pop` go through some extra efforts to avoid loading
`gv` when the PLACE is trivial enough.


        Stefan






^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#49651: 28.0.50; setf bug
  2021-07-21 13:53             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-07-21 14:02               ` Devon Sean McCullough
  2021-07-21 14:14               ` Lars Ingebrigtsen
  1 sibling, 0 replies; 14+ messages in thread
From: Devon Sean McCullough @ 2021-07-21 14:02 UTC (permalink / raw)
  To: Stefan Monnier, Lars Ingebrigtsen; +Cc: Michael Heerdegen, 49651

On 2021-07-21 09:53, Stefan Monnier wrote:
>> Let's see...  gv is dumped in Emacs, right?
> 
> No.  `push` and `pop` go through some extra efforts to avoid loading
> `gv` when the PLACE is trivial enough.

Let `setf' try loading gv before failing.

		Peace
			--Devon

P.S.  What's wrong with autoloading?





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#49651: 28.0.50; setf bug
  2021-07-21 13:53             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-07-21 14:02               ` Devon Sean McCullough
@ 2021-07-21 14:14               ` Lars Ingebrigtsen
  2021-07-21 14:31                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 14+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-21 14:14 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Michael Heerdegen, 49651, Devon Sean McCullough

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> Let's see...  gv is dumped in Emacs, right?
>
> No.

I guess I didn't know that `C-h f foo TAB' these days would load foo.el?

> `push` and `pop` go through some extra efforts to avoid loading
> `gv` when the PLACE is trivial enough.

Right.  Well, then we can't really move them to gv.el either, because
that would break code that says

(require 'cl-lib)
(setf (getenv ...))

since

(progn
  (require 'cl-lib)
  (featurep 'gv)) => nil

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#49651: 28.0.50; setf bug
  2021-07-21 14:14               ` Lars Ingebrigtsen
@ 2021-07-21 14:31                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-07-21 14:55                   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 14+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-07-21 14:31 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Michael Heerdegen, Devon Sean McCullough, 49651

>> `push` and `pop` go through some extra efforts to avoid loading
>> `gv` when the PLACE is trivial enough.
> Right.  Well, then we can't really move them to gv.el either,

Of course, we can.

> because that would break code that says
>
> (require 'cl-lib)
> (setf (getenv ...))
>
> since
>
> (progn
>   (require 'cl-lib)
>   (featurep 'gv)) => nil

`setf` is defined in `gv.el`!


        Stefan






^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#49651: 28.0.50; setf bug
  2021-07-21 14:31                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-07-21 14:55                   ` Lars Ingebrigtsen
  2021-07-21 19:27                     ` Eli Zaretskii
  0 siblings, 1 reply; 14+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-21 14:55 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Michael Heerdegen, 49651, Devon Sean McCullough

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> `setf` is defined in `gv.el`!

D'oh!

These newfangled files...   I mean, gv.el is just nine years old.

Well, then moving them over to gv.el seems like an excellent solution. 

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#49651: 28.0.50; setf bug
  2021-07-21 14:55                   ` Lars Ingebrigtsen
@ 2021-07-21 19:27                     ` Eli Zaretskii
  2021-07-21 22:21                       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2021-07-21 19:27 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: michael_heerdegen, 49651, Emacs-Hacker2020, monnier

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Wed, 21 Jul 2021 16:55:20 +0200
> Cc: Michael Heerdegen <michael_heerdegen@web.de>, 49651@debbugs.gnu.org,
>  Devon Sean McCullough <Emacs-Hacker2020@jovi.net>
> 
> These newfangled files...   I mean, gv.el is just nine years old.

Welcome to the brave new Emacs world!  Where you can never trust your
decade-long memory regarding where to find stuff.  It's all a-changing
twice every week.





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#49651: 28.0.50; setf bug
  2021-07-21 19:27                     ` Eli Zaretskii
@ 2021-07-21 22:21                       ` Lars Ingebrigtsen
  0 siblings, 0 replies; 14+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-21 22:21 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: michael_heerdegen, Emacs-Hacker2020, 49651, monnier

OK, I've now moved all the expanders from cl-lib.el to gv.el and done
some build tests:  Both an incremental and a bootstrap build were
successful, so I'm now pushing this to the trunk.

(And this fixes the originally reported problem in this bug report.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no






^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2021-07-21 22:21 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-19 20:25 bug#49651: 28.0.50; setf bug Devon Sean McCullough
2021-07-20  0:29 ` Michael Heerdegen
2021-07-20 12:00   ` Lars Ingebrigtsen
2021-07-21  1:12     ` Michael Heerdegen
2021-07-21 10:57       ` Lars Ingebrigtsen
2021-07-21 12:49         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-07-21 13:28           ` Lars Ingebrigtsen
2021-07-21 13:53             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-07-21 14:02               ` Devon Sean McCullough
2021-07-21 14:14               ` Lars Ingebrigtsen
2021-07-21 14:31                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-07-21 14:55                   ` Lars Ingebrigtsen
2021-07-21 19:27                     ` Eli Zaretskii
2021-07-21 22:21                       ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).