[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: execute a command with euc-jp
From: |
Thien-Thi Nguyen |
Subject: |
Re: execute a command with euc-jp |
Date: |
Thu, 05 May 2011 10:31:52 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
() 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.