[Top][All Lists]

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

Re: Setting up abbrev

From: Emanuel Berg
Subject: Re: Setting up abbrev
Date: Mon, 01 Aug 2022 05:03:24 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

wilnerthomas--- via Users list for the GNU Emacs text editor wrote:

> Have seen discussions about abbrev. How does it work
> exactly, and how could I set it up to test it?

Try for example:

;;; -*- lexical-binding: t -*-

;; (kill-all-abbrevs)
(let ((write '(
               ("lex"    ";;; -*- lexical-binding: t -*-")
               ("sld"    "sdl")
               ("wierd"  "weird")
  (define-abbrev-table 'global-abbrev-table write) )

You can do more things with abbrevs, including executing
functions - but it seems I did something wrong this time as
this doesn't work ...

(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

reply via email to

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