I have to live with a build system that moves pieces of source around before running make. I have a function that pipes output of make through a sed to remap file references back to the source tree.

(defun mybuild ()
  "Run mybuild"
  (compile "mybuild | sed -e 's/path-x/path-y/' -e ..."))

My problem is that the sed expression is getting too long and it does not look elegant.

Are there any nice solutions to this problem, e.g. set compilation-filter function that will have one sed/regexp expression per line?

Also, I do not want to have a global change in compilation filter for all invocations of compile command.

I suspect that the solution could be as simple defining sed command as a multi line string and then use in compile command expression.

  • sed has a -f switch that allows you to put all that in a file (and if you are lucky, never have to look at it again - ever :-) )
    – NickD
    Sep 15 at 15:32

Found a solution: use concat to build sed string

(defun mksed ()
   "sed -e 's/path-x/path-y'"
   " -e 's/path-a/path-b'")))

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.