[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: project--completing-read-strict breaks ada-mode project completion t

From: Stephen Leake
Subject: Re: project--completing-read-strict breaks ada-mode project completion table
Date: Thu, 17 Jan 2019 15:17:40 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (windows-nt)

Stephen Leake <address@hidden> writes:

> These are now in the ELPA master branch:
> elpa/packages/ada-mode/ada-project.el
> elpa/packages/ada-mode/env-package.el
> elpa/packages/path-iterator/path-iterator.el
> elpa/packages/uniquify-files/uniquify-files.el

Attached is an example project for emacs source to play with. To use it,
eval the following in emacs master *scratch* (adjust paths);

(add-to-list 'load-path "c:/Projects/elpa/packages/uniquify-files")
(add-to-list 'load-path "c:/Projects/elpa/packages/path-iterator")
(load-file "c:/Projects/emacs_stephe.main/projects/emacs-project.el")

;; revert to emacs-26 version of project--completing-read-strict
;; (skip this to show the problem with the master version)
(defun project--completing-read-strict (prompt
                                        collection &optional predicate
                                        hist default inherit-input-method)
  ;; Tried both expanding the default before showing the prompt, and
  ;; removing it when it has no matches.  Neither seems natural
  ;; enough.  Removal is confusing; early expansion makes the prompt
  ;; too long.
  (let* ((new-prompt (if default
                         (format "%s (default %s): " prompt default)
                       (format "%s: " prompt)))
         (res (completing-read new-prompt
                               collection predicate t
                               nil hist default inherit-input-method)))
    (if (and (equal res default)
             (not (test-completion res collection predicate)))
        (completing-read (format "%s: " prompt)
                         collection predicate t res hist nil

(find-file "c:/Projects/emacs/master/lisp/files.el")

Then type "M-x project-find-file", followed by "proje" <tab> <tab>.

Or use icomplete-mode, use C-. , C-, to rotate completions.

There's a bug in path-iterator; I've set :ignore-function to ignore any
dir under ".git", but they are showing up anyway. But that demonstrates
how non-unique file names are handled, so it's good for this demo.

-- Stephe

Attachment: emacs-project.el
Description: application/emacs-lisp

reply via email to

[Prev in Thread] Current Thread [Next in Thread]