From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Leo Newsgroups: gmane.emacs.help Subject: Re: abbrev-expand-functions Date: Sun, 15 Mar 2009 13:05:52 +0000 Organization: University of Cambridge Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1237122409 983 80.91.229.12 (15 Mar 2009 13:06:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 15 Mar 2009 13:06:49 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Mar 15 14:08:05 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Liq4S-0007w6-U3 for geh-help-gnu-emacs@m.gmane.org; Sun, 15 Mar 2009 14:08:05 +0100 Original-Received: from localhost ([127.0.0.1]:37940 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Liq35-0006Un-Ij for geh-help-gnu-emacs@m.gmane.org; Sun, 15 Mar 2009 09:06:39 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Liq2h-0006Sj-Qs for help-gnu-emacs@gnu.org; Sun, 15 Mar 2009 09:06:15 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Liq2d-0006QA-BS for help-gnu-emacs@gnu.org; Sun, 15 Mar 2009 09:06:15 -0400 Original-Received: from [199.232.76.173] (port=33707 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Liq2d-0006Q7-5I for help-gnu-emacs@gnu.org; Sun, 15 Mar 2009 09:06:11 -0400 Original-Received: from main.gmane.org ([80.91.229.2]:41176 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Liq2c-0004cX-O5 for help-gnu-emacs@gnu.org; Sun, 15 Mar 2009 09:06:10 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1Liq2W-0003iC-Q3 for help-gnu-emacs@gnu.org; Sun, 15 Mar 2009 13:06:04 +0000 Original-Received: from smaug.linux.pwf.cam.ac.uk ([193.60.95.72]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 15 Mar 2009 13:06:04 +0000 Original-Received: from sdl.web by smaug.linux.pwf.cam.ac.uk with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 15 Mar 2009 13:06:04 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 57 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: smaug.linux.pwf.cam.ac.uk User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:GQNxWNuNU//Be+CzPn3G67zYUlk= X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:62929 Archived-At: On 2009-03-13 20:24 +0000, Johan Bockgård wrote: > Leo writes: > >> On 2009-03-04 15:22 +0000, Leo wrote: >>> But according to the manual, it seems this is only possible by defining >>> the abbreviation with a 'no-self-insert hook. This is not an option to >>> me as I want my function to be general for all abbreviations. >>> >>> Any idea how to get this done? >> >> Any elisp gurus that can offer some help to question? Thank you. > > ;;; For Emacs 23 > > (fset 'my-no-self-insert 'my-no-self-insert-hook) > (put 'my-no-self-insert-hook 'no-self-insert t) > > (defun my-abbrev-expand-function (expander) > (and > ;; The normal expansion. > (funcall expander) > ;; Return a symbol whose symbol-function has a non-nil > ;; `no-self-insert' property. > 'my-no-self-insert)) > > (add-hook 'abbrev-expand-functions 'my-abbrev-expand-function) > > > Note that no-self-insert interacts strangely with RET. This is brilliant! Since the return value has a symbol-function, how is that symbol-function being used in abbrev? I am asking this in hope to understand better the consequences of setting it to a real function. Is the following understanding correct? Internally, each abbrev symbol is like an uninterned variable with a structure like this: (ABBREVNAME EXPANSION [HOOK] [PROPS...]) the symbol's each property maps to a slot in that structure, for example, symbol-function maps to [HOOK] etc. If the above is correct, where to find an exhaustive list of these mappings? This will allow me to adjust other properties that may come up in future. Thank you very much. -- .: Leo :. [ sdl.web AT gmail.com ] .: I use Emacs :. www.git-scm.com git - the one true version control system