unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* pre-abbrev-expand-hook
@ 2004-07-02 22:44 Roland Winkler t28834
  2004-07-05 14:22 ` pre-abbrev-expand-hook Richard Stallman
  0 siblings, 1 reply; 2+ messages in thread
From: Roland Winkler t28834 @ 2004-07-02 22:44 UTC (permalink / raw)


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 bug-gnu-emacs@gnu.org 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-07-05 14:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-02 22:44 pre-abbrev-expand-hook Roland Winkler t28834
2004-07-05 14:22 ` pre-abbrev-expand-hook Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).