emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Warnings in init files (was: Include leaf in Emacs distribution)


From: Stefan Monnier
Subject: Warnings in init files (was: Include leaf in Emacs distribution)
Date: Fri, 23 Oct 2020 12:46:23 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>  '(leaf server
>     :doc "Lisp code for GNU Emacs running as server process"
>     :defvar server-temp-file-regexp
>     :defun server-running-p
>     :config
>     (setq server-temp-file-regexp
>           (rx-to-string `(or (regexp ,server-temp-file-regexp) ".DS_Store") 
> t))
>     (unless (server-running-p)
>       (server-start))))

That's not the solution I'm looking for since it requires that the user
explicitly silences the warnings using :defvar or :defun (i.e. no real
benefit compared to the "old style" config).

I was thinking of something more like:

    (foo server
     (setq server-temp-file-regexp
           (rx-to-string `(or (regexp ,server-temp-file-regexp) ".DS_Store") t))
     (unless (server-running-p)
       (server-start)))

This should be sufficient (given a sufficiently clever handling of
`foo`) since you can go look inside `server.el` and find that those
functions and vars are indeed defined.

Of course, this is not the best example, since the old-style works just
as well without any cleverness:

    (require 'server)
    (setq server-temp-file-regexp
          (rx-to-string `(or (regexp ,server-temp-file-regexp) ".DS_Store") t))
    (unless (server-running-p)
      (server-start)))

Tho I don't recommend this style since `require` is a bad habit in an
init file (in this case it's acceptable since the package will have to
be loaded at this point anyway).


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]