From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Glenn Coombs Newsgroups: gmane.emacs.bugs Subject: bug#15360: 24.3; Bug in abbrev--check-chars function in abbrev.el ? Date: Thu, 12 Sep 2013 10:35:03 +0100 Message-ID: Reply-To: glenn.coombs@gmail.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b5d57cedea8bd04e62c733b X-Trace: ger.gmane.org 1379001145 20995 80.91.229.3 (12 Sep 2013 15:52:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 12 Sep 2013 15:52:25 +0000 (UTC) To: 15360@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Sep 12 17:52:27 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VK9Bk-0008FL-BU for geb-bug-gnu-emacs@m.gmane.org; Thu, 12 Sep 2013 17:52:12 +0200 Original-Received: from localhost ([::1]:42548 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VK9Bk-0000rj-0m for geb-bug-gnu-emacs@m.gmane.org; Thu, 12 Sep 2013 11:52:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50452) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VK9Be-0000oU-AX for bug-gnu-emacs@gnu.org; Thu, 12 Sep 2013 11:52:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VK9Bb-0003hU-Kr for bug-gnu-emacs@gnu.org; Thu, 12 Sep 2013 11:52:06 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:50892) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VK9Bb-0003hO-Gp for bug-gnu-emacs@gnu.org; Thu, 12 Sep 2013 11:52:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VK9Bb-00025b-A8 for bug-gnu-emacs@gnu.org; Thu, 12 Sep 2013 11:52:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Glenn Coombs Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 12 Sep 2013 15:52:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 15360 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.13790010717931 (code B ref -1); Thu, 12 Sep 2013 15:52:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 12 Sep 2013 15:51:11 +0000 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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== X-Received: by 10.194.9.70 with SMTP id x6mr440681wja.22.1378978503762; Thu, 12 Sep 2013 02:35:03 -0700 (PDT) Original-Received: by 10.194.172.134 with HTTP; Thu, 12 Sep 2013 02:35:03 -0700 (PDT) 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-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 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:78287 Archived-At: --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--