0

My .emacs file contains

(use-package mds :commands mds mds-version :init (mds))

That produces, in Messages, (Shell command failed with code 1 and no output).

If :init is replaced with :config that message is not produced. Any suggestions on how to debug this? Replacing the definition of the mds function with a version that does nothing doesn't help, the behavior doesn't change, i.e. message is produced with :init but not :config.

1 Answer 1

1

Commands in :init is evaluated before the package is loaded.

That's why (mds) failed because mds has not been loaded when it is called.

You generally use :init to configure some variables the package will use when loading.

You should use :config if you want to call (mds) at the exact time you load the package.

Documentation for use-package

:init            Code to run before PACKAGE-NAME has been loaded.
:config          Code to run after PACKAGE-NAME has been loaded.  Note that
                 if loading is deferred for any reason, this code does not
                 execute until the lazy load has occurred.
7
  • Thanks. While using :config (mds) works, am still seeing, in the Messages buffer, after running mds, the message "(Shell command failed with code 1 and no output)". Maybe it's benign, but I'd like to know what is generating that message. Haven't a clue how to figure that out. It isn't caused by mds, which I confirmed by temporarily rewriting mds to do nothing; the same messages appears.
    – JoeRiel
    Jul 9, 2023 at 18:15
  • You can turn on debugger by M-x toggle-debug-on-error, and run that command again to see the trace.
    – yufu
    Jul 10, 2023 at 9:11
  • Have tried that with no help. Am currently using (use-package mds :commands mds mds-version :config (mds) (message "Finished loading mds")) After starting emacs, nothing of significance appears in the Messages buffer until I executed mds, then see (Shell command failed with code 1 and no output) Resuming loading Maple Debugger Server Finished loading Maple Debugger Server Executing toggle-debug-on-error either before or after this, and then executing mds, does nothing. Cannot debug the cause. The message seems benign, but annoying.
    – JoeRiel
    Jul 10, 2023 at 15:41
  • Can you share the content of mds? It looks like not on melpa/elpa.
    – yufu
    Jul 10, 2023 at 20:02
  • The package is available on github, github.com/JoeRiel/mdcs. That's somewhat older, and appears to have some byte-compilation issues, but I was able to use it to replace my existing package and see the same issue. The git name is actually mdcs; it supplies both a client (mdc, written in Maple) and a server (mds, written in elisp). The tool is for debugging Maple procedures. Suspect you only need the lisp part to see the issue.
    – JoeRiel
    Jul 11, 2023 at 23:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.