(function function-name) completely equivalent, or are there conditions under which I must use the more verbose
(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?
': endlessparentheses.com/…. Basically, as
C-h f functionsays: "In byte compilation,
functioncauses its argument to be compiled.
quotecan not do that. IMHO, just use