From: "Timo Myyrä" <timo.myyra@bittivirhe.fi>
To: help-gnu-emacs@gnu.org
Subject: custom record separator in forms-mode?
Date: Thu, 24 Dec 2020 18:57:44 +0200 [thread overview]
Message-ID: <875z4rb0qf.fsf@asteroid.bittivirhe.fi> (raw)
Hi,
I got address data in ebcdic encoding which is given as fixed width
semicolon separated fields with \205 used as record separator.
I'd like to use emacs forms-mode to read this data and I have following
control file set for it:
;;; -*- mode: emacs-lisp; coding: utf-8-unix; indent-tabs-mode: nil -*-
(setq forms-file "/home/tmy/test.dat")
(setq forms-number-of-fields 9)
(setq forms-read-only t)
(setq forms-field-sep ";")
(setq forms-multi-line nil)
(defun filter-read-205-newline ()
"Filter to read customer data to forms."
(make-variable-buffer-local 'buffer-file-coding-system)
(setq buffer-file-coding-system "ibm278-unix")
(replace-string "
" "
" nil (point-min) (point-max)))
(defun filter-write-205-newline ()
"Filter to run write forms data to customer file."
(make-variable-buffer-local 'buffer-file-coding-system)
(setq buffer-file-coding-system "ibm278-unix")
(replace-string "
" "
" nil (point-min) (point-max)))
(setq forms-read-file-filter 'filter-read-205-newline)
(setq forms-write-file-filter 'filter-write-205-newline)
(setq forms-format-list
(list
"====== Customer ======\n"
"Name : " 1
"Address: " 3
"Post code: " 5
"City: " 6
"Some ID A" 8
"Some ID B" 9
"\n"))
Problem is that once I enter forms-mode I get error:
Debugger entered--Lisp error: (wrong-type-argument sequencep filter-read-205-newline)
My idea was to replace the \205 chars as newlines on read and write
newlines to \205 on write but forms control file doesn't seem to agree
with my. Any ideas how to proceed?
Timo
next reply other threads:[~2020-12-24 16:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-24 16:57 Timo Myyrä [this message]
2020-12-26 7:34 ` custom record separator in forms-mode? Michael Heerdegen
2020-12-26 11:33 ` Timo Myyrä
2020-12-26 14:02 ` Michael Heerdegen
2020-12-26 15:09 ` Michael Heerdegen
2020-12-26 17:22 ` Stefan Monnier
2020-12-27 6:01 ` Michael Heerdegen
2020-12-27 6:31 ` Michael Heerdegen
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=875z4rb0qf.fsf@asteroid.bittivirhe.fi \
--to=timo.myyra@bittivirhe.fi \
--cc=help-gnu-emacs@gnu.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).