Re: Contributing xc.el to ELPA

Stefan Monnier <[email protected]>
Newsgroups gmane.emacs.devel
Message-ID <[email protected]>
> Hi there! I'm the author of xc.el [1], a package for executing tasks
> documented in project README files. For more background, see my blog
> post. [2]
>
> I'm interested to contribute the package to ELPA. I read the "Contributing
> to ELPA" guide and believe I can meet the conditions. Can you send me the
> necessary form to assign copyright, and check my codebase (~200 lines of
> code in all) for any issues I should address?

For the copyright side, please fill the form below and send it as
instructed to the FSF so they can send you the relevant paperwork
to sign.

As for comments on your code, see the untested attached patch whose most
important change is to avoid the use of a shell (and associated need to
quote arguments).


=== Stefan


Please email the following information to [email protected], and we
will send you the assignment form for your past and future changes.

Please use your full legal name (in ASCII characters) as the subject
line of the message.
----------------------------------------------------------------------
REQUEST: SEND FORM FOR PAST AND FUTURE CHANGES

[What is the name of the program or package you're contributing to?]
Emacs

[Did you copy any files or text written by someone else in these changes?
Even if that material is free software, we need to know about it.]


[Do you have an employer who might have a basis to claim to own
your changes?  Do you attend a school which might make such a claim?]


[For the copyright registration, what country are you a citizen of?]


[What year were you born?]


[Please write your email address here.]


[Please write your postal address here.]

[Which files have you changed so far, and which new files have you written
so far?]

[Additional people we should notify about the progress of the assignment.]
Stefan Monnier <[email protected]>
xc.patch (text/x-diff, 3.5 KB)
diff --git a/xc-treemacs.el b/xc-treemacs.el
index 7430d1c3577..a83de317276 100644
--- a/xc-treemacs.el
+++ b/xc-treemacs.el
@@ -37,7 +37,7 @@
 
 ;;; Code:
 
-(require 'treemacs-treelib)
+(require 'treemacs-treelib)  ;FIXME: Compile failure if not installed!
 (require 'xc)
 
 (defun xc-treemacs-RET-task-action (&optional _)
diff --git a/xc.el b/xc.el
index 03c8678d483..e037f901c6d 100644
--- a/xc.el
+++ b/xc.el
@@ -1,6 +1,7 @@
 ;;; xc.el --- Emacs interface for xc  -*- lexical-binding: t; -*-
 
-;; Copyright © 2026 Ryan Prior <[email protected]>
+;; Copyright © 2026  Free Software Foundation, Inc.
+
 ;; Author: Ryan Prior
 ;; URL: https://codeberg.org/ryanprior/xc.el
 ;; Package-Version: 20260713.1
@@ -44,27 +45,22 @@
   :group 'tools
   :link '(url-link :tag "Codeberg" "https://codeberg.org/ryanprior/xc.el"))
 
-(defcustom xc-executable nil
+(defcustom xc-executable "xc"
   "Use this executable to run xc.
-
-Either a string containing the name or the path of the executable, or
-nil to use the default `xc'."
-  :group 'xc
+A string containing the file name of the executable."
   :type 'string)
 
 (defcustom xc-type nil
   "Look for xc tasks in this type of documentation.
 
 Either `org' or `md', or nil for default."
-  :group 'xc
-  :type 'string)
+  :type 'string) ;; FIXME: nil is not a string.
 
 (defun xc--executable ()
   "Return non-nil when xc executable is found, or show a warning."
-  (if-let* ((name (or xc-executable "xc"))
-            (exec (executable-find name)))
+  (if-let* ((exec (executable-find xc-executable)))
       exec
-    (if (string-equal name "xc")
+    (if (string-equal xc-executable "xc")
         (display-warning 'xc "could not find `xc' on your PATH. Install it, adjust your PATH, or customize `xc-executable' to point to it.")
       (display-warning 'xc (format "no such file \"%s\" (from custom `xc-executable' value.)" xc-executable)))
     nil))
@@ -73,8 +69,7 @@ Either `org' or `md', or nil for default."
   "Run xc with provided ARGS; nil if it fails."
   (with-temp-buffer
     (when-let* ((xc (xc--executable))
-                (command (concat xc " " args))
-                (exit-code (call-process-shell-command command nil (current-buffer) t)))
+                (exit-code (call-process xc nil (current-buffer) t args)))
       (if (zerop exit-code)
           (buffer-string)
         nil))))
@@ -83,12 +78,10 @@ Either `org' or `md', or nil for default."
   "Get available tasks using xc.
 
 If FILE is provided, look for tasks in that file specifically."
-  (when-let* ((xc-output (thread-first
-                           "-short"
-                           (concat
-                            (and xc-type (concat " -type " xc-type))
-                            (and file (concat " -file " file)))
-                           xc--run)))
+  (when-let* ((xc-output (xc--run
+                          `("-short"
+                            ,@(and xc-type (list "-type" xc-type))
+                            ,@(and file (list "-file" file))))))
     (split-string xc-output)))
 
 ;;;###autoload
@@ -108,7 +101,9 @@ If FILE is provided, look for tasks in that file specifically."
     (let* ((output-buffer (concat "*xc-" task "*")))
       (thread-first (xc--executable)
                     (concat " " task
-                            (and xc-type (concat " -type " xc-type)))
+                            (and xc-type
+                                 (concat " -type "
+                                         (shell-quote-argument xc-type))))
                     (async-shell-command output-buffer))
       (pop-to-buffer output-buffer))))
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.