From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: masashi ito Newsgroups: gmane.emacs.help Subject: Re: execute a command with euc-jp Date: Thu, 5 May 2011 18:01:10 -0400 Message-ID: <20110505220110.GA22712@masashi-netbook> References: <20110505002934.GB18433@masashi-netbook> <87wri5r1jb.fsf@ambire.localdomain> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1304632891 478 80.91.229.12 (5 May 2011 22:01:31 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 5 May 2011 22:01:31 +0000 (UTC) To: Thien-Thi Nguyen , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri May 06 00:01:26 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 1QI6bp-0001vX-KI for geh-help-gnu-emacs@m.gmane.org; Fri, 06 May 2011 00:01:21 +0200 Original-Received: from localhost ([::1]:37726 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QI6bo-0001L5-S3 for geh-help-gnu-emacs@m.gmane.org; Thu, 05 May 2011 18:01:20 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:42818) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QI6bj-0001Kv-Ds for help-gnu-emacs@gnu.org; Thu, 05 May 2011 18:01:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QI6bi-00066m-Dk for help-gnu-emacs@gnu.org; Thu, 05 May 2011 18:01:15 -0400 Original-Received: from mailout-us.gmx.com ([74.208.5.67]:41459 helo=mailout-us.mail.com) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1QI6bi-00066T-9l for help-gnu-emacs@gnu.org; Thu, 05 May 2011 18:01:14 -0400 Original-Received: (qmail invoked by alias); 05 May 2011 22:01:11 -0000 Original-Received: from pool-71-172-177-31.nwrknj.east.verizon.net (EHLO localhost) [71.172.177.31] by mail.gmx.com (mp-us007) with SMTP; 05 May 2011 18:01:11 -0400 X-Authenticated: #115825669 X-Provags-ID: V01U2FsdGVkX18o0d4Gch0oJa3VaVWjy1s4QXAHB655sAhH/k7+g9 mvr+VxJpsEw7Ms Content-Disposition: inline In-Reply-To: <87wri5r1jb.fsf@ambire.localdomain> User-Agent: Mutt/1.5.20 (2009-06-14) X-Y-GMX-Trusted: 0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 74.208.5.67 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:80934 Archived-At: Dear Thien-Thi Nguyen, Thank you for your detailed instruction. You told me many things I didn't know. These will be definitely helpful in my learning lisp programming. As for the function definition, however, the code you suggested, unfortunately, didn't work (M-x myhowm-menu-eucjp didn't show anything). I have tried many variations. But I haven't got things done yet. One thing I noticed is (defun myhowm-menu-eucjp () "to show howm menu with eucjp" (interactive) (universal-coding-system-argument 'euc-jp) (call-interactively 'howm-menu)) shows the prompt "Command to execute with euc-jp" and stops waiting for further input. If I press just "enter," howm-menu is processed with a wrong encoding. If instead I press "ctrl-c , '" which is bound to the howm-menu command, howm-menu is processed with the euc-jp encoding... Any suggestion is welcomed! Masashi On Thu, May 05, 2011 at 10:31:52AM +0200, Thien-Thi Nguyen wrote: > () 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 ‘universal-coding-system-argument’ and type > ‘C-h f RET’. Emacs will show a buffer *Help* at the top of > which appears: > > universal-coding-system-argument is an interactive compiled > Lisp function in `mule-cmds.el'. > > 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 > ‘universal-coding-system-argument’. > > Type ‘C-M-e’ to go to the end of the defun. Note the form: > > (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)) > > or something like that. This shows the basic approach of how to > invoke a command using a specific coding system: ‘let’-bind some > variables to the desired value around a call to ‘call-interactively’. > Transfer this form into ‘myhowm-menu-eucjp’, hard-coding the 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.