all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: Jambunathan K <kjambunathan@gmail.com>
Cc: Rustom Mody <rustompmody@gmail.com>,
	help-gnu-emacs@gnu.org, nicholas.dokos@hp.com
Subject: Re: scripting input methods (was back (batch) translate chars to keyboard events)
Date: Mon, 13 Feb 2012 10:47:58 -0500	[thread overview]
Message-ID: <18978.1329148078@alphaville> (raw)
In-Reply-To: Message from Jambunathan K <kjambunathan@gmail.com> of "Mon, 13 Feb 2012 13:47:42 +0530." <81y5s7w3ix.fsf@gmail.com>

Jambunathan K <kjambunathan@gmail.com> wrote:

> 
> Rustom 
> 
> Try this:
> 
> (defun translate-to-hindi (filename)
>   (interactive "fFile to be translated: ")
>   (with-temp-buffer  
>     (switch-to-buffer (current-buffer))
>     (setq buffer-file-coding-system 'utf-8)
>     (set-input-method "devanagari-itrans" t)
>     (execute-kbd-macro
>      (with-temp-buffer
>        (insert-file-contents filename)
>        (buffer-string)))
> 
>     (write-file
>      (concat (file-name-sans-extension filename)
> 	     "-hi" (file-name-extension filename t)))))
> 

Perfect. I haven't tried to see what happens if you just
input arbitrary junk to it, but it is at least idempotent.

Nick



  parent reply	other threads:[~2012-02-13 15:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-13  7:20 scripting input methods (was back (batch) translate chars to keyboard events) Rustom Mody
2012-02-13  7:41 ` Rustom Mody
2012-02-13  8:17 ` Jambunathan K
2012-02-13 11:06   ` Rustom Mody
2012-02-13 15:47   ` Nick Dokos [this message]
2012-02-13 15:28 ` Nick Dokos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18978.1329148078@alphaville \
    --to=nicholas.dokos@hp.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=kjambunathan@gmail.com \
    --cc=rustompmody@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.