Function: prolog-find-value-by-system

prolog-find-value-by-system is a byte-compiled function defined in prolog.el.gz.

Signature

(prolog-find-value-by-system ALIST)

Documentation

Get value from ALIST according to prolog-system.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/prolog.el.gz
;; Because this can `eval' its arguments, any variable that gets
;; processed by it should be marked as :risky.
(defun prolog-find-value-by-system (alist)
  "Get value from ALIST according to `prolog-system'."
  (let ((system (or prolog-system
                    (let ((infbuf (prolog-inferior-buffer 'dont-run)))
                      (when infbuf
                        (buffer-local-value 'prolog-system infbuf))))))
    (if (listp alist)
        (let (result
              id)
          (while alist
            (setq id (car (car alist)))
            (if (or (eq id system)
                    (eq id t)
                    (and (listp id)
                         (eval id)))
                (progn
                  (setq result (car (cdr (car alist))))
                  (if (and (listp result)
                           (eq (car result) 'eval))
                      (setq result (eval (car (cdr result)))))
                  (setq alist nil))
              (setq alist (cdr alist))))
          result)
      alist)))