Function: pop
pop is a macro defined in subr.el.gz.
Signature
(pop PLACE)
Documentation
Return the first element of PLACE's value, and remove it from the list.
PLACE must be a generalized variable whose value is a list.
If the value is nil, pop returns nil but does not actually
change the list.
Other relevant functions are documented in the list group.
Probably introduced at or before Emacs version 19.23.
Shortdoc
;; list
(pop list)
-> [it depends]
Source Code
;; Defined in /usr/src/emacs/lisp/subr.el.gz
(defmacro pop (place)
"Return the first element of PLACE's value, and remove it from the list.
PLACE must be a generalized variable whose value is a list.
If the value is nil, `pop' returns nil but does not actually
change the list."
(declare (debug (gv-place)))
;; We use `car-safe' here instead of `car' because the behavior is the same
;; (if it's not a cons cell, the `cdr' would have signaled an error already),
;; but `car-safe' is total, so the byte-compiler can safely remove it if the
;; result is not used.
`(car-safe
,(if (symbolp place)
;; So we can use `pop' in the bootstrap before `gv' can be used.
(list 'prog1 place (list 'setq place (list 'cdr place)))
(gv-letplace (getter setter) place
(macroexp-let2 macroexp-copyable-p x getter
`(prog1 ,x ,(funcall setter `(cdr ,x))))))))