Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the underscore(_) mean in elisp?

I'm reviewing neotree package code out of emacs packages. I don't know the meaning of the underscore(_) in the macro definition below.

(lambda (&rest _))

Full definition of the macro as follows.

(defmacro neotree-make-executor (&rest fn-form)
  "Make an open event handler, FN-FORM is event handler form."
  (let* ((get-args-fn
          (lambda (sym) (or (plist-get fn-form sym) (lambda (&rest _)))))
         (file-fn (funcall get-args-fn :file-fn))
         (dir-fn (funcall get-args-fn :dir-fn)))
    `(lambda (&optional arg)
       (interactive "P")
       (neo-global--select-window)
       (neo-buffer--execute arg ,file-fn ,dir-fn))))
like image 624
cloudrain21 Avatar asked Aug 07 '15 05:08

cloudrain21


1 Answers

Refer to elisp reference manual

11.9.4 Using Lexical Binding ...

lexical-binding [Variable]
    If this buffer-local variable is non-nil, Emacs Lisp files and buffers are evaluated
    using lexical binding instead of dynamic binding. (However, special variables are still
    dynamically bound; see below.) If nil, dynamic binding is used for all local variables.
    This variable is typically set for a whole Emacs Lisp file, as a file local variable (see
    Section 11.11 [File Local Variables], page 163). Note that unlike other such variables,
    this one must be set in the first line of a file.

...

(To silence byte-compiler warnings about unused variables, just use a variable name that
start with an underscore. The byte-compiler interprets this as an indication that this is a
variable known not to be used.)
like image 190
cloudrain21 Avatar answered Sep 29 '22 09:09

cloudrain21