From unknown Sun Jun 15 01:04:32 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#15360 <15360@debbugs.gnu.org> To: bug#15360 <15360@debbugs.gnu.org> Subject: Status: 24.3; Bug in abbrev--check-chars function in abbrev.el ? Reply-To: bug#15360 <15360@debbugs.gnu.org> Date: Sun, 15 Jun 2025 08:04:32 +0000 retitle 15360 24.3; Bug in abbrev--check-chars function in abbrev.el ? reassign 15360 emacs submitter 15360 glenn.coombs@gmail.com severity 15360 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 12 11:51:11 2013 Received: (at submit) by debbugs.gnu.org; 12 Sep 2013 15:51:11 +0000 Received: from localhost ([127.0.0.1]:59179 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VK9Aj-00023h-Mz for submit@debbugs.gnu.org; Thu, 12 Sep 2013 11:51:10 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45771) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VK3J2-0008KM-8a for submit@debbugs.gnu.org; Thu, 12 Sep 2013 05:35:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VK3Is-0001Qh-6b for submit@debbugs.gnu.org; Thu, 12 Sep 2013 05:35:15 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:34386) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VK3Is-0001Qd-3R for submit@debbugs.gnu.org; Thu, 12 Sep 2013 05:35:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47477) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VK3Ip-0001O5-Gw for bug-gnu-emacs@gnu.org; Thu, 12 Sep 2013 05:35:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VK3In-0001PC-Fa for bug-gnu-emacs@gnu.org; Thu, 12 Sep 2013 05:35:07 -0400 Received: from mail-wg0-x230.google.com ([2a00:1450:400c:c00::230]:49456) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VK3In-0001Kv-60 for bug-gnu-emacs@gnu.org; Thu, 12 Sep 2013 05:35:05 -0400 Received: by mail-wg0-f48.google.com with SMTP id n12so6583220wgh.27 for ; Thu, 12 Sep 2013 02:35:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:date:message-id:subject:from:to:content-type; bh=Uq0L8BbwR7IjenN5KJcOQmSPonhMa5YFnfPD70AX3UI=; b=S5opQZG58wVJ3IPepjo+YLk/ARTcd+0dvhHLLcZO7SWozmAOU0j3OiuRoLsCWmk1HH EB0ZWDLJYlvhbAXRuDfQ7IpOd1YZH+67ezoDpBALplsMV8Ls9OgOJosG2WKLHFlbhvNR 1hmU5CcOYTCyg7bZBsV3A/x28dHX+dN5iYFh4rHC04dVmlJI3QjxfI2mF4ec7ympIIz8 FGzBDtm31EVTPqZfqRs27yTTerEZjDonLNZ1hsXT+tH7vZt3tBp8ZF6yUHjqv8Ou7AeU Wfl8vWCxmnf3fJc3rvQk0Raue+R+exLy9g+i+LO2ICZx/Vrcor5n59/Jy5bvq3s3d81A 33JQ== MIME-Version: 1.0 X-Received: by 10.194.9.70 with SMTP id x6mr440681wja.22.1378978503762; Thu, 12 Sep 2013 02:35:03 -0700 (PDT) Received: by 10.194.172.134 with HTTP; Thu, 12 Sep 2013 02:35:03 -0700 (PDT) Date: Thu, 12 Sep 2013 10:35:03 +0100 Message-ID: Subject: 24.3; Bug in abbrev--check-chars function in abbrev.el ? From: Glenn Coombs To: bug-gnu-emacs@gnu.org Content-Type: multipart/alternative; boundary=047d7b5d57cedea8bd04e62c733b X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Thu, 12 Sep 2013 11:51:07 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: glenn.coombs@gmail.com 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: -4.0 (----) --047d7b5d57cedea8bd04e62c733b Content-Type: text/plain; charset=ISO-8859-1 The abbrev--check-chars function in abbrev.el is supposed to check either the current syntax table or the global syntax table. According to the doc string if the second argument is nil the local syntax table is checked, otherwise the global syntax table will be checked. From looking at the code it appears to do the opposite. This means that when asked to check the local syntax table it actually checks the global syntax table. I discovered this when I tried to define an abbrev for "#i" to expand to "#include" but it failed even after I had run (modify-syntax-entry ?# "w"). I have modified the abbrev--check-chars function as below and it now works as I think it is supposed to: (eval-after-load 'abbrev '(defun abbrev--check-chars (abbrev global) "GRC modified: Check if the characters in ABBREV have word syntax in either the current (if global is nil) or standard syntax table." (with-syntax-table (cond ((null global) (syntax-table)) ; these 2 lines have been changed (t (standard-syntax-table))) ; to make this function work as expected (when (string-match "\\W" abbrev) (let ((badchars ()) (pos 0)) (while (string-match "\\W" abbrev pos) (cl-pushnew (aref abbrev (match-beginning 0)) badchars) (setq pos (1+ pos))) (error "Some abbrev characters (%s) are not word constituents %s" (apply 'string (nreverse badchars)) (if global "in the standard syntax" "in this mode"))))))) I am not subscribed to this mailing list so please email me directly if you require any further information. -- Glenn In GNU Emacs 24.3.1 (x86_64-unknown-linux-gnu, X toolkit, Xaw3d scroll bars) of 2013-07-08 on desk137 Windowing system distributor `The Cygwin/X Project', version 11.0.11200000 System Description: CentOS release 4.8 (Final) Configured using: `configure '--program-prefix=g' '--prefix=/vl/edatools/intern/emacs/24.3.nicegui/linux/' '--enable-locallisppath=/vl/edatools/intern/emacs/24.3.nicegui/site-lisp/' '--without-pop' '--with-x-toolkit=lucid' '--without-xpm' '--without-sound' '--without-jpeg' '--without-tiff' '--without-gif' '--without-png' '--without-rsvg' '--without-imagemagick' '--without-selinux'' Important settings: value of $LC_ALL: C value of $LANG: C locale-coding-system: nil default enable-multibyte-characters: t Major mode: Emacs-Lisp Minor modes in effect: which-function-mode: t show-paren-mode: t desktop-save-mode: t tooltip-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t Recent input: C-l C-x C-s C-a C-x b c o m m SPC h SPC M-x t o g g SPC r e SPC # i SPC C-/ C-/ C-/ C-/ C-x k C-x b C-x k C-x b a b b SPC C-f C-g C-x C-f C-g M-x r e p o SPC r SPC Recent messages: Loading /user/grc/.xemacs/ctypes...done Saving file /user/grc/.emacs.d/init.el... Wrote /user/grc/.emacs.d/init.el Read-Only mode disabled Undo! [3 times] user-error: No further undo information Mark set [2 times] call-interactively: End of buffer Quit [2 times] Making completion list... Load-path shadows: /vl/edatools/intern/emacs/24.3.nicegui/site-lisp/verilog-mode hides /vl/edatools/intern/emacs/24.3.nicegui/linux/share/emacs/24.3/lisp/progmodes/verilog-mode /vl/edatools/intern/emacs/24.3.nicegui/site-lisp/vhdl-mode hides /vl/edatools/intern/emacs/24.3.nicegui/linux/share/emacs/24.3/lisp/progmodes/vhdl-mode Features: (shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils help-mode add-log ruby-mode perl-mode sh-script smie executable jka-compr edmacro kmacro which-func ctypes cl-macs gv saveplace paren desktop cus-start cus-load mouse-copy frame-restore imenu cmake-mode p4 vc vc-dispatcher show-proto uniquify advice help-fns advice-preload cc-langs cc-mode cc-fonts easymenu cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs alist cl cl-lib grc-funcs time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dynamic-setting font-render-setting x-toolkit x multi-tty emacs) --047d7b5d57cedea8bd04e62c733b Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
The abbrev--check-chars function in abbrev.el is supposed = to check either the current syntax table or the global syntax table.=A0 Acc= ording to the doc string if the second argument is nil the local syntax tab= le is checked, otherwise the global syntax table will be checked.=A0 From l= ooking at the code it appears to do the opposite.=A0 This means that when a= sked to check the local syntax table it actually checks the global syntax t= able.

I discovered this when I tried to define an abbrev for "#i" t= o expand to "#include" but it failed even after I had run (modify= -syntax-entry ?# "w").=A0 I have modified the abbrev--check-chars= function as below and it now works as I think it is supposed to:

(eval-after-load 'abbrev
=A0 '(defun abbrev--check-char= s (abbrev global)
=A0=A0=A0=A0 "GRC modified: Check if the characte= rs in ABBREV have word syntax in either the current (if global is nil) or s= tandard syntax table."
=A0=A0=A0=A0 (with-syntax-table
=A0=A0=A0=A0=A0=A0=A0=A0 (cond ((null gl= obal) (syntax-table))=A0=A0 ; these 2 lines have been changed
=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (t (standard-syntax-table)))=A0=A0=A0=A0 = ; to make this function work as expected
=A0=A0=A0=A0=A0=A0 (when (strin= g-match "\\W" abbrev)
=A0=A0=A0=A0=A0=A0=A0=A0 (let ((badchars ())
=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0 (pos 0))
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (while (string-m= atch "\\W" abbrev pos)
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (c= l-pushnew (aref abbrev (match-beginning 0)) badchars)
=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0 (setq pos (1+ pos)))
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (error "Some abbrev characters (%s) are= not word constituents %s"
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0 (apply 'string (nreverse badchars))
=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (if global "in the standard syntax&q= uot; "in this mode")))))))

I am not subscribed to this mailing list so please email me = directly if you require any further information.

--
Glenn


In GNU Emacs 24.3.1 (x86_64-unknown-li= nux-gnu, X toolkit, Xaw3d scroll bars)
=A0of 2013-07-08 on desk137
Windowing system distributor `The Cygwin/X P= roject', version 11.0.11200000
System Description:=A0=A0=A0 CentOS r= elease 4.8 (Final)

Configured using:
=A0`configure '--program= -prefix=3Dg'
=A0'--prefix=3D/vl/edatools/intern/emacs/24.3.nicegui/linux/'
= =A0'--enable-locallisppath=3D/vl/edatools/intern/emacs/24.3.nicegui/sit= e-lisp/'
=A0'--without-pop' '--with-x-toolkit=3Dlucid= 9; '--without-xpm'
=A0'--without-sound' '--without-jpeg' '--without-tiff&#= 39; '--without-gif'
=A0'--without-png' '--without-rs= vg' '--without-imagemagick'
=A0'--without-selinux'&#= 39;

Important settings:
=A0 value of $LC_ALL: C
=A0 value of $LANG: C=
=A0 locale-coding-system: nil
=A0 default enable-multibyte-character= s: t

Major mode: Emacs-Lisp

Minor modes in effect:
=A0 whi= ch-function-mode: t
=A0 show-paren-mode: t
=A0 desktop-save-mode: t
=A0 tooltip-mode: t=A0 mouse-wheel-mode: t
=A0 menu-bar-mode: t
=A0 file-name-shadow-m= ode: t
=A0 global-font-lock-mode: t
=A0 font-lock-mode: t
=A0 auto= -composition-mode: t
=A0 auto-encryption-mode: t
=A0 auto-compression-mode: t
=A0 column-n= umber-mode: t
=A0 line-number-mode: t
=A0 transient-mark-mode: t
<= br>Recent input:
C-l <f7> <f7> <f7> <f7> <f7&= gt; <f7> <f7> <f7> <f7> <f7>
<f7> <f7> <f7> <f7> <f11> <backspace> &= lt;right> C-x C-s
C-a C-x b c o m m SPC h SPC <return> M-x t o= g g SPC
r e SPC <return> # i SPC C-/ C-/ C-/ C-/ C-x k <retur= n>
C-x b <return> C-x k <return> <up> <up> <up> = <up> <up>
<down-mouse-1> <mouse-1> <down-mou= se-1> <mouse-movement>
<drag-mouse-1> <kp-7> C-x b= a b b SPC C-f C-g C-x C-f
<up> <up> <up> <up> <up> <up> <up>= ; <up> <up> <up> <up>
<up> <up> <= ;up> <up> <up> <up> <up> <up> <up> &= lt;up> <up>
<up> <up> <up> <up> <up> <up> C-g <d= own-mouse-1> <mouse-1>
M-x r e p o SPC r SPC <return>
Recent messages:
Loading /user/grc/.xemacs/ctypes...done
Saving = file /user/grc/.emacs.d/init.el...
Wrote /user/grc/.emacs.d/init.el
Read-Only mode disabled
Undo! [3 tim= es]
user-error: No further undo information
Mark set [2 times]
cal= l-interactively: End of buffer
Quit [2 times]
Making completion list.= ..

Load-path shadows:
/vl/edatools/intern/emacs/24.3.nicegui/site-lisp/= verilog-mode hides /vl/edatools/intern/emacs/24.3.nicegui/linux/share/emacs= /24.3/lisp/progmodes/verilog-mode
/vl/edatools/intern/emacs/24.3.nicegui= /site-lisp/vhdl-mode hides /vl/edatools/intern/emacs/24.3.nicegui/linux/sha= re/emacs/24.3/lisp/progmodes/vhdl-mode

Features:
(shadow sort gnus-util mail-extr emacsbug message format-s= pec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 = mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-u= til
mail-prsvr mail-utils help-mode add-log ruby-mode perl-mode sh-script
sm= ie executable jka-compr edmacro kmacro which-func ctypes cl-macs gv
save= place paren desktop cus-start cus-load mouse-copy frame-restore
imenu cm= ake-mode p4 vc vc-dispatcher show-proto uniquify advice help-fns
advice-preload cc-langs cc-mode cc-fonts easymenu cc-guess cc-menus
cc-c= mds cc-styles cc-align cc-engine cc-vars cc-defs alist cl cl-lib
grc-fun= cs time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel
x-win x-= dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list
newcomment lisp-mode register page menu-bar rfn-eshadow timer select
scr= oll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham
ge= orgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean = japanese hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple
ab= brev minibuffer loaddefs button faces cus-face macroexp files
text-prope= rties overlay sha1 md5 base64 format env code-pages mule
custom widget h= ashtable-print-readable backquote make-network-process
dynamic-setting font-render-setting x-toolkit x multi-tty emacs)
<= /div> --047d7b5d57cedea8bd04e62c733b-- From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 12 15:37:36 2013 Received: (at 15360-done) by debbugs.gnu.org; 12 Sep 2013 19:37:36 +0000 Received: from localhost ([127.0.0.1]:59578 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VKChp-0002aS-Ur for submit@debbugs.gnu.org; Thu, 12 Sep 2013 15:37:35 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:64638) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VKCho-0002aD-4Y for 15360-done@debbugs.gnu.org; Thu, 12 Sep 2013 15:37:32 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFG4rxBo/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLNBIUGA0kiB4GwS2RCgOkeoFegxM X-IPAS-Result: Av4EABK/CFG4rxBo/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLNBIUGA0kiB4GwS2RCgOkeoFegxM X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="27527487" Received: from 184-175-16-104.dsl.teksavvy.com (HELO pastel.home) ([184.175.16.104]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 12 Sep 2013 15:33:56 -0400 Received: by pastel.home (Postfix, from userid 20848) id 399E662D8E; Thu, 12 Sep 2013 15:37:26 -0400 (EDT) From: Stefan Monnier To: Glenn Coombs Subject: Re: bug#15360: 24.3; Bug in abbrev--check-chars function in abbrev.el ? Message-ID: References: Date: Thu, 12 Sep 2013 15:37:26 -0400 In-Reply-To: (Glenn Coombs's message of "Thu, 12 Sep 2013 10:35:03 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 15360-done Cc: 15360-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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: 0.3 (/) > The abbrev--check-chars function in abbrev.el is supposed to check either > the current syntax table or the global syntax table. According to the doc > string if the second argument is nil the local syntax table is checked, > otherwise the global syntax table will be checked. From looking at the > code it appears to do the opposite. This means that when asked to check > the local syntax table it actually checks the global syntax table. Duh! Sorry for that swap, you're absolutely right. I just installed a fix for it in the emacs-24 branch, Stefan From unknown Sun Jun 15 01:04:32 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 11 Oct 2013 11:24:05 +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