[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: manipulating abbreviation mode hooks
From: |
Andreas Politz |
Subject: |
Re: manipulating abbreviation mode hooks |
Date: |
Wed, 08 Dec 2010 15:07:37 -0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
[...]
>
> But when I put the following in my ~/.emacs, I get no such behaviour.
>
>> (defun my-shell-script-mode-abbrev-expand-function ()
>> (if (not (save-excursion
>> (forward-line 0)
>> (eq (char-after) ?#)))
>> (funcall 'expand-abbrev)
>> (let ((local-abbrev-table text-mode-abbrev-table))
>> (funcall 'expand-abbrev))))
>>
>> (add-hook 'shell-script-mode-hook
>> '(lambda ()
>> (add-hook 'abbrev-expand-functions
>> 'my-shell-script-mode-abbrev-expand-function
>> nil t)))
>
>
> Once this is solved, my second question is how do I implement this for
> c++-mode? I can't figure out how to match to `//' or a `/* ... */'
> block. I'm a newbie in lisp, so a little guidance would be very
> appreciated. :)
>
> TIA
shell-script-mode is an alias for sh-mode, the hook is called
sh-mode-hook. Anyway, I think it's easier to define the
:enable-function property on your abbrev table.
(abbrev-table-put your-abbrev-table
:enable-function
(lambda nil
(not (nth 4 (syntax-ppss)))))
-ap
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: manipulating abbreviation mode hooks,
Andreas Politz <=