Subject: bug#77278: 29.4; eval bug with lexical environment

From: Daniel Cerqueira <[email-masked]>
Date: Wed, 26 Mar 2025 09:57:36 +0000

Eval this expression:
(eval '(cons (quote a) x) '((x b)))

It returns (a b) , it should return (a . b) .

Also, eval this expression:
(eval '(atom x) '((x b)))

It returns nil , it should return t .

When using eval with a lexical environment, it is putting the value of
the variable, inside a list.  When it should use the value directly,
without putting it inside a list.

Since eval is the most important part of a LISP environment, it is good
pratice to create a unit test to test eval, so that bugs in eval are
easier to spot.

In GNU Emacs 29.4 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.48,
 cairo version 1.18.2) of 2025-03-06 built on torre
Repository revision: 6a299b3caceb2c73b932ba73849738faa8c5d975
Repository branch: release-old-working
System Description: Parabola GNU/Linux-libre

Configured using:
 'configure --without-libsystemd --without-tree-sitter --with-cairo
 --with-harfbuzz --with-modules'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY PDUMPER PNG
RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11
XDBE XIM XINPUT2 XPM GTK3 ZLIB

Important settings:
  value of $LANG: pt_PT.UTF-8
  locale-coding-system: utf-8-unix

Major mode: IELM

Minor modes in effect:
  erc-list-mode: t
  erc-menu-mode: t
  erc-ring-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-match-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-netsplit-mode: t
  erc-autoaway-mode: t
  erc-log-mode: t
  windmove-mode: t
  shell-dirtrack-mode: t
  comint-fontify-input-mode: t
  gpm-mouse-mode: t
  emms-mode-line-mode: t
  emms-playing-time-display-mode: t
  emms-playing-time-mode: t
  jabber-activity-mode: t
  rainbow-delimiters-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  erc-networks-mode: t
  server-mode: t
  winner-mode: t
  display-time-mode: t
  electric-pair-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tab-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: linux
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/guest/.emacs.d/elpa/transient-20250306.1916/transient hides /usr/local/share/emacs/29.4/lisp/transient

Features:
(shadow shortdoc help-fns radix-tree emacsbug cl-print ielm erc-list
erc-menu erc-ring erc-pcomplete erc-track erc-match erc-button erc-fill
erc-stamp erc-netsplit erc-autoaway erc-log wdired dired-aux gnus-dired
dictionary dictionary-connection gnus-cus noutline outline
display-line-numbers view diary-lib diary-loaddefs solar cal-dst
holidays holiday-loaddefs cal-move flow-fill epa-mail captain windmove
gnus-cite mail-extr gnus-async gnus-bcklg gnus-ml gnus-topic
cursor-sensor mm-archive nndraft nnmh nnrss qp utf-7 epa-file nnmaildir
gnus-agent gnus-srvr gnus-score score-mode nnvirtual nntp gnus-cache
webjump tabify imenu man mule-util disp-table jka-compr textsec
uni-scripts idna-mapping ucs-normalize uni-confusable textsec-check
network-stream url-http url-gw nsm url-cache url-auth eww xdg url-queue
expand-region text-mode-expansions html-mode-expansions
er-basic-expansions expand-region-core expand-region-custom pcmpl-unix
misearch multi-isearch sh-script smie treesit executable files-x shell
pcomplete comint ansi-osc t-mouse term/linux cus-edit cus-load exwm
exwm-input xcb-keysyms xcb-xkb exwm-manage exwm-floating xcb-cursor
xcb-render exwm-layout exwm-workspace exwm-core xcb-ewmh xcb-icccm xcb
xcb-xproto xcb-types xcb-debug go-translate gt-text-utility
gt-engine-echo gt-engine-libre gt-engine-chatgpt gt-engine-youdao
gt-engine-osxdict gt-engine-stardict gt-engine-deepl
gt-engine-google-rpc gt-engine-google gt-engine-bing gt-extension
gt-faces gt-core plz warnings icons gt-httpx transient po-mode
emms-idapi-browser emms-idapi emms-idapi-musicbrainz emms-mpris
emms-librefm-stream 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 easy-mmode 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-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-player-mplayer emms-player-simple emms-source-playlist
emms-source-file locate emms-setup emms-info-exiftool emms-info
emms-later-do emms emms-compat jabber-httpupload jabber jabber-time
jabber-autoaway jabber-vcard-avatars jabber-chatstates jabber-events
jabber-vcard jabber-avatar jabber-activity jabber-watch jabber-modeline
jabber-ahc-presence jabber-ahc jabber-version rainbow-delimiters paredit
edmacro kmacro lisp-mnt jabber-muc-nick-completion jabber-muc
jabber-bookmarks jabber-muc-nick-coloring color jabber-browse
jabber-search jabber-register jabber-widget jabber-chat jabber-history
jabber-chatbuffer jabber-roster jabber-carbons jabber-presence
jabber-private jabber-logon jabber-conn srv dns starttls jabber-core
jabber-keepalive jabber-ping jabber-disco jabber-iq jabber-console
sgml-mode facemenu jabber-truncate ewoc jabber-alert jabber-keymap
jabber-sasl sasl sasl-anonymous sasl-login sasl-plain jabber-menu
jabber-util fsm jabber-xml goto-addr weri erc-goodies erc thingatpt pp
format-spec erc-backend erc-networks erc-common erc-compat compat
compat-30 erc-loaddefs ebdb-message ebdb-gnus gnus-msg gnus-art mm-uu
mml2015 mm-view mml-smime smime gnutls dig gnus-sum shr pixel-fill
kinsoku url-file svg dom gnus-group gnus-undo gnus-start gnus-dbus dbus
xml gnus-cloud nnimap nnmail mail-source utf7 nnoo parse-time iso8601
gnus-spec gnus-int gnus-range message yank-media puny dired
dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config
mm-decode mm-bodies mm-encode mail-parse rfc2231 gmm-utils mailheader
gnus-win ebdb-mua ebdb-com crm ebdb-format ebdb mailabbrev eieio-opt
cl-extra help-mode speedbar ezimage dframe find-func eieio-base cal-menu
calendar cal-loaddefs timezone footnote rx server pinentry advice mm-url
gnus nnheader gnus-util text-property-search time-date range wid-edit
smtpmail sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr
mail-utils winner ring ido time languagetool languagetool-server
languagetool-console languagetool-java languagetool-issue
languagetool-correction languagetool-core ispell elec-pair ansi-color
my-lisp 0x0-autoloads captain-autoloads clhs-autoloads ebdb-autoloads
emms-autoloads expand-region-autoloads exwm-autoloads
go-translate-autoloads jabber-autoloads fsm-autoloads
languagetool-autoloads ledger-mode-autoloads magit-autoloads pcase
magit-section-autoloads llama-autoloads markdown-mode-autoloads
mediawiki-autoloads paredit-autoloads pinentry-autoloads plz-autoloads
rainbow-delimiters-autoloads srv-autoloads transient-autoloads
transpose-frame-autoloads with-editor-autoloads xelb-autoloads info
compat-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/x-win x-win term/common-win x-dnd 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 dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo
move-toolbar gtk x-toolkit xinput2 x multi-tty make-network-process
emacs)

Memory information:
((conses 16 860178 146247)
 (symbols 48 141184 5)
 (strings 32 323821 61230)
 (string-bytes 1 13493795)
 (vectors 16 124574)
 (vector-slots 8 3894379 175819)
 (floats 8 1072 1058)
 (intervals 56 18521 3587)
 (buffers 976 42))

AVISO DE CONFIDENCIALIDADE A informação transmitida nesta mensagem é
de uso exclusivo da pessoa ou entidade a que se destina e pode conter
informações privilegiadas e ou confidenciais.  Se não é o destinatário
desta mensagem, está proibido de proceder à sua impressão, duplicação,
divulgação ou qualquer outra forma de utilização bem como de agir com
base nestas informações.  Se tiver recebido esta mensagem por erro,
por favor avise o remetente imediatamente, elimine estas informações
do seu computador e destrua todas as cópias.

SEGURANÇA RGDP Eu uso cifração de ponta-a-ponta nas minhas
comunicações por emails.  Você também deve! Pergunte-me "Como também
posso cifrar ponta-a-ponta as minhas comunicações por email?", e eu
partilharei como.

CONFIDENTIALITY WARNING The information transmitted in this message is
for the exclusive use of the person or entity to which it is addressed
and might contain privileged and or confidential information.  If you
are not the intended recipient of this message, you are prohibited
from printing, duplicating, disseminating or otherwise using or acting
in reliance upon this information.  If you have received this message
in error, please notify the sender immediately, delete this
information from your computer and destroy all copies.

GDPR SECURITY I use end-to-end encryption on my communications by
emails.  You should too! Ask me "How can I also end-to-end cipher my
communications by email?", and I'll share how.