Subject: bug#15360: closed (Re: bug#15360: 24.3; Bug in abbrev--check-chars function in abbrev.el ?)

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 12 Sep 2013 19:38:02 +0000

Your bug report

#15360: 24.3; Bug in abbrev--check-chars function in abbrev.el ?

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
15360: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15360
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#15360: 24.3; Bug in abbrev--check-chars function in abbrev.el ?
From: Stefan Monnier <[email-masked]>
To: Glenn Coombs <[email-masked]>
Cc: [email-masked]
Date: Thu, 12 Sep 2013 15:37:26 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

> 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

Subject: 24.3; Bug in abbrev--check-chars function in abbrev.el ?
From: Glenn Coombs <[email-masked]>
To: [email-masked]
Date: Thu, 12 Sep 2013 10:35:03 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

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 <f7> <f7> <f7> <f7> <f7> <f7> <f7> <f7> <f7> <f7>
<f7> <f7> <f7> <f7> <f11> <backspace> <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 <return>
C-x b <return> C-x k <return> <up> <up> <up> <up> <up>
<down-mouse-1> <mouse-1> <down-mouse-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> <up> <up>
<up> <up> <up> <up> <up> <up> C-g <down-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 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)