From unknown Sat Sep 20 14:25:33 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#74447 <74447@debbugs.gnu.org> To: bug#74447 <74447@debbugs.gnu.org> Subject: Status: 30.0.92; asm-comment-char cannot be set via dir-local variables Reply-To: bug#74447 <74447@debbugs.gnu.org> Date: Sat, 20 Sep 2025 21:25:33 +0000 retitle 74447 30.0.92; asm-comment-char cannot be set via dir-local variabl= es reassign 74447 emacs submitter 74447 Johann Kl=C3=A4hn severity 74447 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 20 14:12:33 2024 Received: (at submit) by debbugs.gnu.org; 20 Nov 2024 19:12:33 +0000 Received: from localhost ([127.0.0.1]:47795 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDq7t-0003U5-40 for submit@debbugs.gnu.org; Wed, 20 Nov 2024 14:12:33 -0500 Received: from lists.gnu.org ([209.51.188.17]:49796) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDq7q-0003Tw-TH for submit@debbugs.gnu.org; Wed, 20 Nov 2024 14:12:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tDq7q-00067A-Jv for bug-gnu-emacs@gnu.org; Wed, 20 Nov 2024 14:12:30 -0500 Received: from fout-b7-smtp.messagingengine.com ([202.12.124.150]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tDq7o-0004jG-Li for bug-gnu-emacs@gnu.org; Wed, 20 Nov 2024 14:12:30 -0500 Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfout.stl.internal (Postfix) with ESMTP id B3B3C114006E; Wed, 20 Nov 2024 14:12:25 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-11.internal (MEProxy); Wed, 20 Nov 2024 14:12:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jklaehn.de; h=cc :content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:subject:subject:to:to; s=fm3; t=1732129945; x=1732216345; bh=oEB92xiiY/s779swLgii/MyNKBV2TJq/ qgOBtzdIKfo=; b=Pq61nEcOUMpHXy/F3RGIXNKeCycbT9Lqfe88nuEAeb/ouLSR 1MA0Z3l3vd1U8vNkUMT2cHQNko7/PaqrFymBkhLx8ZLPV6ty1fbAxcLmGCqwWRCU lO6ZjUf2z39bnDywIILP1J1X6Xe+pbNVWSpXGAmS7ZW+5IIL8vaTq3IIStc6bSRE GoANqLFGHEDs5ordKoxil6l8Fr9M49x5rB/+EriDkrlMITU74K6lYuKvh21Qa/g2 Xad6SIVmvqLRNnqQCBbbzIy1pk7IEDnNNeQy0Iq2O7Oym+ZHuKUVBGaE+qPNLqch 8Utolhj7OXGLje/E5mQBsrxnUlzElRFODoTAkw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1732129945; x= 1732216345; bh=oEB92xiiY/s779swLgii/MyNKBV2TJq/qgOBtzdIKfo=; b=M yjyXg8RMSbm37+NPKS3Xlq+BJp4BuSfD4x6K/Qahmjtb6DU1tVdW+yAtdPzCUJXe 5HRurpuQY+qmIsBUMwzccrTvEgoywOibn0HqbXONm6N6z9NiWUvrfu6fx5V/6cal Wk6yV/cHnb0xGgeWkYwDIH4Qro3erHOd0UXnJNyg4z863ZN0hNoHs+8S+6FIflme rAOo2ZmIqWo52HfbIizNrppG3ZT6g/c5UlWnCQAyGTxnUv6eY0JfSSoklnnabBoc mFaffRYSifDzWSRlRBhJzwgKkX8jg/gfvRGB0i27BxQLFLcyZinz5/E1NKyr6eFH RuU0Xmn+h2np5oYXZPVLA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrfeeggdduvdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvffuff fkgggtsehttdertddttdejnecuhfhrohhmpeflohhhrghnnhcumfhlmohhnhcuoehjohhh rghnnhesjhhklhgrvghhnhdruggvqeenucggtffrrghtthgvrhhnpeefieffleehgfeuje ekieegueffkefgiefhkeehleehkedtleektdetheevteduueenucevlhhushhtvghrufhi iigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjohhhrghnnhesjhhklhgrvghhnh druggvpdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprhgtphhtthho pegsuhhgqdhgnhhuqdgvmhgrtghssehgnhhurdhorhhg X-ME-Proxy: Feedback-ID: iae1440ff:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Wed, 20 Nov 2024 14:12:24 -0500 (EST) From: =?utf-8?Q?Johann_Kl=C3=A4hn?= To: bug-gnu-emacs@gnu.org Subject: 30.0.92; asm-comment-char cannot be set via dir-local variables X-Debbugs-Cc: Date: Wed, 20 Nov 2024 20:12:16 +0100 Message-ID: <87ttc1d8j3.fsf@jklaehn.de> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=202.12.124.150; envelope-from=johann@jklaehn.de; helo=fout-b7-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.6 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) In `.dir-locals.el' setting `((asm-mode . ((asm-comment-char . 35))))' does not have the desired effect. The comment char is still `;' instead of `#'. The reason is that when the syntax table is adjusted according to the comment char in the body of `asm-mode', the dir-local variables haven't been loaded yet: `run-mode-hooks' (which would call `hack-local-variables') is only invoked _after_ the `define-derived-mode' body, i.e., too late. I'm using the following workaround: (defun asm-mode-set-comment-char-from-dir-local-variables () "Load `asm-comment-char' from dir-local variables. This is a HACK, since in `asm-mode', `run-mode-hooks' (which would call `hack-local-variables') is only invoked after the `define-derived-mode' body, i.e., too late." (let ((enable-local-variables :safe)) (hack-dir-local-variables) (when-let* ((char (alist-get 'asm-comment-char dir-local-variables-alist))) (setq-local asm-comment-char char)))) (add-hook 'asm-mode-set-comment-hook #'asm-mode-set-comment-char-from-dir-local-variables) But maybe there is a more principled approach? In GNU Emacs 30.0.92 (build 5, x86_64-pc-linux-gnu, GTK+ Version 3.24.43, cairo version 1.18.0) of 2024-11-19 built on toolbx Repository revision: 331610aef0572eacb2846f817e979aa5e29170b7 Repository branch: emacs-30 System Description: Fedora Linux 41 (Workstation Edition) Configured using: 'configure --with-dbus --with-gif --with-jpeg --with-png --with-rsvg --with-tiff --with-xpm --with-gpm=no --with-modules --with-harfbuzz --with-cairo --with-native-compilation --enable-link-time-optimization --with-pgtk 'CFLAGS=-DMAIL_USE_LOCKF -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' LDFLAGS=-Wl,-z,relro' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM GTK3 ZLIB Important settings: value of $LC_MONETARY: en_AU.UTF-8 value of $LC_NUMERIC: en_AU.UTF-8 value of $LC_TIME: en_AU.UTF-8 value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=ibus locale-coding-system: utf-8-unix Major mode: Assembler From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 20 14:21:42 2024 Received: (at 74447) by debbugs.gnu.org; 20 Nov 2024 19:21:42 +0000 Received: from localhost ([127.0.0.1]:47823 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDqGk-0003vF-Aq for submit@debbugs.gnu.org; Wed, 20 Nov 2024 14:21:42 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58732) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDqGh-0003uw-O2 for 74447@debbugs.gnu.org; Wed, 20 Nov 2024 14:21:40 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tDqGb-0006x1-26; Wed, 20 Nov 2024 14:21:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=zQcihP7DdV61MM9T4EI0aEIFXZyruqUggRAoi2JX8g0=; b=Xvn2G3h8Lj8lbzBtvhzw HzyTqp/PYGFRzhSz2JsQQesuRjUFFELDebAF9jygQ6y85B21H55mhyvHulAQos0DLD8uGjnsZblDw reF3aeI0qnj6U6iZgW+VM/mgBGbcyDCo6Ixck5Dadb/9+pv2jEnurVzBi4XyJOdfyDFbwQQLJ0M// z8FjYxrQ94VsZSFCFjWEv6YPDq4uoISxPXAcS+DGalpeiHyNbTa927ckYs3gKF2D2QNwZO9wn2yyc xxu+cfj8AajE4HYP26XOBSD/gmaAlMo4z6pB5U1ij3dGt4J2EBRpwTJmjjLxo9MjUoDI+QfB8koKw 59OD8boqy3iGjA==; Date: Wed, 20 Nov 2024 21:21:28 +0200 Message-Id: <86a5dtsocn.fsf@gnu.org> From: Eli Zaretskii To: Johann =?iso-8859-1?Q?Kl=E4hn?= , Stefan Monnier In-Reply-To: <87ttc1d8j3.fsf@jklaehn.de> (message from Johann =?iso-8859-1?Q?Kl=E4hn?= on Wed, 20 Nov 2024 20:12:16 +0100) Subject: Re: bug#74447: 30.0.92; asm-comment-char cannot be set via dir-local variables References: <87ttc1d8j3.fsf@jklaehn.de> MIME-version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 74447 Cc: 74447@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Johann Klähn > Date: Wed, 20 Nov 2024 20:12:16 +0100 > > > In `.dir-locals.el' setting `((asm-mode . ((asm-comment-char . 35))))' > does not have the desired effect. The comment char is still `;' instead > of `#'. The reason is that when the syntax table is adjusted according > to the comment char in the body of `asm-mode', the dir-local variables > haven't been loaded yet: `run-mode-hooks' (which would call > `hack-local-variables') is only invoked _after_ the `define-derived-mode' > body, i.e., too late. > > I'm using the following workaround: > > (defun asm-mode-set-comment-char-from-dir-local-variables () > "Load `asm-comment-char' from dir-local variables. > This is a HACK, since in `asm-mode', `run-mode-hooks' (which would call > `hack-local-variables') is only invoked after the `define-derived-mode' body, > i.e., too late." > (let ((enable-local-variables :safe)) > (hack-dir-local-variables) > (when-let* ((char (alist-get 'asm-comment-char dir-local-variables-alist))) > (setq-local asm-comment-char char)))) > (add-hook 'asm-mode-set-comment-hook #'asm-mode-set-comment-char-from-dir-local-variables) > > But maybe there is a more principled approach? Stefan, any suggestions? From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 20 14:37:00 2024 Received: (at 74447) by debbugs.gnu.org; 20 Nov 2024 19:37:00 +0000 Received: from localhost ([127.0.0.1]:47854 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDqVY-0004aU-7M for submit@debbugs.gnu.org; Wed, 20 Nov 2024 14:37:00 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:39522) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDqVU-0004aA-KD for 74447@debbugs.gnu.org; Wed, 20 Nov 2024 14:36:58 -0500 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 55F85442D03; Wed, 20 Nov 2024 14:36:49 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1732131402; bh=MYZ55LYhNoeHz9r0KSabkU5oIia3dYWkJRBMaaOB4PU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=T6wSSD7+jL08TXrjd9Y0CO5MIoJTeUujiwyRW67wEFITiKtsQf4hkj9v33fQkuhPq Y99CZC917H5/1jFYm2rNJ2JREtl4VSU5Hu6ij3RYlnF3Hn+I3ko4haAiE6dcfrNKCe No3u4KrXfIviBHNq+X2NU2HBl7VnG6KB6BaN0Pbc3ZadEmtb13Z+gXiX35G//u4Bx8 pR8wex8hP6iJoCLPVAvCkt+gpAG1FOugbicX/0cjgM4VV3Y5uMEaTxFoR1/DrTL84q FEhKR8d4lN2/HN63QVRKJaRYyGMoBJqpImR5UaNhnewKjzdPziaTmDKETkH4LuaH+x vaydeeOS2Y5lw== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 9BE0F442CFC; Wed, 20 Nov 2024 14:36:42 -0500 (EST) Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 880E1120489; Wed, 20 Nov 2024 14:36:42 -0500 (EST) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#74447: 30.0.92; asm-comment-char cannot be set via dir-local variables In-Reply-To: <86a5dtsocn.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 20 Nov 2024 21:21:28 +0200") Message-ID: References: <87ttc1d8j3.fsf@jklaehn.de> <86a5dtsocn.fsf@gnu.org> Date: Wed, 20 Nov 2024 14:36:42 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.212 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 74447 Cc: 74447@debbugs.gnu.org, Johann =?windows-1252?Q?Kl=E4hn?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain >> In `.dir-locals.el' setting `((asm-mode . ((asm-comment-char . 35))))' >> does not have the desired effect. The comment char is still `;' instead >> of `#'. The reason is that when the syntax table is adjusted according >> to the comment char in the body of `asm-mode', the dir-local variables >> haven't been loaded yet: `run-mode-hooks' (which would call >> `hack-local-variables') is only invoked _after_ the `define-derived-mode' >> body, i.e., too late. >> >> I'm using the following workaround: >> >> (defun asm-mode-set-comment-char-from-dir-local-variables () >> "Load `asm-comment-char' from dir-local variables. >> This is a HACK, since in `asm-mode', `run-mode-hooks' (which would call >> `hack-local-variables') is only invoked after the `define-derived-mode' body, >> i.e., too late." >> (let ((enable-local-variables :safe)) >> (hack-dir-local-variables) >> (when-let* ((char (alist-get 'asm-comment-char dir-local-variables-alist))) >> (setq-local asm-comment-char char)))) >> (add-hook 'asm-mode-set-comment-hook #'asm-mode-set-comment-char-from-dir-local-variables) >> >> But maybe there is a more principled approach? > > Stefan, any suggestions? IIRC there are 2 "standard" solutions: - in `asm-mode` use (add-hook 'hack-local-variables-hook #'asm--set-comment-syntax nil t) where `asm--set-comment-syntax` would be a new function that sets the syntax-table according to `asm-comment-char`. - in `asm-mode` move the syntax-table setting code to an `:after-hook` section, as in the patch below. Stefan --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=asm.patch diff --git a/lisp/progmodes/asm-mode.el b/lisp/progmodes/asm-mode.el index d47c525c5f9..76defbf6ac8 100644 --- a/lisp/progmodes/asm-mode.el +++ b/lisp/progmodes/asm-mode.el @@ -125,25 +125,29 @@ 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' + ;; so we can define our own comment character. + (use-local-map (nconc (make-sparse-keymap) asm-mode-map)) + (local-set-key (vector asm-comment-char) #'asm-comment) + (set-syntax-table (make-syntax-table asm-mode-syntax-table)) + (modify-syntax-entry asm-comment-char "< b") + + (setq-local comment-start (string asm-comment-char))) + (setq local-abbrev-table asm-mode-abbrev-table) (setq-local font-lock-defaults '(asm-font-lock-keywords)) (setq-local indent-line-function #'asm-indent-line) ;; Stay closer to the old TAB behavior (was tab-to-tab-stop). (setq-local tab-always-indent nil) - (run-hooks 'asm-mode-set-comment-hook) - ;; Make our own local child of `asm-mode-map' - ;; so we can define our own comment character. - (use-local-map (nconc (make-sparse-keymap) asm-mode-map)) - (local-set-key (vector asm-comment-char) #'asm-comment) - (set-syntax-table (make-syntax-table asm-mode-syntax-table)) - (modify-syntax-entry asm-comment-char "< b") - - (setq-local comment-start (string asm-comment-char)) (setq-local comment-add 1) (setq-local comment-start-skip "\\(?:\\s<+\\|/[/*]+\\)[ \t]*") (setq-local comment-end-skip "[ \t]*\\(\\s>\\|\\*+/\\)") - (setq-local comment-end "")) + (setq-local comment-end "") + )) (defun asm-indent-line () "Auto-indent the current line." --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Nov 30 05:04:13 2024 Received: (at 74447) by debbugs.gnu.org; 30 Nov 2024 10:04:13 +0000 Received: from localhost ([127.0.0.1]:45520 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHKKi-0007Gl-Ia for submit@debbugs.gnu.org; Sat, 30 Nov 2024 05:04:13 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57180) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHKKh-0007GU-0F for 74447@debbugs.gnu.org; Sat, 30 Nov 2024 05:04:11 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tHKKa-000275-OQ; Sat, 30 Nov 2024 05:04:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=QOapWRQiaNND3dGqsGvOMZh10Bb7Q3fQZXYDXf7aZMI=; b=EgGk027UcgQmg7QJXWBP B9/0VOYR80H8kNncavtmgAbF0pvwsUGaHgobTwyHxgEnwTVq5xteJavb6i91BeLEoooGl+9qxIxkt 1KFv1Icn+E1qI2xGsM8g+bs9SbIMqLB3Ut+SmK66jynd5KtiOEf6fgiFXx34SiVDKsgrJT9ALodWk M6fwf4uw/x7/pHQJ9Xn9MxppK+4TXOWItEm2Xc6cLRqwLGfdh0zOqt/NvJmeyOMgJW4psioGZcQto N+f+lmF04L2yYfwfT+WshkAaf0wAYs9QDft6+lrVYbIxQIXS4kahLkzjd9Eu1StCNOGEF1kfJ+2p0 0MpTiCCfR3b45A==; Date: Sat, 30 Nov 2024 12:04:01 +0200 Message-Id: <86plmd82cu.fsf@gnu.org> From: Eli Zaretskii To: johann@jklaehn.de, Stefan Monnier In-Reply-To: (message from Stefan Monnier on Wed, 20 Nov 2024 14:36:42 -0500) Subject: Re: bug#74447: 30.0.92; asm-comment-char cannot be set via dir-local variables References: <87ttc1d8j3.fsf@jklaehn.de> <86a5dtsocn.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 74447 Cc: 74447@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Ping! Johann, could you please try Stefan's patch below and see if it solves the problem? > From: Stefan Monnier > Cc: Johann Klähn , > 74447@debbugs.gnu.org > Date: Wed, 20 Nov 2024 14:36:42 -0500 > > >> In `.dir-locals.el' setting `((asm-mode . ((asm-comment-char . 35))))' > >> does not have the desired effect. The comment char is still `;' instead > >> of `#'. The reason is that when the syntax table is adjusted according > >> to the comment char in the body of `asm-mode', the dir-local variables > >> haven't been loaded yet: `run-mode-hooks' (which would call > >> `hack-local-variables') is only invoked _after_ the `define-derived-mode' > >> body, i.e., too late. > >> > >> I'm using the following workaround: > >> > >> (defun asm-mode-set-comment-char-from-dir-local-variables () > >> "Load `asm-comment-char' from dir-local variables. > >> This is a HACK, since in `asm-mode', `run-mode-hooks' (which would call > >> `hack-local-variables') is only invoked after the `define-derived-mode' body, > >> i.e., too late." > >> (let ((enable-local-variables :safe)) > >> (hack-dir-local-variables) > >> (when-let* ((char (alist-get 'asm-comment-char dir-local-variables-alist))) > >> (setq-local asm-comment-char char)))) > >> (add-hook 'asm-mode-set-comment-hook #'asm-mode-set-comment-char-from-dir-local-variables) > >> > >> But maybe there is a more principled approach? > > > > Stefan, any suggestions? > > IIRC there are 2 "standard" solutions: > > - in `asm-mode` use > > (add-hook 'hack-local-variables-hook #'asm--set-comment-syntax nil t) > > where `asm--set-comment-syntax` would be a new function that sets the > syntax-table according to `asm-comment-char`. > > - in `asm-mode` move the syntax-table setting code to an `:after-hook` > section, as in the patch below. > > > Stefan > > diff --git a/lisp/progmodes/asm-mode.el b/lisp/progmodes/asm-mode.el > index d47c525c5f9..76defbf6ac8 100644 > --- a/lisp/progmodes/asm-mode.el > +++ b/lisp/progmodes/asm-mode.el > @@ -125,25 +125,29 @@ 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' > + ;; so we can define our own comment character. > + (use-local-map (nconc (make-sparse-keymap) asm-mode-map)) > + (local-set-key (vector asm-comment-char) #'asm-comment) > + (set-syntax-table (make-syntax-table asm-mode-syntax-table)) > + (modify-syntax-entry asm-comment-char "< b") > + > + (setq-local comment-start (string asm-comment-char))) > + > (setq local-abbrev-table asm-mode-abbrev-table) > (setq-local font-lock-defaults '(asm-font-lock-keywords)) > (setq-local indent-line-function #'asm-indent-line) > ;; Stay closer to the old TAB behavior (was tab-to-tab-stop). > (setq-local tab-always-indent nil) > > - (run-hooks 'asm-mode-set-comment-hook) > - ;; Make our own local child of `asm-mode-map' > - ;; so we can define our own comment character. > - (use-local-map (nconc (make-sparse-keymap) asm-mode-map)) > - (local-set-key (vector asm-comment-char) #'asm-comment) > - (set-syntax-table (make-syntax-table asm-mode-syntax-table)) > - (modify-syntax-entry asm-comment-char "< b") > - > - (setq-local comment-start (string asm-comment-char)) > (setq-local comment-add 1) > (setq-local comment-start-skip "\\(?:\\s<+\\|/[/*]+\\)[ \t]*") > (setq-local comment-end-skip "[ \t]*\\(\\s>\\|\\*+/\\)") > - (setq-local comment-end "")) > + (setq-local comment-end "") > + )) > > (defun asm-indent-line () > "Auto-indent the current line." From debbugs-submit-bounces@debbugs.gnu.org Sat Nov 30 07:18:17 2024 Received: (at 74447) by debbugs.gnu.org; 30 Nov 2024 12:18:17 +0000 Received: from localhost ([127.0.0.1]:45843 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHMQT-0005sp-FF for submit@debbugs.gnu.org; Sat, 30 Nov 2024 07:18:17 -0500 Received: from fhigh-b8-smtp.messagingengine.com ([202.12.124.159]:50273) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHMQQ-0005sS-BB for 74447@debbugs.gnu.org; Sat, 30 Nov 2024 07:18:15 -0500 Received: from phl-compute-06.internal (phl-compute-06.phl.internal [10.202.2.46]) by mailfhigh.stl.internal (Postfix) with ESMTP id ABDF82540172; Sat, 30 Nov 2024 07:18:08 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-06.internal (MEProxy); Sat, 30 Nov 2024 07:18:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jklaehn.de; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1732969088; x=1733055488; bh=4bdJpSlkZWZnfsesQjToM4jtjIW4Gvy7aEUXlA3rw7g=; b= IADOEZGdrFZVK7YjWnT3TV1H2qTZ4JOAGUWP6DTPs11NZi9ZazIonD5M+MXZJnFg 8enTyeWbiWA+QZBgO1lzBQHVGtwyyktEbD9CmDU0I80v7jP+PdhXz0kXEC1qt8bd ox4B/e5ZQi6vLkGuntfFGX1sXdR35crWDJ+2R5lWvXdXzfsOlTQk3GjDf4ikBypA EqmLOuSg0axo15EwrjMZKiEYbMjirY5mqbmE07Ao7mWdNBXcf5WU93BOVt3RKNKs cQFC06Yv4UtH0MTeo9oedX43tSqQLx0yCKl4Z2+pXBltmts0Mumnk9FKpmieInjI /T4kJA7DRUDP/IEmi9t02A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1732969088; x= 1733055488; bh=4bdJpSlkZWZnfsesQjToM4jtjIW4Gvy7aEUXlA3rw7g=; b=T 8chfvXeg+ldPzk3hkKNgE7sXJrCAcfIVEBTZxlkpZaovy5paoPDKgUKymrqWfBSj Za5XVifmyRvnixskqbjvhrNSeQ4pnf25BsqWn2ikEKK6RyVztgOhLkcbnpGL+aRt WzMFR69GTPb1YlMMHRIFvzHsUeu4gIvXJnRcGzZcbaDm9uovz+QyzaT//Xf1aq30 +9KHr44swqbUpu1j8jxU6FjCNYXs61W6vSBli9anQXYdZT7JJ5Wos6kek0hoifNO xV7BkPBbQZIIN3rKxYvcVS4qKNs9wxb+D/u3YjEdqwvvKNdm/yz3lDVYmVKy/MCK pyCOT8GC1wzLjg2uios5g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrheehgdefiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnth hsucdlqddutddtmdenucfjughrpefhvfevufgjfhffkfggtgfgsehtqhertddttdejnecu hfhrohhmpeflohhhrghnnhcumfhlmohhnhcuoehjohhhrghnnhesjhhklhgrvghhnhdrug gvqeenucggtffrrghtthgvrhhnpedvteffkeetlefhhefhleehuddvlefhjeeutefhveei fedtfefggedvtdegieekudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh grihhlfhhrohhmpehjohhhrghnnhesjhhklhgrvghhnhdruggvpdhnsggprhgtphhtthho peefpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegvlhhiiiesghhnuhdrohhrgh dprhgtphhtthhopehmohhnnhhivghrsehirhhordhumhhonhhtrhgvrghlrdgtrgdprhgt phhtthhopeejgeeggeejseguvggssghughhsrdhgnhhurdhorhhg X-ME-Proxy: Feedback-ID: iae1440ff:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 30 Nov 2024 07:18:07 -0500 (EST) From: =?utf-8?Q?Johann_Kl=C3=A4hn?= To: Eli Zaretskii Subject: Re: bug#74447: 30.0.92; asm-comment-char cannot be set via dir-local variables In-Reply-To: <86plmd82cu.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 30 Nov 2024 12:04:01 +0200") References: <87ttc1d8j3.fsf@jklaehn.de> <86a5dtsocn.fsf@gnu.org> <86plmd82cu.fsf@gnu.org> Date: Sat, 30 Nov 2024 13:18:04 +0100 Message-ID: <8734j8vrsz.fsf@jklaehn.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 74447 Cc: 74447@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Thanks for the ping, Eli. After fixing up the parens added by mistake in the second part of the patch it works great. Thanks, Stefan! >> From: Stefan Monnier >> Date: Wed, 20 Nov 2024 14:36:42 -0500 >> (setq-local comment-end-skip "[ \t]*\\(\\s>\\|\\*+/\\)") >> - (setq-local comment-end "")) >> + (setq-local comment-end "") >> + )) >>=20=20 =E2=AC=91 I reverted this part. From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 01 19:05:01 2024 Received: (at 74447-done) by debbugs.gnu.org; 2 Dec 2024 00:05:01 +0000 Received: from localhost ([127.0.0.1]:53519 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHtvw-0000os-Lf for submit@debbugs.gnu.org; Sun, 01 Dec 2024 19:05:00 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:17542) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHtvu-0000oY-6O for 74447-done@debbugs.gnu.org; Sun, 01 Dec 2024 19:04:59 -0500 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 87375806DE; Sun, 1 Dec 2024 19:04:52 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1733097891; bh=MdXd357TtRqa49B94QTNW3IF4uCOUeaxRoH7RHVGddA=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=ScLQgYntrHLqkuVxlFZXYEIoKU1h/M0GooUWfMtel+0nRQCTOdEf9lKqIBxeeNbQM NrxcQQPYhbkteo1YWf7T1WLZLXo8SzmXsUy3KN4Al0K1+cLmVBPTq3goTJYdmqy0a0 0yDVJxceIpctposYANkvPQY0RyyiL+QdmsmXTGhHyeJwU5GlUTXD+BuULiFTnt9aGq EDktdlmC7Y5gAAHO+8I1G82GflbyDn3YdKmlJGl8CZ9xmxZS9UVoZMPpNI/RtQt85l RoB/gWapWxpM/mKyVMDb2RHl8MQ+PKFU8t5FxP0GG4ZrXgzLAMiOdX0eQJE4ur7lHv M4rceE95ca8SQ== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 8210D800C4; Sun, 1 Dec 2024 19:04:51 -0500 (EST) Received: from alfajor (104-195-225-43.cpe.teksavvy.com [104.195.225.43]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 4E828120491; Sun, 1 Dec 2024 19:04:51 -0500 (EST) From: Stefan Monnier To: Johann =?windows-1252?Q?Kl=E4hn?= Subject: Re: bug#74447: 30.0.92; asm-comment-char cannot be set via dir-local variables In-Reply-To: <8734j8vrsz.fsf@jklaehn.de> ("Johann =?windows-1252?Q?Kl=E4hn?= =?windows-1252?Q?=22's?= message of "Sat, 30 Nov 2024 13:18:04 +0100") Message-ID: References: <87ttc1d8j3.fsf@jklaehn.de> <86a5dtsocn.fsf@gnu.org> <86plmd82cu.fsf@gnu.org> <8734j8vrsz.fsf@jklaehn.de> Date: Sun, 01 Dec 2024 19:04:50 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.005 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 74447-done Cc: Eli Zaretskii , 74447-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Thanks for the ping, Eli. After fixing up the parens added by mistake > in the second part of the patch it works great. Thanks, Stefan! Great, thank you, pushed to `master`. >>> (setq-local comment-end-skip "[ \t]*\\(\\s>\\|\\*+/\\)") >>> - (setq-local comment-end "")) >>> + (setq-local comment-end "") >>> + )) > > =E2=AC=91 I reverted this part. Rightly so! Closing, Stefan From unknown Sat Sep 20 14:25:33 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 30 Dec 2024 12:24:11 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator