0

In this example, the system-configuration-options is a string:

"--prefix=/Users/HOME/.0.data/.0.emacs/.0.x11 --with-x --with-ns=no --enable-checking=yes,glyphs --enable-check-lisp-object-type --without-compress-install 'CFLAGS=-O0 -g3' CPPFLAGS=-I/Users/HOME/.0.data/.0.emacs/.0.macports/include LDFLAGS=-L/Users/HOME/.0.data/.0.emacs/.0.macports/lib"

Inasmuch as the order of the configuration options may change, I would like to come up with a fancier test than the layman's approach (i.e, me) using split-string and comparing each element one-by-one with member using mapc. [Some cl-... magic, for example, would be nifty.]

MY CUSTOM LIST:

'("--prefix=/Users/HOME/.0.data/.0.emacs/.0.x11"
  "--with-x"
  "--with-ns=no"
  "--enable-checking=yes,glyphs"
  "--enable-check-lisp-object-type"
  "--without-compress-install"
  "'CFLAGS=-O0 -g3'"
  "CPPFLAGS=-I/Users/HOME/.0.data/.0.emacs/.0.macports/include"
  "LDFLAGS=-L/Users/HOME/.0.data/.0.emacs/.0.macports/lib")

Q:  How to programmatically determine whether system-configuration-options contains ALL of the members of My Custom List?

  • Why not split these strings the way you suggested, sort lists, and then put them in two buffers and ediff-buffer? – wvxvw Jun 14 '18 at 5:55
  • @wvxvw -- Thank you for taking a look at this thread. I was thinking that there is probably some cl-...-thing-a-majig combination that can do this in a few lines of code. I haven't used ediff-buffer, but would be pleased to research that possibility with a cup of coffee in the morning ... – lawlist Jun 14 '18 at 6:53
1

Do mind that you may have to do some extra work since the '' got parsed out by the shell

(require 's)
(require 'dash)
(let* ((my-list '("--prefix=/Users/HOME/.0.data/.0.emacs/.0.x11"
                  "--with-x"
                  "--with-ns=no"
                  "--enable-checking=yes,glyphs"
                  "--enable-check-lisp-object-type"
                  "--without-compress-install"
                  "'CFLAGS=-O0 -g3'"
                  "CPPFLAGS=-I/Users/HOME/.0.data/.0.emacs/.0.macports/include"
                  "LDFLAGS=-L/Users/HOME/.0.data/.0.emacs/.0.macports/lib"))
       (_s "--prefix=/Users/HOME/.0.data/.0.emacs/.0.x11 --with-x --with-ns=no --enable-checking=yes,glyphs --enable-check-lisp-object-type --without-compress-install 'CFLAGS=-O0 -g3' CPPFLA↩
GS=-I/Users/HOME/.0.data/.0.emacs/.0.macports/include LDFLAGS=-L/Users/HOME/.0.data/.0.emacs/.0.macports/lib")
       (separator "\n")
       (shell-separated (shell-command-to-string (format "printf '%%s%s' %s"
                                                    separator
                                                    _s)))
       (as-list (s-split separator shell-separated t))
       (diff (-difference as-list my-list)))
  diff
  )
;; prints ("CFLAGS=-O0 -g3")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.