bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#5031: marked as done (23.1; abbrev and escapes)


From: Emacs bug Tracking System
Subject: bug#5031: marked as done (23.1; abbrev and escapes)
Date: Wed, 25 Nov 2009 05:10:07 +0000

Your message dated Wed, 25 Nov 2009 00:00:09 -0500
with message-id <address@hidden>
and subject line Re: bug#5031: 23.1; abbrev and escapes
has caused the Emacs bug report #5031,
regarding 23.1; abbrev and escapes
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact address@hidden
immediately.)


-- 
5031: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=5031
Emacs Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 23.1; abbrev and escapes Date: Tue, 24 Nov 2009 10:15:24 +0100
It was possible under emacs 22 to expand abbrevs that start with an escape
character e.g. \ by setting words-include-escapes to true.
This does not work anymore under emacs 23. Here is a short example.

(progn
   (define-abbrev-table 'my-table '(
      ("success" "success again")
      ("\\med"   "\\medskip")))
   (setq local-abbrev-table my-table)
   (setq abbrev-mode t)                      
   (setq words-include-escapes t))

Under emacs22,  success expands to  success again 
                \med    expands to  \medskip

Under emacs23,  only success expands.

I tried to modify the :regexp property of the table without success.

In GNU Emacs 23.1.1 (i486-pc-linux-gnu, GTK+ Version 2.16.5)
 of 2009-09-14 on raven, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.10605000
configured using `configure  '--build=i486-linux-gnu' '--host=i486-linux-gnu' 
'--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' 
'--localstatedir=/var/lib' '--infodir=/usr/share/info' 
'--mandir=/usr/share/man' '--with-pop=yes' 
'--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.1/leim'
 '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 
'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g 
-O2' 'LDFLAGS=-g' 'CPPFLAGS=''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: fr_FR.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  show-paren-mode: t
  display-time-mode: t
  tooltip-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: 1
  font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  temp-buffer-resize-mode: t
  column-number-mode: t
  line-number-mode: t

Recent input:
M-t g n u s <return> M-t C-g C-x b * s c a r DEL DEL 
r a t c h * <return> M-t r e p o r t - b u g <return>

Recent messages:
nnimap: Mailbox INBOX modified
nnimap: Mailbox INBOX.Trash modified
nnimap: Checking mailboxes...done
Reading active file from sauvegarde via nnfolder...
Opening nnfolder server on sauvegarde...done
nnfolder: Reading incoming mail from file...
nnfolder: Reading incoming mail (no new mail)...done
Reading active file from sauvegarde via nnfolder...done
Checking new news...done
Quit



--- End Message ---
--- Begin Message --- Subject: Re: bug#5031: 23.1; abbrev and escapes Date: Wed, 25 Nov 2009 00:00:09 -0500 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)
> It was possible under emacs 22 to expand abbrevs that start with an escape
> character e.g. \ by setting words-include-escapes to true.
> This does not work anymore under emacs 23. Here is a short example.

> (progn
>    (define-abbrev-table 'my-table '(
>       ("success" "success again")
>       ("\\med"   "\\medskip")))
>    (setq local-abbrev-table my-table)
>    (setq abbrev-mode t)                      
>    (setq words-include-escapes t))

I've installed the patch below which should better match the
Emacs-22 behavior.  Thanks for the report,


        Stefan


=== modified file 'lisp/abbrev.el'
--- lisp/abbrev.el      2009-11-19 17:24:04 +0000
+++ lisp/abbrev.el      2009-11-25 04:45:07 +0000
@@ -680,11 +680,19 @@
           (setq tables (append (abbrev-table-get table :parents) tables))
           (setq res
                 (and (or (not enable-fun) (funcall enable-fun))
-                     (looking-back (or (abbrev-table-get table :regexp)
-                                       "\\<\\(\\w+\\)\\W*")
-                                   (line-beginning-position))
+                     (let ((re (abbrev-table-get table :regexp)))
+                       (if (null re)
+                           ;; We used to default `re' to "\\<\\(\\w+\\)\\W*"
+                           ;; but when words-include-escapes is set, that
+                           ;; is not right and fixing it is boring.
+                           (let ((lim (point)))
+                             (backward-word 1)
+                             (setq start (point))
+                             (forward-word 1)
+                             (setq end (min (point) lim)))
+                         (when (looking-back re (line-beginning-position))
                      (setq start (match-beginning 1))
-                     (setq end   (match-end 1))
+                           (setq end   (match-end 1)))))
                      (setq name  (buffer-substring start end))
                      (let ((abbrev (abbrev-symbol name table)))
                        (when abbrev


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]