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

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

Re: abbrev fire function


From: Emanuel Berg
Subject: Re: abbrev fire function
Date: Wed, 18 May 2022 16:42:48 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

>> (how) can I execute a function from an abbrev? e.g. I type
>> 'zshbang' and it calls a function that inserts '#!
>> /bin/zsh\n' at (point-min) but also calls (sh-mode).
>
> (defun sh-mode-abbrev-f ()
>   (sh-mode) )
>
> (define-abbrev global-abbrev-table "sh-mode-abbrev" t #'sh-mode-abbrev-f)
>
> DNC ... or something is missing?

The dashes? Because this works:

(defun sh-mode-abbrev-f ()
  (goto-char (point-min))
  (insert "#! /bin/zsh\n")
  (sh-mode) )

(define-abbrev global-abbrev-table "zshbang" t #'sh-mode-abbrev-f)

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

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