From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thien-Thi Nguyen Newsgroups: gmane.emacs.help Subject: Re: execute a command with euc-jp Date: Thu, 05 May 2011 10:31:52 +0200 Message-ID: <87wri5r1jb.fsf@ambire.localdomain> References: <20110505002934.GB18433@masashi-netbook> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1304584391 31367 80.91.229.12 (5 May 2011 08:33:11 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 5 May 2011 08:33:11 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: masashi ito Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu May 05 10:33:07 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QHtzb-0001Ep-U6 for geh-help-gnu-emacs@m.gmane.org; Thu, 05 May 2011 10:33:04 +0200 Original-Received: from localhost ([::1]:56597 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QHtzb-000496-Dy for geh-help-gnu-emacs@m.gmane.org; Thu, 05 May 2011 04:33:03 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:40143) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QHtzV-00048z-73 for help-gnu-emacs@gnu.org; Thu, 05 May 2011 04:32:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QHtzT-0004JQ-Sz for help-gnu-emacs@gnu.org; Thu, 05 May 2011 04:32:57 -0400 Original-Received: from smtp209.alice.it ([82.57.200.105]:60463) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QHtzT-0004JD-KU for help-gnu-emacs@gnu.org; Thu, 05 May 2011 04:32:55 -0400 Original-Received: from ambire.localdomain (95.244.64.247) by smtp209.alice.it (8.5.124.08) id 4D498EF307D753B4; Thu, 5 May 2011 10:32:50 +0200 Original-Received: from ttn by ambire.localdomain with local (Exim 4.69) (envelope-from ) id 1QHtyT-0001RN-57; Thu, 05 May 2011 10:31:53 +0200 In-Reply-To: <20110505002934.GB18433@masashi-netbook> (masashi ito's message of "Wed, 4 May 2011 20:29:34 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 82.57.200.105 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:80915 Archived-At: () masashi ito () Wed, 4 May 2011 20:29:34 -0400 (defun myhowm-menu-eucjp () "to show howm menu with eucjp" (interactive) (universal-coding-system-argument 'euc-jp) (howm-menu) ) What should I do to run the command, howm-menu, with the euc-jp encoding automatically without prompting me to enter "howm-menu." The long (but more satisfying IMHO) way: Move the cursor to =E2=80=98universal-coding-system-argument=E2=80=99 and = type =E2=80=98C-h f RET=E2=80=99. Emacs will show a buffer *Help* at the top of which appears: =20 universal-coding-system-argument is an interactive compiled Lisp function in `mule-cmds.el'. =20 If your Emacs is properly installed, the words mule-cmds.el will be presented as a hyperlink. You can move the cursor there (by typing TAB repeatedly) and type RET to follow it, or click with the mouse. Doing so will open a buffer viewing that file, with cursor at function =E2=80=98universal-coding-system-argument=E2=80=99. =20 Type =E2=80=98C-M-e=E2=80=99 to go to the end of the defun. Note the form: =20 (let ((coding-system-for-read coding-system) (coding-system-for-write coding-system) (coding-system-require-warning t) (current-prefix-arg prefix)) (message "") (call-interactively cmd)) =20 or something like that. This shows the basic approach of how to invoke a command using a specific coding system: =E2=80=98let=E2=80=99-bin= d some variables to the desired value around a call to =E2=80=98call-interactivel= y=E2=80=99. Transfer this form into =E2=80=98myhowm-menu-eucjp=E2=80=99, hard-coding t= he constant bits as you see fit, and pruning the parts that don't seem relevant. You might end up with: The short (but untested, only derived) way: (defun myhowm-menu-eucjp () "to show howm menu with eucjp" (interactive) (let ((coding-system-for-read 'euc-jp) (coding-system-for-write 'euc-jp) (coding-system-require-warning t)) (call-interactively 'howm-menu))) In any case, if your Emacs is not properly installed, fix that first.