Only in /var/lib/copr-rpmbuild/results/ripgrep-edit/upstream-unpacked/Source0/ripgrep-edit-0.3.10: .distro diff -U2 -r /var/lib/copr-rpmbuild/results/ripgrep-edit/upstream-unpacked/Source0/ripgrep-edit-0.3.10/emacs/rg-edit.el /var/lib/copr-rpmbuild/results/ripgrep-edit/srpm-unpacked/ripgrep-edit-0.3.10.tar.gz-extract/ripgrep-edit-0.3.10/emacs/rg-edit.el --- /var/lib/copr-rpmbuild/results/ripgrep-edit/upstream-unpacked/Source0/ripgrep-edit-0.3.10/emacs/rg-edit.el 2026-03-26 14:18:32.000000000 +0000 +++ /var/lib/copr-rpmbuild/results/ripgrep-edit/srpm-unpacked/ripgrep-edit-0.3.10.tar.gz-extract/ripgrep-edit-0.3.10/emacs/rg-edit.el 2026-04-23 13:39:02.000000000 +0000 @@ -45,4 +45,10 @@ :group 'rg-edit) +(defcustom rg-edit-prefill-extra-args "--multiline --multiline-dotall --smart-case" + "Prefill the rg-edit commands extra-args parameter with this value. +These extra arguments are used only if the extra-args parameter is otherwise nil." + :type 'string + :group 'rg-edit) + (defvar rg-edit--history-regexp nil "History for rg-edit regexp patterns.") (defvar rg-edit--history-extra-args nil "History for rg-edit extra-args.") @@ -57,5 +63,7 @@ (defun rg-edit--collect-extra-args (extra-args) "Collect extra arguments for rg-edit command." - (let ((extra-args (read-string "Extra args: " extra-args 'rg-edit--history-extra-args))) + (let ((extra-args (read-string "Extra args: " + (or extra-args rg-edit-prefill-extra-args) + 'rg-edit--history-extra-args))) (unless (string-empty-p extra-args) extra-args))) @@ -87,11 +95,17 @@ "Run rg-edit with REGEXP, PATH, and EXTRA-ARGS." (let* ((path-dir (directory-file-name path)) + (default-directory (file-name-directory path-dir)) (dir-name (file-name-nondirectory path-dir)) - (rg-buffer (get-buffer-create "*rg-edit*" t))) + (rg-buffer (get-buffer-create "*rg-edit*" t)) + (gbnf (when (and (fboundp 'gptel--model-capable-p) + (gptel--model-capable-p 'gbnf)) + "--gbnf")) + (extra-args (concat gbnf + (when (and gbnf extra-args) " ") + extra-args))) (save-some-buffers nil (lambda () (string-prefix-p (file-truename dir-name) (file-truename (buffer-file-name))))) (rg-edit--setup-buffer rg-buffer) - (cd (file-name-directory path-dir)) (apply #'start-process "rg-edit" rg-buffer @@ -101,10 +115,6 @@ "--dump-on-error" "--output-size-limit=100m" - (if (and (fboundp 'gptel--model-capable-p) - (gptel--model-capable-p 'gbnf)) - "--gbnf" "") (shell-quote-argument dir-name) - (when extra-args - (split-string-shell-command extra-args))))) + (split-string-shell-command extra-args)))) (defun rg-edit--get-path (path buffer-file)