From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nick Dokos Newsgroups: gmane.emacs.help Subject: Re: scripting input methods (was back (batch) translate chars to keyboard events) Date: Mon, 13 Feb 2012 10:47:58 -0500 Organization: HPCS Message-ID: <18978.1329148078@alphaville> References: <81y5s7w3ix.fsf@gmail.com> Reply-To: nicholas.dokos@hp.com NNTP-Posting-Host: plane.gmane.org X-Trace: dough.gmane.org 1329152657 14479 80.91.229.3 (13 Feb 2012 17:04:17 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 13 Feb 2012 17:04:17 +0000 (UTC) Cc: Rustom Mody , help-gnu-emacs@gnu.org, nicholas.dokos@hp.com To: Jambunathan K Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Feb 13 18:04:15 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RwzK2-0003S0-4Z for geh-help-gnu-emacs@m.gmane.org; Mon, 13 Feb 2012 18:04:14 +0100 Original-Received: from localhost ([::1]:36196 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RwzK1-0000fK-La for geh-help-gnu-emacs@m.gmane.org; Mon, 13 Feb 2012 12:04:13 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:55254) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rwy8e-0006xl-Cn for help-gnu-emacs@gnu.org; Mon, 13 Feb 2012 10:48:29 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rwy8X-0003lc-8M for help-gnu-emacs@gnu.org; Mon, 13 Feb 2012 10:48:24 -0500 Original-Received: from g4t0015.houston.hp.com ([15.201.24.18]:26048) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rwy8X-0003ji-5A for help-gnu-emacs@gnu.org; Mon, 13 Feb 2012 10:48:17 -0500 Original-Received: from g4t0018.houston.hp.com (g4t0018.houston.hp.com [16.234.32.27]) by g4t0015.houston.hp.com (Postfix) with ESMTP id 90AE383E6; Mon, 13 Feb 2012 15:48:02 +0000 (UTC) Original-Received: from ldl (ldl.usa.hp.com [16.125.112.222]) by g4t0018.houston.hp.com (Postfix) with ESMTP id 506721014B; Mon, 13 Feb 2012 15:48:02 +0000 (UTC) Original-Received: from localhost (ldl.fc.hp.com [127.0.0.1]) by ldl (Postfix) with ESMTP id 28BAF1A7E0BD; Mon, 13 Feb 2012 08:48:02 -0700 (MST) X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "Cc" Original-Received: from ldl ([127.0.0.1]) by localhost (ldl.fc.hp.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 06VREX-TJK8f; Mon, 13 Feb 2012 08:48:02 -0700 (MST) Original-Received: from alphaville.dokosmarshall.org (squirrel.fc.hp.com [15.11.146.57]) by ldl (Postfix) with ESMTP id EC42A1A7E0BC; Mon, 13 Feb 2012 08:48:01 -0700 (MST) Original-Received: by alphaville.dokosmarshall.org (Postfix, from userid 1000) id EEDA441501; Mon, 13 Feb 2012 10:47:58 -0500 (EST) Original-Received: from alphaville (localhost [127.0.0.1]) by alphaville.dokosmarshall.org (Postfix) with ESMTP id DF2F440049; Mon, 13 Feb 2012 10:47:58 -0500 (EST) In-Reply-To: Message from Jambunathan K of "Mon, 13 Feb 2012 13:47:42 +0530." <81y5s7w3ix.fsf@gmail.com> X-Mailer: MH-E 8.3.1; nmh 1.3; GNU Emacs 24.0.92 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 15.201.24.18 X-Mailman-Approved-At: Mon, 13 Feb 2012 12:04:07 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:83738 Archived-At: Jambunathan K 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