Subject: bug#75542: 31.0.50; asm-mode runs hooks in wrong order since d8e209 (1 Dec 2024).

From: David Koppelman <[email-masked]>
Date: Mon, 13 Jan 2025 15:39:54 -0600

The order in which asm-mode runs its two hooks, asm-mode-hook and
asm-mode-set-comment-hook, changed with commit
676ff9fd7c083598b2955a463774283768d8e209 (1 December 2024).

The comments near the top of asm-mode.el explain that
asm-mode-set-comment-hook hooks should be run before those on
asm-mode-hook.

The correct behavior can be restored (for me) by removing the
:after-hook attribute in the asm-mode definition (which makes the code
that follows the body argument of define-derived-mode). I don't know
whether that is the right fix.

diff --git a/lisp/progmodes/asm-mode.el b/lisp/progmodes/asm-mode.el
index a2334505db9..c8e82d707a6 100644
--- a/lisp/progmodes/asm-mode.el
+++ b/lisp/progmodes/asm-mode.el
@@ -125,7 +125,6 @@ asm-mode
 
 Special commands:
 \\{asm-mode-map}"
-  :after-hook
   (progn
     (run-hooks 'asm-mode-set-comment-hook)
     ;; Make our own local child of `asm-mode-map'

In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 2.24.33, cairo version 1.17.4) of 2025-01-06 built on cyc2.ece.lsu.edu
Repository revision: c3ec174a6c2d1118e82aecceb203634f7b567e20
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Red Hat Enterprise Linux 9.4 (Plow)

Configured using:
 'configure 'CFLAGS=-O2 -march=native' --without-pop
 --with-native-compilation'

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

Important settings:
  value of $LC_COLLATE: C
  value of $LC_TIME: C
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: ELisp/l

Minor modes in effect:
  bug-reference-prog-mode: t
  global-hi-lock-mode: t
  hi-lock-mode: t
  which-function-mode: t
  flyspell-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  minibuffer-regexp-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t