Subject: 28.0.91; Different behavior with native-compilation

From: Frédéric Giquel <[email-masked]>
Date: Sat, 22 Jan 2022 18:20:38 +0100

Hi all,

I noticed a weird indentation using fish-mode (from MELPA). I tried to
understand the root cause and found that the problem only appears when
using native-compilation.
So I open a bug here (and not in the fish-mode repository).

Here is the procedure to repoduce :

With the following init.el :
(require 'package)
(setq package-archives '(("melpa" . "https://melpa.org/packages/")))
(package-initialize)
(unless package-archive-contents
  (package-refresh-contents))
(unless (package-installed-p 'fish-mode)
  (package-install 'fish-mode))

Open the "foobar.fish" file with the following content (no indentation
at this step) :
function foobar
if test -n "$argv[1]"
echo foobar
end
end

Indent the whole buffer with :
- M-x mark-whole-buffer
- M-x indent-region

Here is the result I see :

With Emacs 28.0.91 without native-compilation (or with Emacs 27), the
buffer is indented correctly :
function foobar
    if test -n "$argv[1]"
	echo foobar
    end
end

With Emacs 28.0.91 with native-compilation (after ensuring that the
compilation has been done [*]), the indentation is not the same (and
not correct) :
function foobar
    if test -n "$argv[1]"
	echo foobar
end
end

[*] There is 2 warnings about "docstring wider than 80 characters"
during the native compilation of fish-mode

Best regards,
Frédéric Giquel

In GNU Emacs 28.0.91 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.31, cairo version 1.16.0)
 of 2022-01-22 built on guiriden
Repository revision: e58ecd01d51471e7e63d20ee059a5c26251220b7
Repository branch: emacs-28
Windowing system distributor 'The X.Org Foundation', version
11.0.12014000
System Description: Debian GNU/Linux bookworm/sid

Configured using:
 'configure --prefix=/opt/emacs28-native --with-native-compilation'

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

Important settings:
  value of $EMACSLOADPATH: 
  value of $LANG: fr_FR.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Fish

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-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
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug sendmail mule-util vc-git diff-mode
easy-mmode vc-dispatcher fish-mode cus-edit pp cus-start cus-load
wid-edit compile comint ansi-color ring find-func autoload radix-tree
lisp-mnt mm-archive message dired dired-loaddefs rfc822 mml mml-sec epa
derived gnus-util rmail rmail-loaddefs text-property-search time-date
mailabbrev gmm-utils mailheader mm-decode mm-bodies mm-encode mail-
utils
gnutls network-stream url-http mail-parse rfc2231 rfc2047 rfc2045
mm-util ietf-drums mail-prsvr url-gw nsm rmc puny url-cache url-auth
epg
rfc6068 epg-config finder-inf package browse-url url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-domsuf
url-util mailcap url-handlers url-parse auth-source eieio eieio-core
eieio-loaddefs password-cache json map url-vars comp comp-cstr warnings
subr-x rx cl-seq cl-macs cl-extra help-mode seq byte-opt gv bytecomp
byte-compile cconv cl-loaddefs cl-lib iso-transl tooltip 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 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 emoji-zwj 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 dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo
move-toolbar gtk x-toolkit x multi-tty make-network-process
native-compile emacs)

Memory information:
((conses 16 320362 12926)
 (symbols 48 17171 1)
 (strings 32 94792 3943)
 (string-bytes 1 2484930)
 (vectors 16 30341)
 (vector-slots 8 526241 44385)
 (floats 8 62 308)
 (intervals 56 511 0)
 (buffers 992 17))