doomemacs / doomemacs/core

Unable to run doomscript using defcli!

Open
#8,243 4 comments 2 reactions 0 assignees View on GitHub
is:bug needs-triage
Dominant language
Emacs Lisp
Stars
22.7k
Forks
3.1k
Avg merge
10h 46m
Merged PRs (30d)
4

Description

### I confirm that...

- [x] I have searched the [issue tracker](https://github.com/doomemacs/doomemacs/issues), [documentation](https://docs.doomemacs.org), [FAQ](https://docs.doomemacs.org/-/faq), [Discourse](https://discourse.doomemacs.org), and [Google](https://google.com), in case this issue has already been reported/resolved.

- [x] I have read "[How to Debug Issues](https://doomemacs.org/d/how2debug)", and will use it to provide as much information about this issue as possible.

- [x] The issue can be reproduced on the **latest** available commit of Doom.

- [x] The issue can be reproduced on a stable release of Emacs, such as 27, 28, or 29. *(Unstable versions end in .50, .60, or .9x)*

### Expected behavior

I have this script that I used to export the agendas to ical files:

```
#!/usr/bin/env doomscript

(defcli! export-to-ics (&args files)
(require 'doom-start) ; load your user config
(mine/org-agenda-export-to-ics)) ; and export the calendr
(run! "export-to-ics" (cdr (member "--" argv)))
```

I expect to be able to run a doomscript that loads the user configuration and executes a function defined by the user, like I used to.

after upgrading it stopped working, I've seen there have been changes to doom-start , so I tried changing the code to this:

```
#!/usr/bin/env doomscript

(defcli! export-to-ics (&args files)
(doom-load (doom-profile-init-file doom-profile))
(doom-startup)

(mine/org-agenda-export-to-ics)) ; and export the calendr

(run! "export-to-ics" (cdr (member "--" argv)))
```

### Current behavior

when I run the doomscript I get this error

```
x There was an unexpected runtime error
Message: Wrong type argument
Details: (hash-table-p nil)
Backtrace:
(gethash (:completion . company) nil)
(and t (gethash key doom-modules))
(let* ((m (and t (gethash key doom-modules)))) (if m (if property (aref m (or (plist-get '(:index 1 :group 2 :name 3 :depth 4 :flags 5 :features 6 :path 7) property) (error "Unknown doom-module property: %s" property))) m) nil))
(doom-module-get (:completion . company) :path)
(and t (doom-module-get key :path))
(let* ((path (and t (doom-module-get key :path)))) (if path (if file (file-name-concat path file) path) nil))
(doom-module-expand-path (:completion . company) nil)
(and t (doom-module-expand-path key file))
(let* ((path (and t (doom-module-expand-path key file)))) (if path (if (or (null file) (file-exists-p path)) path) (let* ((module (doom-module-key key)) (group (if module (car-safe (prog1 module (setq module (cdr module)))) (signal 'wrong-number-of-arguments (list '(group . module) (length module))))) (group (doom-keyword-name group)) (module (if module (symbol-name module...
(let (file-name-handler-alist) (let* ((path (and t (doom-module-expand-path key file)))) (if path (if (or (null file) (file-exists-p path)) path) (let* ((module (doom-module-key key)) (group (if module (car-safe (prog1 module (setq module (cdr module)))) (signal 'wrong-number-of-arguments (list '(group . module) (length module))))) (group (doom-keyword-name group)) (module...
(doom-module-locate-path (:completion . company))
(funcall fn (cons group module) :flags (if (listp m) (cdr m)) :path (doom-module-locate-path (cons group module)))
GNU Emacs v29.4 nil
Doom core v3.0.0-pre grafted, HEAD -> master, origin/master, origin/HEAD 311ad23f 2025-01-13 12:36:05 -0500
Doom modules v25.02.0-pre grafted, HEAD -> master, origin/master, origin/HEAD 311ad23f 2025-01-13 12:36:05 -0500

### Steps to reproduce

1. write the script
2. add a function named `mine/org-agenda-export-to-ics` in your config.el
3. try to execute the script

### System Information

https://pastebin.com/z9bpf5Sd

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.