[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/ido.el
From: |
Kim F . Storm |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/ido.el |
Date: |
Tue, 08 Feb 2005 18:51:31 -0500 |
Index: emacs/lisp/ido.el
diff -c emacs/lisp/ido.el:1.45 emacs/lisp/ido.el:1.46
*** emacs/lisp/ido.el:1.45 Tue Nov 23 15:18:16 2004
--- emacs/lisp/ido.el Tue Feb 8 23:51:31 2005
***************
*** 410,415 ****
--- 410,424 ----
:type 'boolean
:group 'ido)
+ (defcustom ido-file-extensions-order nil
+ "*List of file extensions specifying preferred order of file selections.
+ Each element is either a string with `.' as the first char, an empty
+ string matching files without extension, or t which is the default order
+ of for files with an unlisted file extension."
+ :type '(repeat (choice string
+ (const :tag "Default order" t)))
+ :group 'ido)
+
(defcustom ido-ignore-directories
'("\\`CVS/" "\\`\\.\\./" "\\`\\./")
"*List of regexps or functions matching sub-directory names to ignore."
***************
*** 2629,2638 ****
(t nil))))
! (defun ido-sort-list (items)
! ;; Simple list of file or buffer names
! (sort items (lambda (a b) (string-lessp (ido-no-final-slash a)
! (ido-no-final-slash b)))))
(defun ido-sort-merged-list (items promote)
;; Input is list of ("file" . "dir") cons cells.
--- 2638,2706 ----
(t nil))))
! ;; File list sorting
!
! (defun ido-file-lessp (a b)
! ;; Simple compare two file names.
! (string-lessp (ido-no-final-slash a) (ido-no-final-slash b)))
!
!
! (defun ido-file-extension-lessp (a b)
! ;; Compare file names according to ido-file-extensions-order list.
! (let ((n (compare-strings a 0 nil b 0 nil nil))
! lessp p)
! (if (eq n t)
! nil
! (if (< n 0)
! (setq n (1- (- n))
! p a a b b p
! lessp t)
! (setq n (1- n)))
! (cond
! ((= n 0)
! lessp)
! ((= (aref a n) ?.)
! (ido-file-extension-aux a b n lessp))
! (t
! (while (and (> n 2) (/= (aref a n) ?.))
! (setq n (1- n)))
! (if (> n 1)
! (ido-file-extension-aux a b n lessp)
! lessp))))))
!
! (defun ido-file-extension-aux (a b n lessp)
! (let ((oa (ido-file-extension-order a n))
! (ob (ido-file-extension-order b n)))
! (cond
! ((= oa ob)
! lessp)
! ((and oa ob)
! (if lessp
! (> oa ob)
! (< oa ob)))
! (oa
! (not lessp))
! (ob
! lessp)
! (t
! lessp))))
!
! (defun ido-file-extension-order (s n)
! (let ((l ido-file-extensions-order)
! (i 0) o do)
! (while l
! (cond
! ((eq (car l) t)
! (setq do i
! l (cdr l)))
! ((eq (compare-strings s n nil (car l) 0 nil nil) t)
! (setq o i
! l nil))
! (t
! (setq l (cdr l))))
! (setq i (1+ i)))
! (or o do)))
!
(defun ido-sort-merged-list (items promote)
;; Input is list of ("file" . "dir") cons cells.
***************
*** 2905,2911 ****
;; created to allow the user to further modify the order of the file names
;; in this list.
(let ((ido-temp-list (ido-make-file-list1 ido-current-directory)))
! (setq ido-temp-list (ido-sort-list ido-temp-list))
(let ((default-directory ido-current-directory))
(ido-to-end ;; move ftp hosts and visited files to end
(delq nil (mapcar
--- 2973,2982 ----
;; created to allow the user to further modify the order of the file names
;; in this list.
(let ((ido-temp-list (ido-make-file-list1 ido-current-directory)))
! (setq ido-temp-list (sort ido-temp-list
! (if ido-file-extensions-order
! #'ido-file-extension-lessp
! #'ido-file-lessp)))
(let ((default-directory ido-current-directory))
(ido-to-end ;; move ftp hosts and visited files to end
(delq nil (mapcar
***************
*** 2954,2960 ****
;; created to allow the user to further modify the order of the
;; directory names in this list.
(let ((ido-temp-list (ido-make-dir-list1 ido-current-directory)))
! (setq ido-temp-list (ido-sort-list ido-temp-list))
(ido-to-end ;; move . files to end
(delq nil (mapcar
(lambda (x) (if (string-equal (substring x 0 1) ".") x))
--- 3025,3031 ----
;; created to allow the user to further modify the order of the
;; directory names in this list.
(let ((ido-temp-list (ido-make-dir-list1 ido-current-directory)))
! (setq ido-temp-list (sort ido-temp-list #'ido-file-lessp))
(ido-to-end ;; move . files to end
(delq nil (mapcar
(lambda (x) (if (string-equal (substring x 0 1) ".") x))
***************
*** 3184,3197 ****
(setq display-it t))
(if display-it
(with-output-to-temp-buffer ido-completion-buffer
! (let ((completion-list (ido-sort-list
(cond
(ido-use-merged-list
(ido-flatten-merged-list (or ido-matches
ido-cur-list)))
((or full-list
ido-completion-buffer-all-completions)
(ido-all-completions))
(t
! (copy-sequence (or ido-matches
ido-cur-list)))))))
(if (featurep 'xemacs)
;; XEmacs extents are put on by default, doesn't seem to be
;; any way of switching them off.
--- 3255,3269 ----
(setq display-it t))
(if display-it
(with-output-to-temp-buffer ido-completion-buffer
! (let ((completion-list (sort
(cond
(ido-use-merged-list
(ido-flatten-merged-list (or ido-matches
ido-cur-list)))
((or full-list
ido-completion-buffer-all-completions)
(ido-all-completions))
(t
! (copy-sequence (or ido-matches
ido-cur-list))))
! #'ido-file-lessp)))
(if (featurep 'xemacs)
;; XEmacs extents are put on by default, doesn't seem to be
;; any way of switching them off.
- [Emacs-diffs] Changes to emacs/lisp/ido.el,
Kim F . Storm <=