help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ask for the value of several variables at once


From: Emanuel Berg
Subject: Re: ask for the value of several variables at once
Date: Sun, 18 Mar 2018 13:14:00 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

John Mastro wrote:

> I think what you really want for vars-status is:
>
> (defmacro vars-status (&rest sym-list)
>   `(apply #'syms-status ',sym-list))

Right, that did it! Now there is no
error message.

(BTW I was wrong about `cl-lib' not being
needed to be required for `cl-loop', it does.)

Here is the final (?) version. See, macros
aren't that difficult! It only takes half
a dozen of people to solve a problem one would
think would be right up the macro alley...

(defun syms-status (&rest sym-list)
  (mapcar (lambda (s) (list s (symbol-value s))) sym-list))

(defmacro vars-status (&rest sym-list)
  `(apply #'syms-status ',sym-list))

(require 'cl-lib)
(require 'subr-x)
(defun all-systems-ready ()
  (interactive)
  (let ((report (vars-status message-yank-cited-prefix message-yank-prefix))
        (output ""))
    (cl-loop
     for (var val) in report do
     (setq output (concat output (format "[%s] %s " val var))) )
    (message (string-trim output)) ))
;; (all-systems-ready)

-- 
underground experts united
http://user.it.uu.se/~embe8573


reply via email to

[Prev in Thread] Current Thread [Next in Thread]