Function: hypb:eval

hypb:eval is a byte-compiled function defined in hypb.el.

Signature

(hypb:eval SEXP &rest REST)

Documentation

Apply SEXP to REST of arguments and maintain the current buffer.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hypb.el
(defun hypb:eval (sexp &rest rest)
  "Apply SEXP to REST of arguments and maintain the current buffer."
  (let ((buf (current-buffer))
	(cmd (cond ((symbolp sexp)
		    sexp)
		   ((listp sexp)
		    (if (eq 'quote (car sexp))
			;; Unquote the expression so it is evaluated
			(cadr sexp)
		      sexp)))))
    (setq last-command this-command
	  this-command (if (and (listp cmd) (symbolp (car cmd)))
			   (car cmd)
			 cmd))
    (run-hooks 'pre-command-hook)
    (unwind-protect
	(command-execute
	 (lambda () (interactive)
	   (if rest
	       (apply cmd rest)
	     (eval cmd t))))
      ;; Ensure point remains in the same buffer before and after SEXP
      ;; evaluation.  This prevents false switching to the *ert* test
      ;; buffer when debugging.
      (set-buffer buf)
      ;; Comment this out as it triggered an error in CI/CD
      ;; (when (memq this-command (list 'self-insert-command
      ;;                                     (key-binding [remap self-insert-command])))
      ;;        (run-hooks 'post-self-insert-hook))
      (run-hooks 'post-command-hook))))