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

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

pre-abbrev-expand-hook


From: Roland Winkler t28834
Subject: pre-abbrev-expand-hook
Date: Sat, 3 Jul 2004 00:44:00 +0200 (CEST)

This bug report will be sent to the Free Software Foundation,
not to your local site managers!
Please write in English, because the Emacs maintainers do not have
translators to read other languages for them.

Your bug report will be posted to the address@hidden mailing list,
and to the gnu.emacs.bug news group.

In GNU Emacs 21.2.1 (i386-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2002-04-09 on tfkp12
configured using `configure  --prefix=/nfs/common --libexecdir=/nfs/common/lib 
--bindir=/nfs/common/lib/emacs/21.2/bin/i686-Linux 
--mandir=/nfs/common/share/man --infodir=/nfs/common/share/info --with-gcc 
--with-pop --with-x --with-x-toolkit=athena i386-pc-linux'
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: POSIX
  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: en_US
  locale-coding-system: iso-latin-1
  default-enable-multibyte-characters: t

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:


The following code is taken from the elisp manual, node Abbrev Expansion


(add-hook 'pre-abbrev-expand-hook 'query-if-not-space)

;; This is the function invoked by `pre-abbrev-expand-hook'.

;; If the user terminated the abbrev with a space, the function does
;; nothing (that is, it returns so that the abbrev can expand).  If the
;; user entered some other character, this function asks whether
;; expansion should continue.

;; If the user answers the prompt with `y', the function returns
;; `nil' (because of the `not' function), but that is
;; acceptable; the return value has no effect on expansion.

(defun query-if-not-space ()
  (if (/= ?\  (preceding-char))
      (if (not (y-or-n-p "Do you want to expand this abbrev? "))
          (error "Not expanding this abbrev"))))


Somehow this example doesn't work for me. preceding-char in
query-if-not-space should return the word-separator character which
will cause the abbrev expansion. However, preceding-char returns the
last character of the abbreviation to be expanded.

I looked into this because I wanted to write a function that will
control abbrev expansion based on the word separator character that
invoked the abbrev axpansion. The above example from the elisp manual
suggests that this should be possible. But somehow it doesn't work.

Same problem with more recent versions of emacs.
Am I missing something here?

Roland




reply via email to

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