A macro to do what you want
As an exercise of a sort:
(defmacro setq-every (value &rest vars)
"Set every variable from VARS to value VALUE."
`(progn ,@(mapcar (lambda (x) (list 'setq x value)) vars)))
Now try it:
(setq-every "/foo/bar" f-loc1 f-loc2)
How does it work
Since people are curious how it works (according to comments), here is
an explanation. To really learn how to write macros pick a good Common Lisp
book (yes, Common Lisp, you will be able to do the same stuff in Emacs Lisp,
but Common Lisp is a bit more powerful and has better books, IMHO).
Macros operate on raw code. Macros don't evaluate their arguments (unlike
functions). So we have here unevaluated value and collection of vars,
which for our macro are just symbols.
progn groups several setq forms into one. This thing:
(mapcar (lambda (x) (list 'setq x value)) vars)
Just generates a list of setq forms, using OP's example it will be:
((setq f-loc1 "/foo/bar") (setq f-loc2 "/foo/bar"))
You see, the form is inside of backquote form and is prefixed with a comma
,. Inside backquoted form everything is quoted as usually, but ,
“turns-on” evaluation temporarily, so entire mapcar is evaluated at
macroexpansion time.
Finally @ removes outer parenthesis from list with setqs, so we get:
(progn
(setq f-loc1 "/foo/bar")
(setq f-loc2 "/foo/bar"))
Macros can arbitrary transform your source code, isn't it great?
A caveat
Here is a small caveat, first argument will be evaluated several times,
because this macro essentially expands to the following:
(progn
(setq f-loc1 "/foo/bar")
(setq f-loc2 "/foo/bar"))
You see, if you have a variable or string here it's OK, but if you write
something like this:
(setq-every (my-function-with-side-effects) f-loc1 f-loc2)
Then your function will be called more than once. This may be
undesirable. Here is how to fix it with help of once-only (available in
MMT package):
(defmacro setq-every (value &rest vars)
"Set every variable from VARS to value VALUE.
VALUE is only evaluated once."
(mmt-once-only (value)
`(progn ,@(mapcar (lambda (x) (list 'setq x value)) vars))))
And the problem is gone.