all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* custom record separator in forms-mode?
@ 2020-12-24 16:57 Timo Myyrä
  2020-12-26  7:34 ` Michael Heerdegen
  0 siblings, 1 reply; 8+ messages in thread
From: Timo Myyrä @ 2020-12-24 16:57 UTC (permalink / raw)
  To: help-gnu-emacs

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-12-27  6:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-24 16:57 custom record separator in forms-mode? Timo Myyrä
2020-12-26  7:34 ` 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

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.