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

* Re: custom record separator in forms-mode?
  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ä
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Heerdegen @ 2020-12-26  7:34 UTC (permalink / raw)
  To: Timo Myyrä; +Cc: help-gnu-emacs

Timo Myyrä <timo.myyra@bittivirhe.fi> writes:

> 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?

To see what's going on I would be interested in a backtrace.

Regards,

Michael.



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

* Re: custom record separator in forms-mode?
  2020-12-26  7:34 ` Michael Heerdegen
@ 2020-12-26 11:33   ` Timo Myyrä
  2020-12-26 14:02     ` Michael Heerdegen
  0 siblings, 1 reply; 8+ messages in thread
From: Timo Myyrä @ 2020-12-26 11:33 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs

Michael Heerdegen <michael_heerdegen@web.de> [2020-12-26, 08:34 +0100]:

> Timo Myyrä <timo.myyra@bittivirhe.fi> writes:
>
>> 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?
>
> To see what's going on I would be interested in a backtrace.
>
> Regards,
>
> Michael.

Ah, here's full backtrace. 
Debugger entered--Lisp error: (wrong-type-argument sequencep filter-read-205-newline)
  mapc(funcall filter-read-205-newline)
  forms-mode()
  funcall-interactively(forms-mode)
  call-interactively(forms-mode record nil)
  command-execute(forms-mode record)
  execute-extended-command(nil "forms-mode" "for")
  funcall-interactively(execute-extended-command nil "forms-mode" "for")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

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

* Re: custom record separator in forms-mode?
  2020-12-26 11:33   ` Timo Myyrä
@ 2020-12-26 14:02     ` Michael Heerdegen
  2020-12-26 15:09       ` Michael Heerdegen
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Heerdegen @ 2020-12-26 14:02 UTC (permalink / raw)
  To: help-gnu-emacs

Timo Myyrä <timo.myyra@bittivirhe.fi> writes:

> Ah, here's full backtrace. 
> Debugger entered--Lisp error: (wrong-type-argument sequencep
> filter-read-205-newline)
>   mapc(funcall filter-read-205-newline)
>   forms-mode()
>   funcall-interactively(forms-mode)
>   call-interactively(forms-mode record nil)
>   command-execute(forms-mode record)
>   execute-extended-command(nil "forms-mode" "for")
>   funcall-interactively(execute-extended-command nil "forms-mode" "for")
>   call-interactively(execute-extended-command nil nil)
>   command-execute(execute-extended-command)

Thanks.  Hmm, it seems `forms-read-file-filter' is expected to be a list
of functions (a hook), in contradiction to what the docstring says
(documentation bug).  It also seems that OTOH `forms-write-file-filter'
is expected to be a function.

Regards,

Michael.




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

* Re: custom record separator in forms-mode?
  2020-12-26 14:02     ` Michael Heerdegen
@ 2020-12-26 15:09       ` Michael Heerdegen
  2020-12-26 17:22         ` Stefan Monnier
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Heerdegen @ 2020-12-26 15:09 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: Stefan Monnier

Hello,

this probably changed the behavior (and probably inadvertently):

84e0b7dad6f1a8e53261f9b96f5a9080fea681a4
Author:     Stefan Monnier <monnier@iro.umontreal.ca>
Deprecate `intangible' and `point-entered' properties
modified   lisp/forms.el
@@ -650,1 +650,1 @@
-	    (run-hooks 'read-file-filter)
+	    (mapc #'funcall read-file-filter)

> > Debugger entered--Lisp error: (wrong-type-argument sequencep
> > filter-read-205-newline)
> >   mapc(funcall filter-read-205-newline)
> >   forms-mode()
> >   funcall-interactively(forms-mode)
> >   call-interactively(forms-mode record nil)
> >   command-execute(forms-mode record)
> >   execute-extended-command(nil "forms-mode" "for")
> >   funcall-interactively(execute-extended-command nil "forms-mode" "for")
> >   call-interactively(execute-extended-command nil nil)
> >   command-execute(execute-extended-command)
>
> Thanks.  Hmm, it seems `forms-read-file-filter' is expected to be a list
> of functions (a hook), in contradiction to what the docstring says
> (documentation bug).  It also seems that OTOH `forms-write-file-filter'
> is expected to be a function.


Michael.




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

* Re: custom record separator in forms-mode?
  2020-12-26 15:09       ` Michael Heerdegen
@ 2020-12-26 17:22         ` Stefan Monnier
  2020-12-27  6:01           ` Michael Heerdegen
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2020-12-26 17:22 UTC (permalink / raw)
  To: help-gnu-emacs

> this probably changed the behavior (and probably inadvertently):
>
> 84e0b7dad6f1a8e53261f9b96f5a9080fea681a4
> Author:     Stefan Monnier <monnier@iro.umontreal.ca>
> Deprecate `intangible' and `point-entered' properties
> modified   lisp/forms.el
> @@ -650,1 +650,1 @@
> -	    (run-hooks 'read-file-filter)
> +	    (mapc #'funcall read-file-filter)

Indeed, thanks.  I just installed a fix for it on `master`.


        Stefan




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

* Re: custom record separator in forms-mode?
  2020-12-26 17:22         ` Stefan Monnier
@ 2020-12-27  6:01           ` Michael Heerdegen
  2020-12-27  6:31             ` Michael Heerdegen
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Heerdegen @ 2020-12-27  6:01 UTC (permalink / raw)
  To: help-gnu-emacs

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> I just installed a fix for it on `master`.

Thanks for the quick fix, Stefan.


Regards,

Michael.




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

* Re: custom record separator in forms-mode?
  2020-12-27  6:01           ` Michael Heerdegen
@ 2020-12-27  6:31             ` Michael Heerdegen
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Heerdegen @ 2020-12-27  6:31 UTC (permalink / raw)
  To: help-gnu-emacs

Michael Heerdegen <michael_heerdegen@web.de> writes:

> Thanks for the quick fix, Stefan.

BTW, `edebug-read-and-maybe-wrap-form' had received a similar treatment,
but there it had been done better.

Michael.




^ 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.