Mercurial > hg > xemacs-beta
diff lisp/efs/default-dir.el @ 114:8619ce7e4c50 r20-1b9
Import from CVS: tag r20-1b9
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:21:54 +0200 |
parents | 4be1180a9e89 |
children | 9f59509498e1 |
line wrap: on
line diff
--- a/lisp/efs/default-dir.el Mon Aug 13 09:20:50 2007 +0200 +++ b/lisp/efs/default-dir.el Mon Aug 13 09:21:54 2007 +0200 @@ -3,7 +3,7 @@ ;; ;; File: default-dir.el ;; RCS: -;; Version: $Revision: 1.3 $ +;; Version: $Revision: 1.4 $ ;; Description: Defines the function default-directory, for fancy handling ;; of the initial contents in the minibuffer when reading ;; file names. @@ -58,86 +58,156 @@ ;;; Overloads -(if (or (featurep 'mule) - (boundp 'MULE)) - (progn +(cond + ((or (featurep 'mule) + (boundp 'MULE)) - (defun default-dir-find-file (file &optional coding-system) - "Documented as original" - (interactive - (list - (expand-file-name - (read-file-name "Find file: " (default-directory))) - (and current-prefix-arg - (read-coding-system "Coding-system: ")))) - (default-dir-real-find-file file coding-system)) + (defun default-dir-find-file (file &optional coding-system) + "Documented as original" + (interactive + (list + (expand-file-name + (read-file-name "Find file: " (default-directory))) + (and current-prefix-arg + (read-coding-system "Coding-system: ")))) + (default-dir-real-find-file file coding-system)) + + (defun default-dir-find-file-other-window (file &optional coding-system) + "Documented as original" + (interactive + (list + (expand-file-name + (read-file-name "Find file in other window: " (default-directory))) + (and current-prefix-arg + (read-coding-system "Coding-system: ")))) + (default-dir-real-find-file-other-window file coding-system)) - (defun default-dir-find-file-other-window (file &optional coding-system) - "Documented as original" - (interactive - (list - (expand-file-name - (read-file-name "Find file in other window: " (default-directory))) - (and current-prefix-arg - (read-coding-system "Coding-system: ")))) - (default-dir-real-find-file-other-window file coding-system)) + (defun default-dir-find-file-read-only (file &optional coding-system) + "Documented as original" + (interactive + (list + (expand-file-name + (read-file-name "Find file read-only: " (default-directory) nil t)) + (and current-prefix-arg + (read-coding-system "Coding-system: ")))) + (default-dir-real-find-file-read-only file coding-system)) - (defun default-dir-find-file-read-only (file &optional coding-system) - "Documented as original" - (interactive - (list - (expand-file-name - (read-file-name "Find file read-only: " (default-directory) nil t)) - (and current-prefix-arg - (read-coding-system "Coding-system: ")))) - (default-dir-real-find-file-read-only file coding-system)) + (if (fboundp 'find-file-read-only-other-window) + (progn + (defun default-dir-find-file-read-only-other-window + (file &optional coding-system) + "Documented as original" + (interactive + (list + (expand-file-name + (read-file-name + "Find file read-only in other window: " + (default-directory) nil t)) + (and current-prefix-arg + (read-coding-system "Coding-system: ")))) + (default-dir-real-find-file-read-only-other-window file + coding-system)))) + + (if (fboundp 'find-file-other-frame) + (progn + (defun default-dir-find-file-other-frame + (file &optional coding-system) + "Documented as original" + (interactive + (list + (expand-file-name + (read-file-name "Find file in other frame: " + (default-directory))) + (and current-prefix-arg + (read-coding-system "Coding-system: ")))) + (default-dir-real-find-file-other-frame file + coding-system)))) - (if (fboundp 'find-file-read-only-other-window) - (progn - (defun default-dir-find-file-read-only-other-window - (file &optional coding-system) - "Documented as original" - (interactive - (list - (expand-file-name - (read-file-name - "Find file read-only in other window: " - (default-directory) nil t)) - (and current-prefix-arg - (read-coding-system "Coding-system: ")))) - (default-dir-real-find-file-read-only-other-window file - coding-system)))) + (if (fboundp 'find-file-read-only-other-frame) + (progn + (defun default-dir-find-file-read-only-other-frame + (file &optional coding-system) + "Documented as original" + (interactive + (list + (expand-file-name + (read-file-name "Find file read-only in other frame: " + (default-directory) nil t)) + (and current-prefix-arg + (read-coding-system "Coding-system: ")))) + (default-dir-real-find-file-read-only-other-frame file + coding-system))))) + + (default-dir-find-file-takes-coding-system + ;; This lossage is due to the fact that XEmacs 20.x without mule + ;; still accepts an optional argument for find-file related + ;; functions. Things like advice.el insist on passing nil for + ;; optional arguments, and the interaction screws things up. + ;; Therefore these functions accept an optional dummy coding-system + ;; argument. + + (defun default-dir-find-file (file &optional coding-system) + "Documented as original" + (interactive + (list + (expand-file-name + (read-file-name "Find file: " (default-directory))))) + (default-dir-real-find-file file coding-system)) + + (defun default-dir-find-file-other-window (file &optional coding-system) + "Documented as original" + (interactive + (list + (expand-file-name + (read-file-name "Find file in other window: " (default-directory))))) + (default-dir-real-find-file-other-window file coding-system)) - (if (fboundp 'find-file-other-frame) - (progn - (defun default-dir-find-file-other-frame - (file &optional coding-system) - "Documented as original" - (interactive - (list - (expand-file-name - (read-file-name "Find file in other frame: " - (default-directory))) - (and current-prefix-arg - (read-coding-system "Coding-system: ")))) - (default-dir-real-find-file-other-frame file - coding-system)))) + (defun default-dir-find-file-read-only (file &optional coding-system) + "Documented as original" + (interactive + (list + (expand-file-name + (read-file-name "Find file read-only: " (default-directory) nil t)))) + (default-dir-real-find-file-read-only file coding-system)) - (if (fboundp 'find-file-read-only-other-frame) - (progn - (defun default-dir-find-file-read-only-other-frame - (file &optional coding-system) - "Documented as original" - (interactive - (list - (expand-file-name - (read-file-name "Find file read-only in other frame: " - (default-directory) nil t)) - (and current-prefix-arg - (read-coding-system "Coding-system: ")))) - (default-dir-real-find-file-read-only-other-frame file - coding-system))))) + (if (fboundp 'find-file-read-only-other-window) + (progn + (defun default-dir-find-file-read-only-other-window + (file &optional coding-system) + "Documented as original" + (interactive + (list + (expand-file-name + (read-file-name + "Find file read-only in other window: " + (default-directory) nil t)))) + (default-dir-real-find-file-read-only-other-window file)))) + (if (fboundp 'find-file-other-frame) + (progn + (defun default-dir-find-file-other-frame + (file &optional coding-system) + "Documented as original" + (interactive + (list + (expand-file-name + (read-file-name "Find file in other frame: " + (default-directory))))) + (default-dir-real-find-file-other-frame file)))) + + (if (fboundp 'find-file-read-only-other-frame) + (progn + (defun default-dir-find-file-read-only-other-frame + (file &optional coding-system) + "Documented as original" + (interactive + (list + (expand-file-name + (read-file-name "Find file read-only in other frame: " + (default-directory) nil t)))) + (default-dir-real-find-file-read-only-other-frame file))))) + + (t (defun default-dir-find-file (file) "Documented as original" (interactive @@ -194,7 +264,9 @@ (expand-file-name (read-file-name "Find file read-only in other frame: " (default-directory) nil t)))) - (default-dir-real-find-file-read-only-other-frame file))))) + (default-dir-real-find-file-read-only-other-frame file)))))) + + (efs-overwrite-fn "default-dir" 'find-file 'default-dir-find-file) (efs-overwrite-fn "default-dir" 'find-file-other-window @@ -282,23 +354,15 @@ (efs-overwrite-fn "default-dir" 'shell-command 'default-dir-shell-command) -;; Is advice about? -(if (featurep 'advice) - (defadvice cd (before default-dir-cd activate compile) - (interactive - (list - (expand-file-name - (read-file-name "Change default directory: " (default-directory)))))) +(defun default-dir-cd (dir) + "Documented as original" + (interactive + (list + (expand-file-name + (read-file-name "Change default directory: " (default-directory))))) + (default-dir-real-cd dir)) - (defun default-dir-cd (dir) - "Documented as original" - (interactive - (list - (expand-file-name - (read-file-name "Change default directory: " (default-directory))))) - (default-dir-real-cd dir)) - - (efs-overwrite-fn "default-dir" 'cd 'default-dir-cd)) +(efs-overwrite-fn "default-dir" 'cd 'default-dir-cd) (defun default-dir-set-visited-file-name (filename) "Documented as original"