Fork me on GitHub
#emacs
<
2023-03-07
>
practicalli-johnny01:03:55

Any recommendations for linting / formatting of Emacs lisp (`*.el*`) files? The main focus will be to check Emacs configuration files, some of which may contain function definitions, etc. Bonus points if there GitHub Actions that providing lint / format checks so I can include a GitHub workflow to check changes as they are published. Thank you.

ericdallo12:03:07

I configured https://github.com/emacs-lsp/lsp-mode/blob/master/.github/workflows/lint.yml some years ago and I find it very complete, it has checks for lint, compilation, package-lint and even a smart indentation check, not sure there is a better way to do that yet

ericdallo16:03:41

yeah, eask was created one year ago and it really works well compared with Cask which used to be really flaky

teodorlu13:03:30

Good afternoon! Using Emacs Lisp, how would you escape a string so that it can be used in a shell command? I'm calling a CLI that looks something like this: ./cli --title MY_TITLE Currently, my code breaks when MY_TITLE contains ". The following works (using https://github.com/magnars/s.el), but i (A) wonder if some form of shell-escape function is provided in Emacs, and (B), I'm not sure whether there are weird corner cases I haven't thought about. Thanks!

(require 's)
(message 
 (s-replace-all '(("\"" . "\\\""))
                "string with \"quotations\" in it"))
;; I see
;;
;;   "string with \\\"quotations\\\" in it"
;;
;; in the *Messages* buffer.

teodorlu13:03:45

Update: s-replace-all seems to be working fine -- I haven't found any problems yet.

xificurC13:03:38

unless you require to run it in a shell you're better off using a more structured API like call-process, which takes the arguments as positional args, not a single string

👍 2
teodorlu14:03:28

Agreed -- that would avoid the problem!

dakra14:03:00

There's also shell-quote-argument that quotes according to your shell (posix/windows/etc)

💯 2
teodorlu15:03:38

Nice, that's what I was looking for. Thanks! 💯