GNU bug report logs -
#52451
27.1; jka-compr-write-region produces wrong type argument error
Previous Next
Full log
Message #8 received at 52451 <at> debbugs.gnu.org (full text, mbox):
> From: Braun Gábor <braungb88 <at> gmail.com>
> Date: Sun, 12 Dec 2021 15:09:08 +0100
>
> Start Emacs via the command
>
> emacs -Q --batch -l jka-compr.el --eval '(let ((jka-compr-really-do-compress
> t) (debug-on-error t)) (jka-compr-write-region "foo" nil "/tmp/test.gz"))'
>
>
> This should run without any error.
> Instead the following appears on the terminal:
>
>
> uncompressing jka-compr.el.gz...
> uncompressing jka-compr.el.gz...done
> Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
> -(nil "foo")
> (= (- end start) (buffer-size))
> (or (null start) (= (- end start) (buffer-size)))
Why did you assume that jka-compr-write-region supports compressing a
string, not just a portion of a buffer? I don't see it documented
anywhere.
> My guess is that the debugger refers to the following snippet
> in function `jka-commpr-write-region':
>
> ;; If we uncompressed this file when visiting it,
> ;; then recompress it when writing it
> ;; even if the contents look compressed already.
> (if (and jka-compr-really-do-compress
> (or (null start)
> (= (- end start) (buffer-size))))
> (setq magic nil))
>
> This seems to falsely assume that START is nil or a buffer position,
> even though the docstring of `write-region' explicitly allows it to be a
> string.
When will write-region invoke jka-commpr-write-region if it is called
with the first argument a string? That's the use case we should
discuss, not the direct invocation of jka-commpr-write-region in your
recipe, I think.
This bug report was last modified 3 years and 182 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.