[Top][All Lists]

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

How to quote a list of functions?

From: Marcin Borkowski
Subject: How to quote a list of functions?
Date: Sun, 09 Aug 2015 01:42:10 +0200

Hi all,

It is well known that functions should be quoted with sharp-quote and
not just regular quote, i.e., #'my-function and not 'my-function.  (See,
for instance.)  Does that mean that I should quote a /list/ of functions
with it, too?  So: #'(some-function some-other-function), for example?
(A list of functions makes sense in customizing certain behaviors, like
hooks or filter lists in Org.)

An even more complicated situation: in my use case, the list of function
is a format for displaying something.  (The "something" has a bunch of
fields/properties, and I want the user to be able to customize which
fields, in what order and what format should be displayed.  So, for
example, I'll have a function like

(defun format-field-one (record width)
  (format (format "%%%ds" width) (cdr (assoc 'field-one record))))

I want to be able to include in my custom "format" things like

(format-field-one 4)

which would make it so that the function format-field-one will be called
with arguments "record" and "4" (for subseqeuent records).  Like this:

(mapcar (lambda (record)
          (mapcar (lambda (field-specifier)
                    (apply (car field-specifier)
                           (cdr field-specifier)))

(Hopefully I didn't mess up the above - I'll test it soon anyway, but
you get the idea.)

So, should I define custom-format like

(setq custom-format #'((format-field-one 4) ...))

or just

(setq custom-format '((format-field-one 4) ...))?


Marcin Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University

reply via email to

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