comparison lisp/comint.el @ 10830:a774e92de39c

Let file-name-handler-alist to nil in comint-dynamic-complete-as-filename and comint-dynamic-list-filename-completions.
author Simon Marshall <simon@gnu.org>
date Sat, 25 Feb 1995 15:22:57 +0000
parents 77753c063e8c
children 77d7d3990300
comparison
equal deleted inserted replaced
10829:135ef978d711 10830:a774e92de39c
1864 completions listing is dependent on the value of `comint-completion-autolist'. 1864 completions listing is dependent on the value of `comint-completion-autolist'.
1865 1865
1866 Returns t if successful." 1866 Returns t if successful."
1867 (interactive) 1867 (interactive)
1868 (if (comint-match-partial-filename) 1868 (if (comint-match-partial-filename)
1869 (prog2 (or (eq (selected-window) (minibuffer-window)) 1869 (prog2 (or (window-minibuffer-p (selected-window))
1870 (message "Completing file name...")) 1870 (message "Completing file name..."))
1871 (comint-dynamic-complete-as-filename)))) 1871 (comint-dynamic-complete-as-filename))))
1872 1872
1873 1873
1874 (defun comint-dynamic-complete-as-filename () 1874 (defun comint-dynamic-complete-as-filename ()
1875 "Dynamically complete at point as a filename. 1875 "Dynamically complete at point as a filename.
1876 See `comint-dynamic-complete-filename'. Returns t if successful." 1876 See `comint-dynamic-complete-filename'. Returns t if successful."
1877 (let* ((completion-ignore-case nil) 1877 (let* ((completion-ignore-case nil)
1878 (completion-ignored-extensions comint-completion-fignore) 1878 (completion-ignored-extensions comint-completion-fignore)
1879 (file-name-handler-alist nil)
1880 (minibuffer-p (window-minibuffer-p (selected-window)))
1879 (success t) 1881 (success t)
1880 (filename (or (comint-match-partial-filename) "")) 1882 (filename (or (comint-match-partial-filename) ""))
1881 (pathdir (file-name-directory filename)) 1883 (pathdir (file-name-directory filename))
1882 (pathnondir (file-name-nondirectory filename)) 1884 (pathnondir (file-name-nondirectory filename))
1883 (directory (if pathdir (comint-directory pathdir) default-directory)) 1885 (directory (if pathdir (comint-directory pathdir) default-directory))
1884 (completion (file-name-completion pathnondir directory)) 1886 (completion (file-name-completion pathnondir directory)))
1885 (mini-flag (eq (selected-window) (minibuffer-window))))
1886 (cond ((null completion) 1887 (cond ((null completion)
1887 (message "No completions of %s" filename) 1888 (message "No completions of %s" filename)
1888 (setq success nil)) 1889 (setq success nil))
1889 ((eq completion t) ; Means already completed "file". 1890 ((eq completion t) ; Means already completed "file".
1890 (if comint-completion-addsuffix (insert " ")) 1891 (if comint-completion-addsuffix (insert " "))
1891 (or mini-flag (message "Sole completion"))) 1892 (or minibuffer-p (message "Sole completion")))
1892 ((string-equal completion "") ; Means completion on "directory/". 1893 ((string-equal completion "") ; Means completion on "directory/".
1893 (comint-dynamic-list-filename-completions)) 1894 (comint-dynamic-list-filename-completions))
1894 (t ; Completion string returned. 1895 (t ; Completion string returned.
1895 (let ((file (concat (file-name-as-directory directory) completion))) 1896 (let ((file (concat (file-name-as-directory directory) completion)))
1896 (insert (substring (directory-file-name completion) 1897 (insert (substring (directory-file-name completion)
1897 (length pathnondir))) 1898 (length pathnondir)))
1898 (cond ((symbolp (file-name-completion completion directory)) 1899 (cond ((symbolp (file-name-completion completion directory))
1899 ;; We inserted a unique completion. 1900 ;; We inserted a unique completion.
1900 (if comint-completion-addsuffix 1901 (if comint-completion-addsuffix
1901 (insert (if (file-directory-p file) "/" " "))) 1902 (insert (if (file-directory-p file) "/" " ")))
1902 (or mini-flag (message "Completed"))) 1903 (or minibuffer-p (message "Completed")))
1903 ((and comint-completion-recexact comint-completion-addsuffix 1904 ((and comint-completion-recexact comint-completion-addsuffix
1904 (string-equal pathnondir completion) 1905 (string-equal pathnondir completion)
1905 (file-exists-p file)) 1906 (file-exists-p file))
1906 ;; It's not unique, but user wants shortest match. 1907 ;; It's not unique, but user wants shortest match.
1907 (insert (if (file-directory-p file) "/" " ")) 1908 (insert (if (file-directory-p file) "/" " "))
1908 (or mini-flag (message "Completed shortest"))) 1909 (or minibuffer-p (message "Completed shortest")))
1909 ((or comint-completion-autolist 1910 ((or comint-completion-autolist
1910 (string-equal pathnondir completion)) 1911 (string-equal pathnondir completion))
1911 ;; It's not unique, list possible completions. 1912 ;; It's not unique, list possible completions.
1912 (comint-dynamic-list-filename-completions)) 1913 (comint-dynamic-list-filename-completions))
1913 (t 1914 (t
1914 (or mini-flag (message "Partially completed"))))))) 1915 (or minibuffer-p (message "Partially completed")))))))
1915 success)) 1916 success))
1916 1917
1917 1918
1918 (defun comint-replace-by-expanded-filename () 1919 (defun comint-replace-by-expanded-filename ()
1919 "Dynamically expand and complete the filename at point. 1920 "Dynamically expand and complete the filename at point.
1978 1979
1979 (defun comint-dynamic-list-filename-completions () 1980 (defun comint-dynamic-list-filename-completions ()
1980 "List in help buffer possible completions of the filename at point." 1981 "List in help buffer possible completions of the filename at point."
1981 (interactive) 1982 (interactive)
1982 (let* ((completion-ignore-case nil) 1983 (let* ((completion-ignore-case nil)
1984 (file-name-handler-alist nil)
1983 (filename (or (comint-match-partial-filename) "")) 1985 (filename (or (comint-match-partial-filename) ""))
1984 (pathdir (file-name-directory filename)) 1986 (pathdir (file-name-directory filename))
1985 (pathnondir (file-name-nondirectory filename)) 1987 (pathnondir (file-name-nondirectory filename))
1986 (directory (if pathdir (comint-directory pathdir) default-directory)) 1988 (directory (if pathdir (comint-directory pathdir) default-directory))
1987 (completions (file-name-all-completions pathnondir directory))) 1989 (completions (file-name-all-completions pathnondir directory)))