[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, 25 Nov 2003 17:10:22 -0500 |
Index: emacs/lisp/ido.el
diff -c emacs/lisp/ido.el:1.32 emacs/lisp/ido.el:1.33
*** emacs/lisp/ido.el:1.32 Mon Sep 1 11:45:13 2003
--- emacs/lisp/ido.el Tue Nov 25 17:10:21 2003
***************
*** 553,558 ****
--- 553,572 ----
:group 'ido)
+ (defcustom ido-use-filename-at-point nil
+ "*Non-nil means that ido shall look for a filename at point.
+ If found, use that as the starting point for filename selection."
+ :type 'boolean
+ :group 'ido)
+
+
+ (defcustom ido-use-url-at-point nil
+ "*Non-nil means that ido shall look for a URL at point.
+ If found, call `find-file-at-point' to visit it."
+ :type 'boolean
+ :group 'ido)
+
+
(defcustom ido-enable-tramp-completion t
"*Non-nil means that ido shall perform tramp method and server name
completion.
A tramp file name uses the following syntax: /method:address@hidden:filename."
***************
*** 954,961 ****
;; Value is a list (ido-text dir cur-list ignored-list matches).
(defvar ido-pre-merge-state)
! ;; Original value of vc-master-templates for use in ido-toggle-vc.
! (defvar ido-saved-vc-mt)
;; Stores temporary state of literal find file.
(defvar ido-find-literal)
--- 968,975 ----
;; Value is a list (ido-text dir cur-list ignored-list matches).
(defvar ido-pre-merge-state)
! ;; Original value of vc-handled-backends for use in ido-toggle-vc.
! (defvar ido-saved-vc-hb)
;; Stores temporary state of literal find file.
(defvar ido-find-literal)
***************
*** 1372,1377 ****
--- 1386,1398 ----
(fix-it (concat dir "/"))
(t nil)))
+ (defun ido-no-final-slash (s)
+ ;; Remove optional final slash from string S
+ (let ((l (1- (length s))))
+ (if (and (> l 0) (eq (aref s l) ?/))
+ (substring s 0 l)
+ s)))
+
(defun ido-set-current-directory (dir &optional subdir no-merge)
;; Set ido's current directory to DIR or DIR/SUBDIR
(setq dir (ido-final-slash dir t))
***************
*** 1408,1414 ****
(floor (* (frame-width) ido-max-file-prompt-width))
ido-max-file-prompt-width))
(literal (and (boundp 'ido-find-literal) ido-find-literal "(literal)
"))
! (vc-off (and ido-saved-vc-mt (not vc-master-templates) "[-VC] "))
(prefix nil)
(rule ido-rewrite-file-prompt-rules))
(let ((case-fold-search nil))
--- 1429,1435 ----
(floor (* (frame-width) ido-max-file-prompt-width))
ido-max-file-prompt-width))
(literal (and (boundp 'ido-find-literal) ido-find-literal "(literal)
"))
! (vc-off (and ido-saved-vc-hb (not vc-handled-backends) "[-VC] "))
(prefix nil)
(rule ido-rewrite-file-prompt-rules))
(let ((case-fold-search nil))
***************
*** 1832,1853 ****
(defun ido-file-internal (method &optional fallback default prompt item
initial)
;; Internal function for ido-find-file and friends
(let ((ido-current-directory (expand-file-name (or default
default-directory)))
filename)
! (if (or (not ido-mode) (ido-is-slow-ftp-host))
! (setq filename t
! ido-exit 'fallback))
! (let (ido-saved-vc-mt
! (vc-master-templates (and (boundp 'vc-master-templates)
vc-master-templates))
(ido-work-directory-index -1)
(ido-work-file-index -1)
(ido-find-literal nil))
(unless filename
! (setq ido-saved-vc-mt vc-master-templates)
! (setq filename (ido-read-internal (or item 'file)
(or prompt "Find file: ")
'ido-file-history nil nil initial)))
--- 1853,1898 ----
(defun ido-file-internal (method &optional fallback default prompt item
initial)
;; Internal function for ido-find-file and friends
+ (unless item
+ (setq item 'file))
(let ((ido-current-directory (expand-file-name (or default
default-directory)))
filename)
! (cond
! ((or (not ido-mode) (ido-is-slow-ftp-host))
! (setq filename t
! ido-exit 'fallback))
!
! ((and (eq item 'file)
! (or ido-use-url-at-point ido-use-filename-at-point))
! (let (fn d)
! (require 'ffap)
! ;; Duplicate code from ffap-guesser as we want different behaviour for
files and URLs.
! (cond
! ((and ido-use-url-at-point
! ffap-url-regexp
! (ffap-fixup-url (or (ffap-url-at-point)
! (ffap-gopher-at-point))))
! (setq ido-exit 'ffap
! filename t))
!
! ((and ido-use-filename-at-point
! (setq fn (ffap-string-at-point))
! (not (string-match "^http:/" fn))
! (setq d (file-name-directory fn))
! (file-directory-p d))
! (setq ido-current-directory d)
! (setq initial (file-name-nondirectory fn)))))))
! (let (ido-saved-vc-hb
! (vc-handled-backends (and (boundp 'vc-handled-backends)
vc-handled-backends))
(ido-work-directory-index -1)
(ido-work-file-index -1)
(ido-find-literal nil))
(unless filename
! (setq ido-saved-vc-hb vc-handled-backends)
! (setq filename (ido-read-internal item
(or prompt "Find file: ")
'ido-file-history nil nil initial)))
***************
*** 1868,1873 ****
--- 1913,1921 ----
((eq ido-exit 'dired)
(dired (concat ido-current-directory (or ido-text ""))))
+ ((eq ido-exit 'ffap)
+ (find-file-at-point))
+
((eq method 'alt-file)
(ido-record-work-file filename)
(setq default-directory ido-current-directory)
***************
*** 2087,2094 ****
(interactive)
(if (and ido-mode (eq ido-cur-item 'file))
(progn
! (setq vc-master-templates
! (if vc-master-templates nil ido-saved-vc-mt))
(setq ido-text-init ido-text)
(setq ido-exit 'keep)
(exit-minibuffer))))
--- 2135,2142 ----
(interactive)
(if (and ido-mode (eq ido-cur-item 'file))
(progn
! (setq vc-handled-backends
! (if vc-handled-backends nil ido-saved-vc-hb))
(setq ido-text-init ido-text)
(setq ido-exit 'keep)
(exit-minibuffer))))
***************
*** 2477,2483 ****
(defun ido-sort-list (items)
;; Simple list of file or buffer names
! (sort items (lambda (a b) (string-lessp a b))))
(defun ido-sort-merged-list (items promote)
;; Input is list of ("file" . "dir") cons cells.
--- 2525,2532 ----
(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.
***************
*** 3723,3730 ****
((and (not (memq this-command ido-read-file-name-non-ido))
(or (null predicate) (eq predicate 'file-exists-p)))
(let (filename
! ido-saved-vc-mt
! (vc-master-templates (and (boundp 'vc-master-templates)
vc-master-templates))
(ido-current-directory (expand-file-name (or dir default-directory)))
(ido-work-directory-index -1)
(ido-work-file-index -1)
--- 3772,3779 ----
((and (not (memq this-command ido-read-file-name-non-ido))
(or (null predicate) (eq predicate 'file-exists-p)))
(let (filename
! ido-saved-vc-hb
! (vc-handled-backends (and (boundp 'vc-handled-backends)
vc-handled-backends))
(ido-current-directory (expand-file-name (or dir default-directory)))
(ido-work-directory-index -1)
(ido-work-file-index -1)
***************
*** 3742,3748 ****
"Read directory name, prompting with PROMPT and completing in directory DIR.
See `read-file-name' for additional parameters."
(let (filename
! ido-saved-vc-mt
(ido-current-directory (expand-file-name (or dir default-directory)))
(ido-work-directory-index -1)
(ido-work-file-index -1))
--- 3791,3797 ----
"Read directory name, prompting with PROMPT and completing in directory DIR.
See `read-file-name' for additional parameters."
(let (filename
! ido-saved-vc-hb
(ido-current-directory (expand-file-name (or dir default-directory)))
(ido-work-directory-index -1)
(ido-work-file-index -1))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] Changes to emacs/lisp/ido.el,
Kim F. Storm <=