unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: masashi ito <ma345to@gmx.com>
To: Thien-Thi Nguyen <ttn@gnuvola.org>, help-gnu-emacs@gnu.org
Subject: Re: execute a command with euc-jp
Date: Thu, 5 May 2011 18:01:10 -0400	[thread overview]
Message-ID: <20110505220110.GA22712@masashi-netbook> (raw)
In-Reply-To: <87wri5r1jb.fsf@ambire.localdomain>

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 <ma345to@gmx.com>
> () 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.



  parent reply	other threads:[~2011-05-05 22:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-05  0:29 execute a command with euc-jp masashi ito
2011-05-05  8:31 ` Thien-Thi Nguyen
2011-05-05  8:44   ` Bastian Ballmann
2011-05-05  8:45   ` Bastian Ballmann
2011-05-05 22:01   ` masashi ito [this message]
2011-05-06  0:37     ` Thien-Thi Nguyen
2011-05-06  3:50       ` masashi ito
2011-05-06  8:10         ` Thien-Thi Nguyen

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=20110505220110.GA22712@masashi-netbook \
    --to=ma345to@gmx.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=ttn@gnuvola.org \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).