all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* ;;;###autoload declarations
@ 2023-06-23 11:09 uzibalqa
  2023-06-23 16:08 ` Michael Heerdegen
  0 siblings, 1 reply; 10+ messages in thread
From: uzibalqa @ 2023-06-23 11:09 UTC (permalink / raw)
  To: uzibalqa via Users list for the GNU Emacs text editor

Have been looking at the ;;;###autoload declaration.  Reading through the manual,
the cookie just before the real definition of a function, indicates that a specific
function exists.  Without such declaration, the function call would generate an error
because the required function has not been properly included in the code before 
attempting to call the function.  This is done so that emacs would not consume system
resources and slow down.

Yet, one still needs a call to "require" which loads the file and all its deffun's and
defvar's even without any use of the ;;;###autoload declaration.

It then seems to me that although autoloading is intended as described, technically 
it is untrue, because everything seems to be evaluated all in one go.

What is going on ?











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

* Re: ;;;###autoload declarations
  2023-06-23 11:09 ;;;###autoload declarations uzibalqa
@ 2023-06-23 16:08 ` Michael Heerdegen
  2023-06-23 16:42   ` uzibalqa
  2023-06-23 18:26   ` Emanuel Berg
  0 siblings, 2 replies; 10+ messages in thread
From: Michael Heerdegen @ 2023-06-23 16:08 UTC (permalink / raw)
  To: help-gnu-emacs

uzibalqa <uzibalqa@proton.me> writes:

> It then seems to me that although autoloading is intended as
> described, technically
> it is untrue, because everything seems to be evaluated all in one go.
>
> What is going on ?

You need to generate a loaddefs file.

Michael.




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

* Re: ;;;###autoload declarations
  2023-06-23 16:08 ` Michael Heerdegen
@ 2023-06-23 16:42   ` uzibalqa
  2023-06-24  2:02     ` Michael Heerdegen
  2023-06-23 18:26   ` Emanuel Berg
  1 sibling, 1 reply; 10+ messages in thread
From: uzibalqa @ 2023-06-23 16:42 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs

------- Original Message -------
On Saturday, June 24th, 2023 at 4:08 AM, Michael Heerdegen <michael_heerdegen@web.de> wrote:


> uzibalqa uzibalqa@proton.me writes:
> 
> > It then seems to me that although autoloading is intended as
> > described, technically
> > it is untrue, because everything seems to be evaluated all in one go.
> > 
> > What is going on ?
> 
> 
> You need to generate a loaddefs file.
> 
> Michael.

What is the procedure of using a loaddefs.el ?  The loaddefs.el is supposed to get executed
while building Emacs.  What does "building emacs" mean ?  Does it mean running an emacs instance ?







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

* Re: ;;;###autoload declarations
  2023-06-23 16:08 ` Michael Heerdegen
  2023-06-23 16:42   ` uzibalqa
@ 2023-06-23 18:26   ` Emanuel Berg
  2023-06-26 13:27     ` [External] : " Drew Adams
  1 sibling, 1 reply; 10+ messages in thread
From: Emanuel Berg @ 2023-06-23 18:26 UTC (permalink / raw)
  To: help-gnu-emacs

Michael Heerdegen wrote:

>> It then seems to me that although autoloading is intended
>> as described, technically it is untrue, because everything
>> seems to be evaluated all in one go.
>>
>> What is going on ?
>
> You need to generate a loaddefs file.
  
If we change "all in one go" into "sequentially" or "in the
order specified by the Lisp syntax" then - that's the natural
order of things.

So ;;;###autoload is obviously an exception ... but anyway, it
works like this, as described in the documentation -

  The autoload facility lets you register the existence of
  a function or macro, but put off loading the file that
  defines it. The first call to the function automatically
  loads the proper library, in order to install the real
  definition and other associated code, then runs the real
  definition as if it had been loaded all along.
  <https://www.gnu.org/software/emacs/manual/html_node/elisp/Autoload.html>

(info "(elisp) Autoload")

However, what I can see it fails to address why this is at all
desirable to do and, assuming it is, in what cases more
precisely it is useful.

Which I think is a candidate for the second if not
first paragraph! If you agree.

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: ;;;###autoload declarations
  2023-06-23 16:42   ` uzibalqa
@ 2023-06-24  2:02     ` Michael Heerdegen
  2023-06-24 11:27       ` uzibalqa
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Heerdegen @ 2023-06-24  2:02 UTC (permalink / raw)
  To: help-gnu-emacs

uzibalqa <uzibalqa@proton.me> writes:

> What is the procedure of using a loaddefs.el?

It's a file containing the autoload references.  It's normally build
automatically - when building Emacs, installing packages, etc.  And
normally loaded automatically at startup.

So it's a quite low-level mechanism not really useful for the end user.
Unless maybe, you generate a loaddefs file for a bunch of third-party
libraries that you want to use and you did not install them with package
manager or the OS.  Then it may make sense to build a loaddefs file
yourself.

Michael.




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

* Re: ;;;###autoload declarations
  2023-06-24  2:02     ` Michael Heerdegen
@ 2023-06-24 11:27       ` uzibalqa
  2023-06-25  1:55         ` Michael Heerdegen
  0 siblings, 1 reply; 10+ messages in thread
From: uzibalqa @ 2023-06-24 11:27 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs


------- Original Message -------
On Saturday, June 24th, 2023 at 2:02 PM, Michael Heerdegen <michael_heerdegen@web.de> wrote:


> uzibalqa uzibalqa@proton.me writes:
> 
> > What is the procedure of using a loaddefs.el?
> 
> 
> It's a file containing the autoload references. It's normally build
> automatically - when building Emacs, installing packages, etc. And
> normally loaded automatically at startup.
> 
> So it's a quite low-level mechanism not really useful for the end user.
> Unless maybe, you generate a loaddefs file for a bunch of third-party
> libraries that you want to use and you did not install them with package
> manager or the OS. Then it may make sense to build a loaddefs file
> yourself.
> 
> Michael.

Would you see benefits in using a loaddefs file for those writing their own
minor modes and customisation files ?  Autoloading could be useful if things
could be made easier to set up.




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

* Re: ;;;###autoload declarations
  2023-06-24 11:27       ` uzibalqa
@ 2023-06-25  1:55         ` Michael Heerdegen
  0 siblings, 0 replies; 10+ messages in thread
From: Michael Heerdegen @ 2023-06-25  1:55 UTC (permalink / raw)
  To: help-gnu-emacs

uzibalqa <uzibalqa@proton.me> writes:

> Would you see benefits in using a loaddefs file for those writing their own
> minor modes and customisation files ?  Autoloading could be useful if things
> could be made easier to set up.

Not really, unless you have tons of such stuff and want to avoid to load
all of it.  Even then, explicit `require' calls or manually added
`autoload' calls may be better/simpler.

Keep in mind that the only thing you get is that you avoid that some
files are loaded into memory in sessions that don't need them.  If you
are the only user of this stuff this is not such a big win.  And the
disadvantage is that you have to remember to rebuild the loaddefs-file
after changing any of the affected files.

If you want to experiment in that direction, a better idea is probably
to build you own packages and install them with the package manager
using a local source (I never tried that myself, though).  Still, I
doubt it's worth the time until your goal is to share that stuff sooner
or later or learn something new.

Michael.




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

* RE: [External] : Re: ;;;###autoload declarations
  2023-06-23 18:26   ` Emanuel Berg
@ 2023-06-26 13:27     ` Drew Adams
  2023-06-30 15:35       ` Emanuel Berg
  0 siblings, 1 reply; 10+ messages in thread
From: Drew Adams @ 2023-06-26 13:27 UTC (permalink / raw)
  To: Emanuel Berg, help-gnu-emacs@gnu.org

> (info "(elisp) Autoload")
> 
> However, what I can see it fails to address why this is at all
> desirable to do and, assuming it is, in what cases more
> precisely it is useful.

If you never use anything from some library
then it isn't loaded.  That's the idea: load
code only if and when you need it.

Autoloaded commands (typically) and other
things (not so typically) are available to
the Help system, so you can see what they
do etc., even though their definitions
haven't been loaded.

If/when you invoke an autoloaded command,
_then_ the file defining it is loaded
(which often defines other commands etc.).
___

Another example of late binding - one of the
most important software ideas and practices.

Lazy evaluation (think purely functional
languages) is a prime example of late binding.
___

Beyond normal-order (i.e., outermost-first)
evaluation, which is used for lazy languages,
there's a more stringent on-need evaluation,
which is defined for some rewrite systems.
It needs costly analysis of code to determine
exactly what really needs to be evaluated when.



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

* Re: [External] : Re: ;;;###autoload declarations
  2023-06-26 13:27     ` [External] : " Drew Adams
@ 2023-06-30 15:35       ` Emanuel Berg
  2023-07-03 15:59         ` Drew Adams
  0 siblings, 1 reply; 10+ messages in thread
From: Emanuel Berg @ 2023-06-30 15:35 UTC (permalink / raw)
  To: help-gnu-emacs

Drew Adams wrote:

>> However, what I can see it fails to address why this is at
>> all desirable to do and, assuming it is, in what cases more
>> precisely it is useful.
>
> If you never use anything from some library then it isn't
> loaded. That's the idea: load code only if and when you need
> it [..]

So it isn't loaded automatically, it is loaded when needed?

Is that the same as just-in-time or lazy evaluation?

Maybe just different context/points of emphasis ...

-- 
underground experts united
https://dataswamp.org/~incal




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

* RE: [External] : Re: ;;;###autoload declarations
  2023-06-30 15:35       ` Emanuel Berg
@ 2023-07-03 15:59         ` Drew Adams
  0 siblings, 0 replies; 10+ messages in thread
From: Drew Adams @ 2023-07-03 15:59 UTC (permalink / raw)
  To: Emanuel Berg, help-gnu-emacs@gnu.org

> > If you never use anything from some library then it isn't
> > loaded. That's the idea: load code only if and when you need
> > it [..]
> 
> So it isn't loaded automatically, it is loaded when needed?

It's loaded when you first invoke the command.

> Is that the same as just-in-time or lazy evaluation?

Lazy evaluation usually refers to expression evaluation, particularly in the context of functional, logic, or constraint programming languages.

> Maybe just different context/points of emphasis ...

Yes, you can say that.  Another, usually more general, term is "late binding": Don't fix/set/define something before you need to.  Keep your options open...



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

end of thread, other threads:[~2023-07-03 15:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-23 11:09 ;;;###autoload declarations uzibalqa
2023-06-23 16:08 ` Michael Heerdegen
2023-06-23 16:42   ` uzibalqa
2023-06-24  2:02     ` Michael Heerdegen
2023-06-24 11:27       ` uzibalqa
2023-06-25  1:55         ` Michael Heerdegen
2023-06-23 18:26   ` Emanuel Berg
2023-06-26 13:27     ` [External] : " Drew Adams
2023-06-30 15:35       ` Emanuel Berg
2023-07-03 15:59         ` 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.