* abbrev fire function @ 2022-05-18 11:17 Emanuel Berg 2022-05-18 11:56 ` Emanuel Berg 0 siblings, 1 reply; 3+ messages in thread From: Emanuel Berg @ 2022-05-18 11:17 UTC (permalink / raw) To: help-gnu-emacs o/ (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). I remember I did this once but not how ... TIA -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: abbrev fire function 2022-05-18 11:17 abbrev fire function Emanuel Berg @ 2022-05-18 11:56 ` Emanuel Berg 2022-05-18 14:42 ` Emanuel Berg 0 siblings, 1 reply; 3+ messages in thread From: Emanuel Berg @ 2022-05-18 11:56 UTC (permalink / raw) To: help-gnu-emacs > (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? -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: abbrev fire function 2022-05-18 11:56 ` Emanuel Berg @ 2022-05-18 14:42 ` Emanuel Berg 0 siblings, 0 replies; 3+ messages in thread From: Emanuel Berg @ 2022-05-18 14:42 UTC (permalink / raw) To: help-gnu-emacs >> (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 ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-05-18 14:42 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-05-18 11:17 abbrev fire function Emanuel Berg 2022-05-18 11:56 ` Emanuel Berg 2022-05-18 14:42 ` Emanuel Berg
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).