unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Alan Mackenzie <acm@muc.de>
Cc: emacs-devel@gnu.org
Subject: Re: Why does byte-compile-file copy the input file to a different buffer?
Date: Sun, 17 Dec 2023 19:18:08 +0200	[thread overview]
Message-ID: <83bkaokasv.fsf@gnu.org> (raw)
In-Reply-To: <ZX8rSGkvgFMPL6kg@ACM> (message from Alan Mackenzie on Sun, 17 Dec 2023 17:09:28 +0000)

> Date: Sun, 17 Dec 2023 17:09:28 +0000
> Cc: emacs-devel@gnu.org
> From: Alan Mackenzie <acm@muc.de>
> 
> > The command uses insert-file-contents to insert the file into the
> > input buffer, and works on that, so that looks very natural to me.
> > I'm not sure what is bothering you in that, or why.
> 
> >From inside the reader, the buffer " *Compiler Input*" is effectively
> anonymous: it gives no clue as to what the actual file or buffer is.

This doesn't appear to be true, since byte-compile-file binds
buffer-file-name to the name of the file whose contents it inserted.
It does that only temporarily, for calling normal-mode, but maybe we
could just do that for the entire duration of the compilation.

> All I want is the name of the real buffer, or failing that, the name of
> the real file.  When the reader sees " *Compiler Input*" does it have to
> assume that byte-compile-current-file is bound and use that?  Even
> recognising " *Compiler Input*-1" in C code is difficult - there're no
> string functions in Emacs which can test that a given string is a prefix
> of another string.  There's string-match, but it only works with a
> regular expression, not a plain string.  By the time I put that sort of
> code into a C routine, it is so bulky, it drowns out the prime purpose
> of the routine.
> 
> It's difficult.

If all you need is to have buffer-file-name set to the file's name, I
think that can be arranged relatively easily.



  reply	other threads:[~2023-12-17 17:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-17 16:06 Why does byte-compile-file copy the input file to a different buffer? Alan Mackenzie
2023-12-17 16:48 ` Eli Zaretskii
2023-12-17 17:09   ` Alan Mackenzie
2023-12-17 17:18     ` Eli Zaretskii [this message]
2023-12-17 18:37       ` Alan Mackenzie

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=83bkaokasv.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    /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).