From 7fc4b4cc3a50e55b280f2665965b3b477ca45a7a Mon Sep 17 00:00:00 2001 From: "Michael W. Olson" Date: Fri, 22 Feb 2008 10:57:39 -0600 Subject: [PATCH] Delete duplicates before calling muse-completing-read-function. --- ChangeLog | 8 ++++++++ lisp/muse-project.el | 10 ++++++---- lisp/muse.el | 13 +++++++++++++ 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 93e31d2..07fe090 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-02-22 Michael Olson + + * lisp/muse-project.el (muse-read-project-file): Delete duplicates + before calling muse-completing-read-function, since + ido-completing-read does not do this. + + * lisp/muse.el (muse-delete-dups): New compatibility function. + 2008-02-19 Michael Olson * lisp/muse-html.el (muse-html-src-allowed-modes): New option that diff --git a/lisp/muse-project.el b/lisp/muse-project.el index 5603aa4..6987a2b 100644 --- a/lisp/muse-project.el +++ b/lisp/muse-project.el @@ -603,10 +603,12 @@ If PATHNAME is nil, the current buffer's filename is used." (defvar muse-project-page-history nil) (defun muse-read-project-file (project prompt &optional default) - (let ((name (funcall muse-completing-read-function - prompt (muse-project-file-alist project) - nil nil nil 'muse-project-page-history - default))) + (let* ((file-list (muse-delete-dups + (mapcar #'(lambda (a) (list (car a))) + (muse-project-file-alist project)))) + (name (funcall muse-completing-read-function + prompt file-list nil nil nil + 'muse-project-page-history default))) (cons name (muse-project-page-file name project)))) ;;;###autoload diff --git a/lisp/muse.el b/lisp/muse.el index 2a6da6e..c9f29d1 100644 --- a/lisp/muse.el +++ b/lisp/muse.el @@ -585,6 +585,19 @@ on the system \"/user@host:\"." (prog1 (buffer-substring start end) (delete-region start end)))) +(if (fboundp 'delete-dups) + (defalias 'muse-delete-dups 'delete-dups) + (defun muse-delete-dups (list) + "Destructively remove `equal' duplicates from LIST. +Store the result in LIST and return it. LIST must be a proper list. +Of several `equal' occurrences of an element in LIST, the first +one is kept." + (let ((tail list)) + (while tail + (setcdr tail (delete (car tail) (cdr tail))) + (setq tail (cdr tail)))) + list)) + ;; Set face globally in a predictable fashion (defun muse-copy-face (old new) "Copy face OLD to NEW." -- 2.11.4.GIT