Are 'function-name
and (function function-name)
completely equivalent, or are there conditions under which I must use the more verbose (function function-name)
?
(apply 'message ( list "call func via quote"))
(apply (function message) (list "call func via function keyword"))
Both of them yield the same effect. But in many elisp libraries, i am seeing people using (function func)
to pass function symbols like in this example.
(defun dired-add-file (filename &optional marker-char)
(dired-fun-in-all-buffers
(file-name-directory filename) (file-name-nondirectory filename)
(function dired-add-entry) filename marker-char))
Why do people use more verbose way, when they can use just a quote?
#'
(akafunction
) and'
: endlessparentheses.com/…. Basically, asC-h f function
says: "In byte compilation,function
causes its argument to be compiled.quote
can not do that. IMHO, just use#'
rather than'
.