all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Byte compilation without writing the .elc file
@ 2019-06-23 11:53 Lars Ingebrigtsen
  2019-06-23 12:55 ` Stefan Monnier
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Lars Ingebrigtsen @ 2019-06-23 11:53 UTC (permalink / raw)
  To: emacs-devel

Often when I'm working on an out-of-tree Emacs Lisp file, I want to do
byte compilation to see whether what I've done generates any warnings --
but I don't want the .elc file, because I want to run it from .el.

So I `M-x byte-compile-file' and then delete the .elc file.  This seems
kinda sub-optimal, and surely others must also have this problem.

The internal `byte-compile-from-buffer' function almost does the right
thing, but it doesn't set things up properly, so it doesn't quite work.

So I think it would be a good idea if Emacs had a command called, say,
`byte-compile-buffer' that does the same thing as `byte-compile-file',
but for the current buffer and without outputting anything.  Does that
sound OK?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




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

* Re: Byte compilation without writing the .elc file
  2019-06-23 11:53 Byte compilation without writing the .elc file Lars Ingebrigtsen
@ 2019-06-23 12:55 ` Stefan Monnier
  2019-06-23 13:35   ` Lars Ingebrigtsen
  2019-06-23 13:14 ` Clément Pit-Claudel
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2019-06-23 12:55 UTC (permalink / raw)
  To: emacs-devel

> Often when I'm working on an out-of-tree Emacs Lisp file, I want to do
> byte compilation to see whether what I've done generates any warnings --
> but I don't want the .elc file, because I want to run it from .el.

Have you tried `flymake-mode`?


        Stefan




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

* Re: Byte compilation without writing the .elc file
  2019-06-23 11:53 Byte compilation without writing the .elc file Lars Ingebrigtsen
  2019-06-23 12:55 ` Stefan Monnier
@ 2019-06-23 13:14 ` Clément Pit-Claudel
  2019-06-23 13:38   ` Lars Ingebrigtsen
  2019-06-23 13:32 ` phillip.lord
  2019-06-23 15:49 ` Drew Adams
  3 siblings, 1 reply; 7+ messages in thread
From: Clément Pit-Claudel @ 2019-06-23 13:14 UTC (permalink / raw)
  To: emacs-devel

On 2019-06-23 07:53, Lars Ingebrigtsen wrote:
> So I think it would be a good idea if Emacs had a command called, say,
> `byte-compile-buffer' that does the same thing as `byte-compile-file',
> but for the current buffer and without outputting anything.  Does that
> sound OK?

I think it would be great.  In Flycheck we have to save a copy of the buffer, and tweak byte-compile-dest-file-function to create a temporary output file, too.  If both of these could go it would be awesome.

I think you could even make byte-compile-buffer return a other buffer with the ELC contents, and then byte-compile-file could be trivially implemented in terms of that.



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

* Re: Byte compilation without writing the .elc file
  2019-06-23 11:53 Byte compilation without writing the .elc file Lars Ingebrigtsen
  2019-06-23 12:55 ` Stefan Monnier
  2019-06-23 13:14 ` Clément Pit-Claudel
@ 2019-06-23 13:32 ` phillip.lord
  2019-06-23 15:49 ` Drew Adams
  3 siblings, 0 replies; 7+ messages in thread
From: phillip.lord @ 2019-06-23 13:32 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Emacs-devel, emacs-devel

On 2019-06-23 12:53, Lars Ingebrigtsen wrote:
> Often when I'm working on an out-of-tree Emacs Lisp file, I want to do
> byte compilation to see whether what I've done generates any warnings 
> --
> but I don't want the .elc file, because I want to run it from .el.
> 
> So I `M-x byte-compile-file' and then delete the .elc file.  This seems
> kinda sub-optimal, and surely others must also have this problem.
> 
> The internal `byte-compile-from-buffer' function almost does the right
> thing, but it doesn't set things up properly, so it doesn't quite work.
> 
> So I think it would be a good idea if Emacs had a command called, say,
> `byte-compile-buffer' that does the same thing as `byte-compile-file',
> but for the current buffer and without outputting anything.  Does that
> sound OK?


I think that the functionality might be good but the name might be 
confusing, since in this case, byte-compile-buffer
wouldn't do anything (except produce error messages). There is also 
"emacs-lisp-byte-compile" and
"emacs-lisp-byte-compile-and-load".

Given that, I think, it is not possible to load a byte compiled file 
that has not been saved and you do not want to
add this, why either add an option to `emacs-lisp-byte-compile' and 
`byte-compile-file'. Or alternatively, add a few
function such as `emacs-lisp-check-errors' or equivalent. I mean, in 
this case, the byte-compilation is not really
the point; it's just how you are checking the file.




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

* Re: Byte compilation without writing the .elc file
  2019-06-23 12:55 ` Stefan Monnier
@ 2019-06-23 13:35   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 7+ messages in thread
From: Lars Ingebrigtsen @ 2019-06-23 13:35 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

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

>> Often when I'm working on an out-of-tree Emacs Lisp file, I want to do
>> byte compilation to see whether what I've done generates any warnings --
>> but I don't want the .elc file, because I want to run it from .el.
>
> Have you tried `flymake-mode`?

I hadn't, but now I have.  It seems nice, but I also like the
straightforward byte compilation output buffer...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



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

* Re: Byte compilation without writing the .elc file
  2019-06-23 13:14 ` Clément Pit-Claudel
@ 2019-06-23 13:38   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 7+ messages in thread
From: Lars Ingebrigtsen @ 2019-06-23 13:38 UTC (permalink / raw)
  To: Clément Pit-Claudel; +Cc: emacs-devel

Clément Pit-Claudel <cpitclaudel@gmail.com> writes:

> I think you could even make byte-compile-buffer return a other buffer
> with the ELC contents, and then byte-compile-file could be trivially
> implemented in terms of that.

Yeah, I think that makes sense.  `byte-compile-file' currently sets up a
whole lot of stuff and then calls `byte-compile-from-buffer'.  The
modification would be to move all the setup code to the new
`byte-compile-buffer' function, and then call that, I think...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



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

* RE: Byte compilation without writing the .elc file
  2019-06-23 11:53 Byte compilation without writing the .elc file Lars Ingebrigtsen
                   ` (2 preceding siblings ...)
  2019-06-23 13:32 ` phillip.lord
@ 2019-06-23 15:49 ` Drew Adams
  3 siblings, 0 replies; 7+ messages in thread
From: Drew Adams @ 2019-06-23 15:49 UTC (permalink / raw)
  To: Lars Ingebrigtsen, emacs-devel

> Often when I'm working on an out-of-tree Emacs Lisp file, I want to do
                                                      ^^^^
> byte compilation to see whether what I've done generates any warnings --
> but I don't want the .elc file, because I want to run it from .el.
> 
> So I `M-x byte-compile-file' and then delete the .elc file.  This seems
> kinda sub-optimal, and surely others must also have this problem.
> 
> The internal `byte-compile-from-buffer' function almost does the right
> thing, but it doesn't set things up properly, so it doesn't quite work.
> 
> So I think it would be a good idea if Emacs had a command called, say,
> `byte-compile-buffer' that does the same thing as `byte-compile-file',
                ^^^^^^
> but for the current buffer and without outputting anything.  Does that
> sound OK?

I too do that sometimes: byte-compile a file, then
delete the *.elc.  I'm in favor of a new command to
do that (but of course avoiding creating and then
deleting the file).

However, I think the command should be available
from outside any buffer visiting the file, and it
should take a file, not a buffer, as its argument.

There should be no reason to have to visit the file
in a buffer to be able to get the desired effect.

For example, when I do this I often do it in Dired,
using `B' to compile, followed by `D'.



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

end of thread, other threads:[~2019-06-23 15:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-23 11:53 Byte compilation without writing the .elc file Lars Ingebrigtsen
2019-06-23 12:55 ` Stefan Monnier
2019-06-23 13:35   ` Lars Ingebrigtsen
2019-06-23 13:14 ` Clément Pit-Claudel
2019-06-23 13:38   ` Lars Ingebrigtsen
2019-06-23 13:32 ` phillip.lord
2019-06-23 15:49 ` Drew Adams

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.