From: Mathias Dahl <brakjoller@gmail.com>
Subject: Re: reading binary, non-unix file
Date: 27 Oct 2004 09:46:20 +0200 [thread overview]
Message-ID: <u654w61tf.fsf@gmail.com> (raw)
In-Reply-To: cllvlr$cmk$1@quimby.gnus.org
"Mickey Ferguson" <MFerguson@peinc.com> writes:
> > You start and stop a keyboard macro with C-x ( and C-x )
> > respectively. You can then name it with M-x name-last-kbd-macro <name>
> > and then insert it so that it acts as a function (sort of) in your
> > .emacs with M-x insert-kbd-macro <name>.
>
> ...
> Given the above information, I tried your suggestion above, and I've
> definitely got something wrong. I tried the following, for which the fset
> is the result of using the C-x ( and C-x ):
>
> ;;; define function to load in a unicode file (utf-16-le encoding)
> (fset 'find-unicode-file
> [?\C-x return ?c ?u ?t ?f ?- ?1 ?6 ?- ?l ?e])
You are right, that did not work. When I used a keyboard for doing
this a while back it was for *saving* files. It seems that it does not
work with C-x C-f, leaving out the file name.
I looked at how universal-coding-system-argument works and hacked
together the following, which seems to do what you want:
(defun find-unicode-file ()
"Run find-file on a unicode (utf-16-le encoding) file."
(interactive)
(let* ((coding-system 'utf-16-le)
(coding-system-for-read coding-system)
(coding-system-require-warning t))
(call-interactively 'find-file)))
Hope it works for you.
/Mathias
next prev parent reply other threads:[~2004-10-27 7:46 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-22 18:47 reading binary, non-unix file Mickey Ferguson
2004-10-22 19:27 ` J. David Boyd
[not found] ` <mailman.4677.1098473798.2017.help-gnu-emacs@gnu.org>
2004-10-22 19:57 ` Mickey Ferguson
2004-10-25 6:40 ` Mathias Dahl
2004-10-25 17:48 ` Mickey Ferguson
2004-10-26 1:08 ` Daniel Pittman
2004-10-26 9:05 ` Mathias Dahl
2004-10-26 17:00 ` Mickey Ferguson
2004-10-27 7:46 ` Mathias Dahl [this message]
2004-10-27 16:20 ` Mickey Ferguson
2004-10-27 16:39 ` Reiner Steib
2004-10-27 16:41 ` Drew Adams
2004-10-25 21:43 ` Mickey Ferguson
2004-10-25 23:55 ` Kevin Rodgers
2004-10-23 3:44 ` Daniel Pittman
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=u654w61tf.fsf@gmail.com \
--to=brakjoller@gmail.com \
/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).