Function: cape--elisp-symbol-exit

cape--elisp-symbol-exit is a byte-compiled function defined in cape.el.

Signature

(cape--elisp-symbol-exit SYM STATUS)

Documentation

Wrap symbol SYM with cape-elisp-symbol-wrapper buffers.

STATUS is the exit status.

Source Code

;; Defined in ~/.emacs.d/elpa/cape-20260804.2303/cape.el
(defun cape--elisp-symbol-exit (sym status)
  "Wrap symbol SYM with `cape-elisp-symbol-wrapper' buffers.
STATUS is the exit status."
  (when-let* (((not (eq status 'exact)))
              (c (cl-loop for (m . c) in cape-elisp-symbol-wrapper
                          if (derived-mode-p m) return c))
              ((or (not (derived-mode-p 'emacs-lisp-mode))
                   ;; Inside comment or string
                   (let ((s (syntax-ppss))) (or (nth 3 s) (nth 4 s)))))
              (x (if (stringp (car c)) (car c) (string (car c))))
              (y (if (stringp (cadr c)) (cadr c) (string (cadr c)))))
    (save-excursion
      (backward-char (length sym))
      (unless (save-excursion
                (and (ignore-errors (or (backward-char (length x)) t))
                     (looking-at-p (regexp-quote x))))
        (insert x)))
    (unless (looking-at-p (regexp-quote y))
      (insert y))))