Function: calc-pop

calc-pop is an interactive and byte-compiled function defined in calc.el.gz.

Signature

(calc-pop N)

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc.el.gz
(defun calc-pop (n)
  (interactive "P")
  (let ((num (if calc-context-sensitive-enter (max 1 (calc-locate-cursor-element (point))))))
    (calc-wrapper
     (let* ((nn (prefix-numeric-value n))
            (top (and (null n) (calc-top 1))))
       (cond ((and calc-context-sensitive-enter (> num 1))
              (calc-pop-stack nn num))
             ((and (null n)
                   (eq (car-safe top) 'incomplete)
                   (> (length top) (if (eq (nth 1 top) 'intv) 3 2)))
              (calc-pop-push-list 1 (list (butlast top))))
             ((< nn 0)
              (if (and calc-any-selections
                       (calc-top-selected 1 (- nn)))
                  (calc-delete-selection (- nn))
                (calc-pop-stack 1 (- nn) t)))
             ((= nn 0)
              (calc-pop-stack (calc-stack-size) 1 t))
             (t
              (if (and calc-any-selections
                       (= nn 1)
                       (calc-top-selected 1 1))
                  (calc-delete-selection 1)
                (calc-pop-stack nn))))))
    (if calc-context-sensitive-enter (calc-cursor-stack-index (1- num)))))