IdoOpen - abingham/prosjekt GitHub Wiki

This bit of lisp code allows you to use the prosjekt.lst file to efficiently load existing projects by using a completing read on the project names and then passing the cfg file path onto the actual prosjekt-open function.

(eval-after-load "ido"
  '(progn
     (defun* prosjekt-completing-read (&rest args)
       (if (and (boundp 'ido-mode) ido-mode)
           (apply 'ido-completing-read args)
         (apply 'completing-read args)))

     (defun my-prosjekt-open (proj-path)
       (interactive
        (list
         (let* ((cfg (prosjekt-cfg-load))
                (projects (prosjekt-cfg-project-list cfg))
                (proj-name (prosjekt-completing-read "Open project: "
                                                     (mapcar 'car projects)))
                (proj-dir (cdr (assoc proj-name projects))))
           (path-concat proj-dir "/prosjekt.cfg"))))
       (prosjekt-open proj-path))))