unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* emacs-27 breaks null function
@ 2020-04-06 17:30 Nelson H. F. Beebe
  2020-04-06 17:46 ` Andreas Schwab
  2020-04-06 18:12 ` Stefan Monnier
  0 siblings, 2 replies; 7+ messages in thread
From: Nelson H. F. Beebe @ 2020-04-06 17:30 UTC (permalink / raw)
  To: emacs-devel; +Cc: beebe

Some 34 years ago, I wrote a function with the code snippet

	(if (null executing-macro) ...)

and that function has been in daily use through emacs-26.  However,
with emacs-27, I get an error with this traceback

	Symbol's value as variable is void: executing-macro

The Emacs Lisp function null is defined in C in the file data.c,
and its body 

{
  if (NILP (object))
    return Qt;
  return Qnil;
}

appears not to have changed between 2009 and 2020.  I find nothing
in the ChangeLog.* files that would explain the behavior change
in emacs-27.

Nor can I readily spot some other function that could be used
to test for the prior definition of a variable.

Comments and advice are welcome!

-------------------------------------------------------------------------------
- Nelson H. F. Beebe                    Tel: +1 801 581 5254                  -
- University of Utah                    FAX: +1 801 581 4148                  -
- Department of Mathematics, 110 LCB    Internet e-mail: beebe@math.utah.edu  -
- 155 S 1400 E RM 233                       beebe@acm.org  beebe@computer.org -
- Salt Lake City, UT 84112-0090, USA    URL: http://www.math.utah.edu/~beebe/ -
-------------------------------------------------------------------------------



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

* Re: emacs-27 breaks null function
  2020-04-06 17:30 emacs-27 breaks null function Nelson H. F. Beebe
@ 2020-04-06 17:46 ` Andreas Schwab
  2020-04-06 18:37   ` Nelson H. F. Beebe
  2020-04-06 18:12 ` Stefan Monnier
  1 sibling, 1 reply; 7+ messages in thread
From: Andreas Schwab @ 2020-04-06 17:46 UTC (permalink / raw)
  To: Nelson H. F. Beebe; +Cc: emacs-devel

On Apr 06 2020, Nelson H. F. Beebe wrote:

> Some 34 years ago, I wrote a function with the code snippet
>
> 	(if (null executing-macro) ...)

That variable has been marked obsolete for more than 24 years.

> and that function has been in daily use through emacs-26.  However,
> with emacs-27, I get an error with this traceback
>
> 	Symbol's value as variable is void: executing-macro

The alias has finally been removed in emacs 27.  Use executing-kbd-macro
instead.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."



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

* Re: emacs-27 breaks null function
  2020-04-06 17:30 emacs-27 breaks null function Nelson H. F. Beebe
  2020-04-06 17:46 ` Andreas Schwab
@ 2020-04-06 18:12 ` Stefan Monnier
  1 sibling, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2020-04-06 18:12 UTC (permalink / raw)
  To: Nelson H. F. Beebe; +Cc: emacs-devel

> Some 34 years ago, I wrote a function with the code snippet
>
> 	(if (null executing-macro) ...)
>
> and that function has been in daily use through emacs-26.  However,
> with emacs-27, I get an error with this traceback
>
> 	Symbol's value as variable is void: executing-macro

Grep says:

    % grep executing-macro etc/NEWS*
    etc/NEWS.1-17:** Variable `executing-macro' renamed `executing-kbd-macro'.
    %

So you've been using a variable name that's been obsolete for ... 34 years?
I took a bit more work to find why you're only seeing this now:

    % git log | grep -C9 executing-macro | head
        (select-tags-table-mode): No need to set `buffer-read-only'
        explicitly, `special-mode' takes care of that.
        * lisp/vc/log-edit.el (log-edit-show-files): Use `special-mode'
        instead of setting `buffer-read-only' explicitly.
    
    commit a6844ee86e0577acaeb699a26902c4dc9e7352aa
    Author: Sam Steingold <sds@gnu.org>
    Date:   Wed Nov 22 16:07:54 2017 -0500
    
        Remove variable alias executing-macro, obsolete since before 19.34.
    %

Not sure why it's not mentioned in etc/NEWS, but it looks like
a simple oversight.


        Stefan




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

* Re: emacs-27 breaks null function
  2020-04-06 17:46 ` Andreas Schwab
@ 2020-04-06 18:37   ` Nelson H. F. Beebe
  2020-04-06 18:51     ` Joost Kremers
                       ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Nelson H. F. Beebe @ 2020-04-06 18:37 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: beebe, emacs-devel

Andreas Schwab <schwab@linux-m68k.org> writes in response:

>> That variable (executing-macro) as been marked obsolete for more than 24 years.
>> The alias has finally been removed in emacs 27.  Use executing-kbd-macro
>> instead.

Thanks, that solves the problem for the particular use of executing-macro,
but what about testing for an undefined variable in general, such as

	(null this-var-might-not-be-defined-but-might-also-be-defined)
?

-------------------------------------------------------------------------------
- Nelson H. F. Beebe                    Tel: +1 801 581 5254                  -
- University of Utah                    FAX: +1 801 581 4148                  -
- Department of Mathematics, 110 LCB    Internet e-mail: beebe@math.utah.edu  -
- 155 S 1400 E RM 233                       beebe@acm.org  beebe@computer.org -
- Salt Lake City, UT 84112-0090, USA    URL: http://www.math.utah.edu/~beebe/ -
-------------------------------------------------------------------------------



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

* Re: emacs-27 breaks null function
  2020-04-06 18:37   ` Nelson H. F. Beebe
@ 2020-04-06 18:51     ` Joost Kremers
  2020-04-06 18:52     ` Andreas Schwab
  2020-04-06 18:53     ` Dmitry Gutov
  2 siblings, 0 replies; 7+ messages in thread
From: Joost Kremers @ 2020-04-06 18:51 UTC (permalink / raw)
  To: Nelson H. F. Beebe; +Cc: Andreas Schwab, emacs-devel


On Mon, Apr 06 2020, Nelson H. F. Beebe wrote:
> Andreas Schwab <schwab@linux-m68k.org> writes in response:
>
>>> That variable (executing-macro) as been marked obsolete for 
>>> more than 24 years.
>>> The alias has finally been removed in emacs 27.  Use 
>>> executing-kbd-macro
>>> instead.
>
> Thanks, that solves the problem for the particular use of 
> executing-macro,
> but what about testing for an undefined variable in general, 
> such as
>
> 	(null 
> this-var-might-not-be-defined-but-might-also-be-defined)

That's what `boundp` is for. (And `fboundp` if you want to check 
whether a symbol has a function binding).

-- 
Joost Kremers
Life has its moments



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

* Re: emacs-27 breaks null function
  2020-04-06 18:37   ` Nelson H. F. Beebe
  2020-04-06 18:51     ` Joost Kremers
@ 2020-04-06 18:52     ` Andreas Schwab
  2020-04-06 18:53     ` Dmitry Gutov
  2 siblings, 0 replies; 7+ messages in thread
From: Andreas Schwab @ 2020-04-06 18:52 UTC (permalink / raw)
  To: Nelson H. F. Beebe; +Cc: emacs-devel

On Apr 06 2020, Nelson H. F. Beebe wrote:

> Thanks, that solves the problem for the particular use of executing-macro,
> but what about testing for an undefined variable in general, such as
>
> 	(null this-var-might-not-be-defined-but-might-also-be-defined)
> ?

You are not testing for an undefined variable, you are trying to
evaluate an unbound variable.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."



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

* Re: emacs-27 breaks null function
  2020-04-06 18:37   ` Nelson H. F. Beebe
  2020-04-06 18:51     ` Joost Kremers
  2020-04-06 18:52     ` Andreas Schwab
@ 2020-04-06 18:53     ` Dmitry Gutov
  2 siblings, 0 replies; 7+ messages in thread
From: Dmitry Gutov @ 2020-04-06 18:53 UTC (permalink / raw)
  To: Nelson H. F. Beebe, Andreas Schwab; +Cc: emacs-devel

On 06.04.2020 21:37, Nelson H. F. Beebe wrote:
> (null this-var-might-not-be-defined-but-might-also-be-defined)

This never worked.

But you can use bound-and-true-p.



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

end of thread, other threads:[~2020-04-06 18:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-06 17:30 emacs-27 breaks null function Nelson H. F. Beebe
2020-04-06 17:46 ` Andreas Schwab
2020-04-06 18:37   ` Nelson H. F. Beebe
2020-04-06 18:51     ` Joost Kremers
2020-04-06 18:52     ` Andreas Schwab
2020-04-06 18:53     ` Dmitry Gutov
2020-04-06 18:12 ` Stefan Monnier

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