unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Braun Gábor" <braungb88@gmail.com>
Cc: 52451@debbugs.gnu.org
Subject: bug#52451: 27.1; jka-compr-write-region produces wrong type argument error
Date: Sun, 12 Dec 2021 16:28:09 +0200	[thread overview]
Message-ID: <83ilvtoq2u.fsf@gnu.org> (raw)
In-Reply-To: <3230961.nYHENnkMsn@gabor> (message from Braun Gábor on Sun, 12 Dec 2021 15:09:08 +0100)

> From: Braun Gábor <braungb88@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.





  reply	other threads:[~2021-12-12 14:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-12 14:09 bug#52451: 27.1; jka-compr-write-region produces wrong type argument error Braun Gábor
2021-12-12 14:28 ` Eli Zaretskii [this message]
2021-12-12 18:53   ` Braun Gábor
2021-12-13 13:02     ` Eli Zaretskii
2021-12-14 13:52       ` Lars Ingebrigtsen

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=83ilvtoq2u.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=52451@debbugs.gnu.org \
    --cc=braungb88@gmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

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

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