help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

custom record separator in forms-mode?


From: Timo Myyrä
Subject: custom record separator in forms-mode?
Date: Thu, 24 Dec 2020 18:57:44 +0200

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]