[Top][All Lists]

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

Re: keyboard macro

From: Stefan Monnier
Subject: Re: keyboard macro
Date: Mon, 21 Oct 2013 13:26:02 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> So my question: Is there a way to define a macro/keyboard function that will
> insert a certain character at the point when I write "..x" (not followed by a
> space)?

Not exactly, tho you could cook one up.  E.g. (guaranteed 100% untested):

   (defvar my-magic-rewrites
       ("..a" . "ā")
   (defvar my-last-chars nil)

   (defun my-p-s-i-h ()
     (unless (eq last-command this-command)
       (setq my-last-chars ""))
     (setq my-last-chars (concat my-last-chars (string last-command-event)))
     (let ((rewrite (assoc my-last-chars my-magic-rewrites)))
       (when rewrite
         (delete-char (- (length (car rewrite))))
         (insert (cdr rewrite)))))
   (add-hook 'post-self-insert-hook #'my-p-s-i-h)

But I recommend you try instead M-x describe-input-method RET devana TAB


reply via email to

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