all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* The function ‘cl-set-difference’ might not be defined at runtime
@ 2020-04-14 17:53 Jorge P. de Morais Neto
  2020-04-14 18:12 ` Štěpán Němec
  0 siblings, 1 reply; 18+ messages in thread
From: Jorge P. de Morais Neto @ 2020-04-14 17:53 UTC (permalink / raw)
  To: help-gnu-emacs

Hi.  I have a small Elisp file that calls `cl-set-difference'.  Flycheck
complains

    the function ‘cl-set-difference’ might not be defined at runtime. (emacs-lisp)

This complaint makes no sense to me, because cl-set-difference is
autoloaded, according to `describe-function'.  I verified this by
looking at its definition in the file cl-seq.el.  It does have the
autoload cookie.  I then read more about autoload and found about the
function `autloadp'.  To my surprise,
`(describe-function #'cl-set-difference)` returns nil.  Then I checked a
few other autoloads:

(autoloadp #'markdown-mode)
(autoloadp #'js-mode)

All of them return nil!  What gives?

I am using Spacemacs develop (and just before testing I updated the
Spacemacs code and all packages), but the autoloadp invocations happened
within vanilla Emacs: emacs -q.  And I invoked `autoloadp` just after
invoking emacs -q.  Emacs is version 27.0.90, compiled from an updated
checkout of the emacs-27 branch some minutes ago.

Regards

-- 
- <https://jorgemorais.gitlab.io/justice-for-rms/>
- I am Brazilian.  I hope my English is correct and I welcome feedback.
- <https://www.defectivebydesign.org/>
- <https://www.gnu.org/>



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

* Re: The function ‘cl-set-difference’ might not be defined at runtime
  2020-04-14 17:53 The function ‘cl-set-difference’ might not be defined at runtime Jorge P. de Morais Neto
@ 2020-04-14 18:12 ` Štěpán Němec
  2020-04-14 18:25   ` Jorge P. de Morais Neto
  0 siblings, 1 reply; 18+ messages in thread
From: Štěpán Němec @ 2020-04-14 18:12 UTC (permalink / raw)
  To: help-gnu-emacs

On Tue, 14 Apr 2020 14:53:43 -0300
Jorge P. de Morais Neto wrote:

> Hi.  I have a small Elisp file that calls `cl-set-difference'.  Flycheck
> complains
>
>     the function ‘cl-set-difference’ might not be defined at runtime. (emacs-lisp)

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=26782

> Then I checked a few other autoloads:
>
> (autoloadp #'markdown-mode)
> (autoloadp #'js-mode)
>
> All of them return nil!  What gives?

Try (autoloadp (symbol-function 'markdown-mode))

-- 
Štěpán



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

* Re: The function ‘cl-set-difference’ might not be defined at runtime
  2020-04-14 18:12 ` Štěpán Němec
@ 2020-04-14 18:25   ` Jorge P. de Morais Neto
  2020-04-14 18:39     ` Noam Postavsky
  2020-04-14 18:47     ` Štěpán Němec
  0 siblings, 2 replies; 18+ messages in thread
From: Jorge P. de Morais Neto @ 2020-04-14 18:25 UTC (permalink / raw)
  To: help-gnu-emacs

Em [2020-04-14 ter 20:12:24+0200], Štěpán Němec escreveu:

> Try (autoloadp (symbol-function 'markdown-mode))

Oh, then it works.  How embarrassing.

But still, why does Flycheck complains that ‘cl-set-difference’ might
not be defined at runtime, when it is an autoload?  What am I supposed
to do to placate it?

Regards
-- 
- <https://jorgemorais.gitlab.io/justice-for-rms/>
- I am Brazilian.  I hope my English is correct and I welcome feedback.
- Free Software Supporter:
  <https://www.fsf.org/free-software-supporter/subscribe>



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

* Re: The function ‘cl-set-difference’ might not be defined at runtime
  2020-04-14 18:25   ` Jorge P. de Morais Neto
@ 2020-04-14 18:39     ` Noam Postavsky
  2020-04-14 18:47     ` Štěpán Němec
  1 sibling, 0 replies; 18+ messages in thread
From: Noam Postavsky @ 2020-04-14 18:39 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list

On Tue, 14 Apr 2020 at 14:26, Jorge P. de Morais Neto
<jorge+list@disroot.org> wrote:

> But still, why does Flycheck complains that ‘cl-set-difference’ might
> not be defined at runtime, when it is an autoload?  What am I supposed
> to do to placate it?

cl-set-difference is not autoloaded in the normal way, you need to
load cl-lib to make it accessible.

See Bug#26782 "describe-function and autoloads not in main loaddefs"
https://debbugs.gnu.org/26782



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

* Re: The function ‘cl-set-difference’ might not be defined at runtime
  2020-04-14 18:25   ` Jorge P. de Morais Neto
  2020-04-14 18:39     ` Noam Postavsky
@ 2020-04-14 18:47     ` Štěpán Němec
  2020-04-14 19:17       ` Jorge P. de Morais Neto
  1 sibling, 1 reply; 18+ messages in thread
From: Štěpán Němec @ 2020-04-14 18:47 UTC (permalink / raw)
  To: help-gnu-emacs

On Tue, 14 Apr 2020 15:25:20 -0300
Jorge P. de Morais Neto wrote:

> Em [2020-04-14 ter 20:12:24+0200], Štěpán Němec escreveu:
>
>> Try (autoloadp (symbol-function 'markdown-mode))
>
> Oh, then it works.  How embarrassing.

Not particularly embarrassing IMO, esp. if you come from Common Lisp.
Elisp's #' works differently, e.g. (eq #'eq 'eq) => t.

> But still, why does Flycheck complains that ‘cl-set-difference’ might
> not be defined at runtime, when it is an autoload?  What am I supposed
> to do to placate it?

Did you have a look at that bug report? I thought the problem is
described there at some length. The simplest solution is probably to
just (require 'cl-lib).

-- 
Štěpán



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

* Re: The function ‘cl-set-difference’ might not be defined at runtime
  2020-04-14 18:47     ` Štěpán Němec
@ 2020-04-14 19:17       ` Jorge P. de Morais Neto
  2020-04-14 19:43         ` Noam Postavsky
  2020-04-14 20:21         ` Stefan Monnier
  0 siblings, 2 replies; 18+ messages in thread
From: Jorge P. de Morais Neto @ 2020-04-14 19:17 UTC (permalink / raw)
  To: help-gnu-emacs

Em [2020-04-14 ter 20:47:32+0200], Štěpán Němec escreveu:

> Did you have a look at that bug report?

I have looked at it just a few minutes ago, after reading Noam
Postavsky's reply.

> I thought the problem is described there at some length.  The simplest
> solution is probably to just (require 'cl-lib).

Yes, `(require 'cl-lib)` at top level placates Flycheck.  But for the
last drop of efficiency, I tried to `(require 'cl-lib)` inside the body
of the function that calls cl-set-difference, and put at the top level:

(declare-function cl-set-difference "cl-seq" (list1 list2 &rest cl-keys))

That does not placate Flycheck though.  Do you know why?  The 0.08s of
extra loading time will not kill anyone for sure (specially since this
is code for personal use and even I will use it only rarely), but if
there is an easy way to avoid it, I would like to know.

Regards
-- 
- <https://jorgemorais.gitlab.io/justice-for-rms/>
- I am Brazilian.  I hope my English is correct and I welcome feedback.
- Please adopt free/libre formats like PDF, ODF, Org, LaTeX, Opus, WebM and 7z.
- Free/libre software for Replicant, LineageOS and Android: https://f-droid.org
- [[https://www.gnu.org/philosophy/free-sw.html][What is free software?]]



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

* Re: The function ‘cl-set-difference’ might not be defined at runtime
  2020-04-14 19:17       ` Jorge P. de Morais Neto
@ 2020-04-14 19:43         ` Noam Postavsky
  2020-04-14 20:21           ` Štěpán Němec
  2020-04-14 20:21         ` Stefan Monnier
  1 sibling, 1 reply; 18+ messages in thread
From: Noam Postavsky @ 2020-04-14 19:43 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list

On Tue, 14 Apr 2020 at 15:17, Jorge P. de Morais Neto
<jorge+list@disroot.org> wrote:

> Yes, `(require 'cl-lib)` at top level placates Flycheck.  But for the
> last drop of efficiency, I tried to `(require 'cl-lib)` inside the body
> of the function that calls cl-set-difference, and put at the top level:
>
> (declare-function cl-set-difference "cl-seq" (list1 list2 &rest cl-keys))
>
> That does not placate Flycheck though.  Do you know why?

Works here for placating the byte-compiler, which as far as I know is
what Flycheck runs.



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

* Re: The function ‘cl-set-difference’ might not be defined at runtime
  2020-04-14 19:43         ` Noam Postavsky
@ 2020-04-14 20:21           ` Štěpán Němec
  2020-04-14 20:59             ` Jorge P. de Morais Neto
  0 siblings, 1 reply; 18+ messages in thread
From: Štěpán Němec @ 2020-04-14 20:21 UTC (permalink / raw)
  Cc: Help Gnu Emacs mailing list

On Tue, 14 Apr 2020 15:43:41 -0400
Noam Postavsky wrote:

>> Yes, `(require 'cl-lib)` at top level placates Flycheck.  But for the
>> last drop of efficiency, I tried to `(require 'cl-lib)` inside the body
>> of the function that calls cl-set-difference, and put at the top level:
>>
>> (declare-function cl-set-difference "cl-seq" (list1 list2 &rest cl-keys))
>>
>> That does not placate Flycheck though.  Do you know why?
>
> Works here for placating the byte-compiler, which as far as I know is
> what Flycheck runs.

Indeed. Works for me, too (with Flycheck, even).

Jorge, are you sure the warning you get is about `cl-set-difference' not
being defined and not something else?

-- 
Štěpán



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

* Re: The function ‘cl-set-difference’ might not be defined at runtime
  2020-04-14 19:17       ` Jorge P. de Morais Neto
  2020-04-14 19:43         ` Noam Postavsky
@ 2020-04-14 20:21         ` Stefan Monnier
  2020-04-14 21:10           ` Jorge P. de Morais Neto
  1 sibling, 1 reply; 18+ messages in thread
From: Stefan Monnier @ 2020-04-14 20:21 UTC (permalink / raw)
  To: help-gnu-emacs

> Yes, `(require 'cl-lib)` at top level placates Flycheck.  But for the
> last drop of efficiency, I tried to `(require 'cl-lib)` inside the body
> of the function that calls cl-set-difference, and put at the top level:

FWIW, I don't think it will be more efficient.

> (declare-function cl-set-difference "cl-seq" (list1 list2 &rest cl-keys))
> That does not placate Flycheck though.  Do you know why?  The 0.08s of
> extra loading time will not kill anyone for sure (specially since this
> is code for personal use and even I will use it only rarely), but if
> there is an easy way to avoid it, I would like to know.

(require 'seq) and then use `seq-difference`?


        Stefan




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

* Re: The function ‘cl-set-difference’ might not be defined at runtime
  2020-04-14 20:21           ` Štěpán Němec
@ 2020-04-14 20:59             ` Jorge P. de Morais Neto
  2020-04-15  4:01               ` Stefan Monnier
  0 siblings, 1 reply; 18+ messages in thread
From: Jorge P. de Morais Neto @ 2020-04-14 20:59 UTC (permalink / raw)
  To: help-gnu-emacs

Em [2020-04-14 ter 22:21:08+0200], Štěpán Němec escreveu:

> Indeed. Works for me, too (with Flycheck, even).
>
> Jorge, are you sure the warning you get is about `cl-set-difference' not
> being defined and not something else?

To placate Flycheck regarding the use of cl-assert, I required
'cl-macs when compiling.  So I had:

< Some defconst invocations >
< One defvar >
< Some other declare-function invocations >
(declare-function cl-set-difference "cl-seq" (list1 list2 &rest cl-keys))
< Some other declare-function invocations >
(eval-when-compile
  (require 'cl-macs))

And I just found out (after trial and error) that the declare-function
of cl-set-difference only placates Flycheck when it comes *after* that
eval-when-compile form.  So I moved the eval-when-compile to the top and
now I have:

(eval-when-compile
  (require 'cl-macs))
< Some defconst invocations >
< One defvar >
< Some other declare-function invocations >
(declare-function cl-set-difference "cl-seq" (list1 list2 &rest cl-keys))

That solved the problem.  I have no idea why, though.

Regards

-- 
- <https://jorgemorais.gitlab.io/justice-for-rms/>
- I am Brazilian.  I hope my English is correct and I welcome feedback.
- <https://www.defectivebydesign.org/>
- <https://www.gnu.org/>



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

* Re: The function ‘cl-set-difference’ might not be defined at runtime
  2020-04-14 20:21         ` Stefan Monnier
@ 2020-04-14 21:10           ` Jorge P. de Morais Neto
  2020-04-15  4:05             ` Stefan Monnier
  0 siblings, 1 reply; 18+ messages in thread
From: Jorge P. de Morais Neto @ 2020-04-14 21:10 UTC (permalink / raw)
  To: help-gnu-emacs

Hi Stefan.  Thank you for dedicating time to this thread!

Em [2020-04-14 ter 16:21:34-0400], Stefan Monnier escreveu:

>> Yes, `(require 'cl-lib)` at top level placates Flycheck.  But for the
>> last drop of efficiency, I tried to `(require 'cl-lib)` inside the body
>> of the function that calls cl-set-difference, and put at the top level:
>
> FWIW, I don't think it will be more efficient.

Well, I thought that putting `(require 'cl-lib)` inside the function
body would be more efficient by avoiding requiring cl-lib when that
function is not invoked (the file contains other functions).  But it
would only make a 0.08s difference, and only if cl-lib was not already
loaded anyway.

>> (declare-function cl-set-difference "cl-seq" (list1 list2 &rest cl-keys))
>> That does not placate Flycheck though.  Do you know why?  The 0.08s of
>> extra loading time will not kill anyone for sure (specially since this
>> is code for personal use and even I will use it only rarely), but if
>> there is an easy way to avoid it, I would like to know.
>
> (require 'seq) and then use `seq-difference`?
>

Just for curiosity, why would that be better?  Does seq load faster?  Or
is seq more likely to be already loaded?

Regards
-- 
- <https://jorgemorais.gitlab.io/justice-for-rms/>
- I am Brazilian.  I hope my English is correct and I welcome feedback.
- Free Software Supporter:
  <https://www.fsf.org/free-software-supporter/subscribe>



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

* Re: The function ‘cl-set-difference’ might not be defined at runtime
  2020-04-14 20:59             ` Jorge P. de Morais Neto
@ 2020-04-15  4:01               ` Stefan Monnier
  2020-04-15  4:34                 ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-04-15 12:52                 ` The function ‘cl-set-difference’ might not be defined at runtime Jorge P. de Morais Neto
  0 siblings, 2 replies; 18+ messages in thread
From: Stefan Monnier @ 2020-04-15  4:01 UTC (permalink / raw)
  To: help-gnu-emacs

> To placate Flycheck regarding the use of cl-assert, I required
> 'cl-macs when compiling.  So I had:

Bad idea.  `cl-assert` might be in `cl-macs` but might not.
The library that provides `cl-assert` is `cl-lib`.  Which parts of
`cl-lib` are actually in `cl-macs` or `cl-seq` or `cl-extra` or ... is
an internal detail that can change at any point.


        Stefan




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

* Re: The function ‘cl-set-difference’ might not be defined at runtime
  2020-04-14 21:10           ` Jorge P. de Morais Neto
@ 2020-04-15  4:05             ` Stefan Monnier
  0 siblings, 0 replies; 18+ messages in thread
From: Stefan Monnier @ 2020-04-15  4:05 UTC (permalink / raw)
  To: help-gnu-emacs

> Just for curiosity, why would that be better?  Does seq load faster?

In Emacs≥27, yes.

> Or is seq more likely to be already loaded?

Probably a toss-up: both are highly likely to be already loaded in
Emacs≥27.


        Stefan




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

* Re: The function ‘cl-set-difference’ might not be defined at runtime
  2020-04-15  4:01               ` Stefan Monnier
@ 2020-04-15  4:34                 ` Emanuel Berg via Users list for the GNU Emacs text editor
       [not found]                   ` <20200415070046.GA17630@tuxteam.de>
  2020-04-15 12:52                 ` The function ‘cl-set-difference’ might not be defined at runtime Jorge P. de Morais Neto
  1 sibling, 1 reply; 18+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-04-15  4:34 UTC (permalink / raw)
  To: help-gnu-emacs

Stefan Monnier wrote:

>> To placate Flycheck regarding the use of cl-assert,
>> I required 'cl-macs when compiling. So I had:
>
> Bad idea. `cl-assert` might be in `cl-macs` but might
> not. The library that provides `cl-assert` is `cl-lib`

You mean this? (in cl-lib.el, Emacs 26.1)

(provide 'cl-lib)
(unless (load "cl-loaddefs" 'noerror 'quiet)
  ;; When bootstrapping, cl-loaddefs hasn't been built yet!
  (require 'cl-macs)
  (require 'cl-seq))

What does it mean when provide isn't last in the file?

Also, what does this mean?

;; Local variables:
;; byte-compile-dynamic: t
;; End:

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




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

* Re: The function ‘cl-set-difference’ might not be defined at runtime
  2020-04-15  4:01               ` Stefan Monnier
  2020-04-15  4:34                 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-04-15 12:52                 ` Jorge P. de Morais Neto
  2020-04-15 13:01                   ` Noam Postavsky
  1 sibling, 1 reply; 18+ messages in thread
From: Jorge P. de Morais Neto @ 2020-04-15 12:52 UTC (permalink / raw)
  To: help-gnu-emacs

Em [2020-04-15 qua 00:01:38-0400], Stefan Monnier escreveu:

>> To placate Flycheck regarding the use of cl-assert, I required
>> 'cl-macs when compiling.  So I had:
>
> Bad idea.  `cl-assert` might be in `cl-macs` but might not.
> The library that provides `cl-assert` is `cl-lib`.  Which parts of
> `cl-lib` are actually in `cl-macs` or `cl-seq` or `cl-extra` or ... is
> an internal detail that can change at any point.

Thank you for the information.  I have fixed my code.  There still
remains the oddity that `(eval-when-compile (require 'cl-lib))` must
come before the declare-function of cl-set-difference or else Flycheck
complains.  However, at least now I can fix it by reorganizing the code
-- and, now that I think, the `(eval-when-compile (require 'cl-lib))`
fits nicely at the beginning of the file.

Regards
-- 
- <https://jorgemorais.gitlab.io/justice-for-rms/>
- I am Brazilian.  I hope my English is correct and I welcome feedback.
- Please adopt free/libre formats like PDF, ODF, Org, LaTeX, Opus, WebM and 7z.
- Free/libre software for Replicant, LineageOS and Android: https://f-droid.org
- [[https://www.gnu.org/philosophy/free-sw.html][What is free software?]]



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

* Re: The function ‘cl-set-difference’ might not be defined at runtime
  2020-04-15 12:52                 ` The function ‘cl-set-difference’ might not be defined at runtime Jorge P. de Morais Neto
@ 2020-04-15 13:01                   ` Noam Postavsky
  0 siblings, 0 replies; 18+ messages in thread
From: Noam Postavsky @ 2020-04-15 13:01 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list

On Wed, 15 Apr 2020 at 08:52, Jorge P. de Morais Neto
<jorge+list@disroot.org> wrote:

> Thank you for the information.  I have fixed my code.  There still
> remains the oddity that `(eval-when-compile (require 'cl-lib))` must
> come before the declare-function of cl-set-difference or else Flycheck
> complains.

This sounds like Bug#21963, maybe the fix for that bug only works when
the (eval-when-compile (require ....)) statement precedes the (require
...) statement.

https://debbugs.gnu.org/21963



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

* ;; Local variables: (was: Re: The function ‘cl-set-difference’ might not be defined at runtime)
       [not found]                   ` <20200415070046.GA17630@tuxteam.de>
@ 2020-04-15 17:14                     ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-04-15 17:25                       ` tomas
  0 siblings, 1 reply; 18+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-04-15 17:14 UTC (permalink / raw)
  To: help-gnu-emacs

tomas wrote:

>> [...] what does this mean?
>> 
>> ;; Local variables:
>> ;; byte-compile-dynamic: t
>> ;; End:
>
> Quoth "describe-variable" (aka C-h v):
>
>   byte-compile-dynamic is a variable defined in
>   ‘bytecomp.el’. Its value is nil
>
>     This variable is obsolete since 27.1; not
>     worthwhile any more. This variable is safe as
>     a file local variable if its value satisfies the
>     predicate ‘booleanp’. Probably introduced at or
>     before Emacs version 19.29.
>
>   Documentation:
>   If non-nil, compile function bodies so they load
>   lazily. They are hidden in comments in the compiled
>   file, and each one is brought into core when the
>   function is called.
>
>   To enable this option, make it a file-local variable
>   in the source file you want it to apply to.
>   For example, add -*-byte-compile-dynamic: t;-*- on
>   the first line.
>
>   When this option is true, if you load the compiled
>   file and then move it, the functions you loaded will
>   not be able to run.
>
> So, if your Emacs is new enough, it's just a comment.
> Otherwise, it hides functions in comments ;-D

Yes, but I meant the comment/variable syntax, which
I haven't see before. In the particular variable's
docstring, they mention

  -*- byte-compile-dynamic: t -*-

so how does that differ from

  ;; Local variables:
  ;; byte-compile-dynamic: t
  ;; End:

?

As for the syntax, I tried with this and then did
`emacs-lisp-mode', what happened was it popped up
a warning telling me the values were possibly unsafe -
what does that mean?

  ;; Local variables:
  ;; local-test-var: t
  ;; End:

When I replied they were safe this line appeared in the
`custom-file' file, which I don't care for and prefer to
be blank or not in use

  '(safe-local-variable-values (quote ((local-test-var . t))))

I tried to do it manually like this, with a new variable
name to prevent possible interference, but it didn't
work

  (safe-local-variable-values '((local-test-var-1 . t)))
  ;; Local variables:
  ;; local-test-var-1: t
  ;; End:

because safe-local-variable-values isn't a defined
function, maybe custom just looks for it when it parses
custom-file.

Maybe one can disable custom's operations altogether by
setting custom-file to nil?

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




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

* Re: ;; Local variables: (was: Re: The function ‘cl-set-difference’ might not be defined at runtime)
  2020-04-15 17:14                     ` ;; Local variables: (was: Re: The function ‘cl-set-difference’ might not be defined at runtime) Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-04-15 17:25                       ` tomas
  0 siblings, 0 replies; 18+ messages in thread
From: tomas @ 2020-04-15 17:25 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1874 bytes --]

On Wed, Apr 15, 2020 at 07:14:03PM +0200, Emanuel Berg via Users list for the GNU Emacs text editor wrote:
> tomas wrote:
> 
> >> [...] what does this mean?
> >> 
> >> ;; Local variables:
> >> ;; byte-compile-dynamic: t
> >> ;; End:
> >
> > Quoth "describe-variable" (aka C-h v):

[...]

> Yes, but I meant the comment/variable syntax, which
> I haven't see before. In the particular variable's
> docstring, they mention
> 
>   -*- byte-compile-dynamic: t -*-
> 
> so how does that differ from
> 
>   ;; Local variables:
>   ;; byte-compile-dynamic: t
>   ;; End:

The one goes to the beginning of the file, the other to the
end. Otherwise, they are just alternative ways to express
the same thing. The "-*- ... -*-" form has limitations whenever
the first line of the file is needed for other things (e.g.
the #! in shell scripts. When you've got many file variables,
the end form is arguably  a bit more readable. See "File
Variables" in the manual [1]

> As for the syntax, I tried with this and then did
> `emacs-lisp-mode', what happened was it popped up
> a warning telling me the values were possibly unsafe -
> what does that mean?
> 
>   ;; Local variables:
>   ;; local-test-var: t
>   ;; End:

File variables can do Bad Things (remember Word macro
viruses?). Code is potentially executed when you load
the file. So there's a limited set of file variables
considered "safe" (to which you can add) -- beyond
that you are warned (unless you switch that off).
Just imagine I (evil mastermind) send you a text
file with some bad stuff hidden in file variables...
See [2].

Cheers

[1] https://www.gnu.org/software/emacs/manual/html_node/emacs/Specifying-File-Variables.html#Specifying-File-Variables
[2] https://www.gnu.org/software/emacs/manual/html_node/emacs/Safe-File-Variables.html#Safe-File-Variables
-- t

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

end of thread, other threads:[~2020-04-15 17:25 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-14 17:53 The function ‘cl-set-difference’ might not be defined at runtime Jorge P. de Morais Neto
2020-04-14 18:12 ` Štěpán Němec
2020-04-14 18:25   ` Jorge P. de Morais Neto
2020-04-14 18:39     ` Noam Postavsky
2020-04-14 18:47     ` Štěpán Němec
2020-04-14 19:17       ` Jorge P. de Morais Neto
2020-04-14 19:43         ` Noam Postavsky
2020-04-14 20:21           ` Štěpán Němec
2020-04-14 20:59             ` Jorge P. de Morais Neto
2020-04-15  4:01               ` Stefan Monnier
2020-04-15  4:34                 ` Emanuel Berg via Users list for the GNU Emacs text editor
     [not found]                   ` <20200415070046.GA17630@tuxteam.de>
2020-04-15 17:14                     ` ;; Local variables: (was: Re: The function ‘cl-set-difference’ might not be defined at runtime) Emanuel Berg via Users list for the GNU Emacs text editor
2020-04-15 17:25                       ` tomas
2020-04-15 12:52                 ` The function ‘cl-set-difference’ might not be defined at runtime Jorge P. de Morais Neto
2020-04-15 13:01                   ` Noam Postavsky
2020-04-14 20:21         ` Stefan Monnier
2020-04-14 21:10           ` Jorge P. de Morais Neto
2020-04-15  4:05             ` Stefan Monnier

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.