Function: completion-locate-entry

completion-locate-entry is a byte-compiled function defined in completion.el.gz.

Signature

(completion-locate-entry COMPLETION-ENTRY PREFIX-ENTRY)

Documentation

Locate the completion entry.

Returns a pointer to the element before the completion entry or nil if the completion entry is at the head. Must be called after find-exact-completion.

Aliases

locate-completion-entry (obsolete since 27.1)

Source Code

;; Defined in /usr/src/emacs/lisp/completion.el.gz
(defun completion-locate-entry (completion-entry prefix-entry)
  "Locate the completion entry.
Returns a pointer to the element before the completion entry or nil if
the completion entry is at the head.
Must be called after `find-exact-completion'."
  (let ((prefix-list (cmpl-prefix-entry-head prefix-entry))
	 next-prefix-list)
    (cond
      ((not (eq (car prefix-list) completion-entry))
       ;; not already at head
       (while (and prefix-list
		   (not (eq completion-entry
			    (car (setq next-prefix-list (cdr prefix-list))))))
	 (setq prefix-list next-prefix-list))
       (cond (;; found
	      prefix-list)
	     ;; Didn't find it.  Database is messed up.
	     (cmpl-db-debug-p
	      ;; not found, error if debug mode
	      (error "Completion entry exists but not on prefix list - %s"
		     cmpl--completion-string))
	     (inside-locate-completion-entry
	      ;; recursive error: really scrod
	      (completion-locate-db-error))
	     (t
	       ;; Patch out
	       (set cmpl-db-symbol nil)
	       ;; Retry
	       (completion-locate-entry-retry completion-entry)))))))