• Mike Appleby's avatar
    slime-c-p-c: correctly insert the chosen completion candidate · dd5bc7ab
    Mike Appleby authored
    Correctly insert the user's chosen completion candidate when
    completing a prefix with slime-complete-symbol*.
    
    For example, if the user types "cl:f-o" and then calls
    slime-complete-symbol*, the *Completions* buffer will pop up and
    display a list of possible completions. If the user then selects
    "cl:force-output" from the *Completions* list, the resulting completed
    symbol in the original buffer should be "cl:force-output". Prior to
    this change, the resulting completion would be either
    "cl:fcl:force-output-o" or "cl:f-ocl:force-output", depending on the
    value of slime-c-p-c-unambiguous-prefix-p.
    
    The fix entails setting the variable completion-base-position to a
    list of (START END) markers indicating the portion of the target
    buffer that should be replaced by choose-completion.
    
    Prior to this change, completion-base-position was incorrectly set to
    a single number, similar to what would have been expected by the
    now-obsolete completion-base-size. This ultimately resulted in
    completion-base-position being ignored in choose-completion-string:
    
      ;; Some older code may call us passing `base-size' instead of
      ;; `base-position'.  It's difficult to make any use of `base-size',
      ;; so we just ignore it.
      (unless (consp base-position)
        (message "Obsolete `base-size' passed to choose-completion-string")
        (setq base-position nil))
    
    Note that completion-base-position was added (and completion-base-size
    made obsolete) in emacs 23.2. Thus, completion-base-position is
    ignored on emacs 23.1, but this was already the case prior to this
    change. For emacs 23.1, if completion-base-size is unset, then
    choose-completion-string will attempt to guess the region to replace
    by calling choose-completion-delete-max-match.
    dd5bc7ab