Skip to content

Commit 862fe95

Browse files
committed
Add eca-open-global-config
1 parent 796a593 commit 862fe95

File tree

2 files changed

+16
-19
lines changed

2 files changed

+16
-19
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,12 @@ M-x package-install eca
5151

5252
- `eca-chat-add-context-at-point`: Add the current function or selected lines to chat as context.
5353
- `eca-chat-add-file-context`: Add the current file to chat as context.
54-
- `eca-keep-all-suggested-changes`: Accept planned edit changes on file.
55-
- `eca-discard-all-suggested-changes`: Reject planned edit changes on file.
54+
- `eca-chat-tool-call-accept-all`: Acceppt all pending tool calls in chat.
55+
- `eca-chat-tool-call-accept-next`: Acceppt next pending tool call in chat.
56+
- `eca-chat-tool-call-reject-next`: Reject next pending tool call in chat.
5657
- `eca-chat-send-prompt`: In case you wanna send prompts programatically in elisp.
5758
- `eca-chat-toggle-window`: toggle chat window.
59+
- `eca-open-global-config`: Open ECA global config file.
5860

5961
### Variables
6062

eca.el

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -225,24 +225,19 @@ When ARG is current prefix, ask for workspace roots to use."
225225
(eca-info "Workspaces: %s" (eca--session-workspace-folders (eca-session))))
226226

227227
;;;###autoload
228-
(defun eca-keep-all-suggested-changes ()
229-
"Keep all of the ECA file change suggestion."
228+
(defun eca-open-global-config ()
229+
"Open global ECA config file.
230+
If the file does not exist, create the directory if needed and open a new
231+
buffer visiting that path with `{}` pre-filled."
230232
(interactive)
231-
(save-excursion
232-
(goto-char (point-min))
233-
(ignore-errors (funcall #'smerge-keep-lower))
234-
(while (ignore-errors (not (smerge-next)))
235-
(funcall #'smerge-keep-lower))))
236-
237-
;;;###autoload
238-
(defun eca-discard-all-suggested-changes ()
239-
"Discard all of the ECA file change suggestion."
240-
(interactive)
241-
(save-excursion
242-
(goto-char (point-min))
243-
(ignore-errors (funcall #'smerge-keep-upper))
244-
(while (ignore-errors (not (smerge-next)))
245-
(funcall #'smerge-keep-upper))))
233+
(let* ((file (if-let (xdg (getenv "XDG_CONFIG_HOME"))
234+
(f-join xdg "eca" "config.json")
235+
(f-join (f-expand "~") ".config" "eca" "config.json")))
236+
(dir (file-name-directory file)))
237+
(make-directory dir t)
238+
(find-file file)
239+
(when (= (buffer-size) 0)
240+
(insert "{}\n"))))
246241

247242
(provide 'eca)
248243
;;; eca.el ends here

0 commit comments

Comments
 (0)