changeset 108594:a5969c855306

Don't override standard definition of convert-standard-filename. Add obsolete aliases for dos-fns.el functions. files.el (convert-standard-filename): Call w32-convert-standard-filename and dos-convert-standard-filename on the corresponding systems. w32-fns.el (w32-convert-standard-filename): Rename from convert-standard-filename. Doc fix. dos-fns.el (dos-convert-standard-filename): Doc fix. (convert-standard-filename): Don't defalias. (register-name-alist, make-register, register-value) (set-register-value, intdos): Obsolete aliases for the corresponding dos-* functions and variables. (dos-intdos): Add a doc string.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 15 May 2010 11:31:40 +0300
parents 5daf8821df70
children a9dc4c72f652
files lisp/ChangeLog lisp/dos-fns.el lisp/files.el lisp/w32-fns.el
diffstat 4 files changed, 66 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sat May 15 10:51:52 2010 +0300
+++ b/lisp/ChangeLog	Sat May 15 11:31:40 2010 +0300
@@ -1,3 +1,20 @@
+2010-05-15  Eli Zaretskii  <eliz@gnu.org>
+
+	Don't override standard definition of convert-standard-filename.
+	* files.el (convert-standard-filename): Call
+	w32-convert-standard-filename and dos-convert-standard-filename on
+	the corresponding systems.
+
+	* w32-fns.el (w32-convert-standard-filename): Rename from
+	convert-standard-filename.  Doc fix.
+
+	* dos-fns.el (dos-convert-standard-filename): Doc fix.
+	(convert-standard-filename): Don't defalias.
+	(register-name-alist, make-register, register-value)
+	(set-register-value, intdos): Obsolete aliases for the
+	corresponding dos-* functions and variables.
+	(dos-intdos): Add a doc string.
+
 2010-05-15  Jay Belanger  <jay.p.belanger@gmail.com>
 
 	* calc/calc-aent.el (math-read-token, math-find-user-tokens):
--- a/lisp/dos-fns.el	Sat May 15 10:51:52 2010 +0300
+++ b/lisp/dos-fns.el	Sat May 15 11:31:40 2010 +0300
@@ -30,16 +30,16 @@
 (declare-function int86 "dosfns.c")
 (declare-function msdos-long-file-names "msdos.c")
 
-;; This overrides a trivial definition in files.el.
+;; See convert-standard-filename in files.el.
 (defun dos-convert-standard-filename (filename)
-  "Convert a standard file's name to something suitable for the current OS.
+  "Convert a standard file's name to something suitable for MS-DOS.
 This means to guarantee valid names and perhaps to canonicalize
 certain patterns.
 
+This function is called by `convert-standard-filename'.
+
 On Windows and DOS, replace invalid characters.  On DOS, make
-sure to obey the 8.3 limitations.  On Windows, turn Cygwin names
-into native names, and also turn slashes into backslashes if the
-shell requires it (see `w32-shell-dos-semantics')."
+sure to obey the 8.3 limitations."
   (if (or (not (stringp filename))
 	  ;; This catches the case where FILENAME is "x:" or "x:/" or
 	  ;; "/", thus preventing infinite recursion.
@@ -128,11 +128,6 @@
 		    (dos-convert-standard-filename dir))
 		  string))))))
 
-;; Only redirect convert-standard-filename if it has a chance of working,
-;; otherwise loading dos-fns.el might make your non-DOS Emacs misbehave.
-(when (fboundp 'msdos-long-file-names)
-  (defalias 'convert-standard-filename 'dos-convert-standard-filename))
-
 (defun dos-8+3-filename (filename)
   "Truncate FILENAME to DOS 8+3 limits."
   (if (or (not (stringp filename))
@@ -243,9 +238,14 @@
     (al . (0 . 0)) (bl . (1 . 0)) (cl . (2 . 0)) (dl . (3 . 0))
     (ah . (0 . 1)) (bh . (1 . 1)) (ch . (2 . 1)) (dh . (3 . 1))))
 
+(define-obsolete-variable-alias
+  'register-name-alist 'dos-register-name-alist "24.1")
+
 (defun dos-make-register ()
   (make-vector 8 0))
 
+(define-obsolete-function-alias 'make-register 'dos-make-register "24.1")
+
 (defun dos-register-value (regs name)
   (let ((where (cdr (assoc name dos-register-name-alist))))
     (cond ((consp where)
@@ -257,6 +257,8 @@
 	   (aref regs where))
 	  (t nil))))
 
+(define-obsolete-function-alias 'register-value 'dos-register-value "24.1")
+
 (defun dos-set-register-value (regs name value)
   (and (numberp value)
        (>= value 0)
@@ -273,9 +275,18 @@
 		(aset regs where (logand value 65535))))))
   regs)
 
+(define-obsolete-function-alias
+  'set-register-value 'dos-set-register-value "24.1")
+
 (defsubst dos-intdos (regs)
+  "Issue the DOS Int 21h with registers REGS.
+
+REGS should be a vector produced by `dos-make-register'
+and `dos-set-register-value', which see."
   (int86 33 regs))
 
+(define-obsolete-function-alias 'intdos 'dos-intdos "24.1")
+
 ;; Backward compatibility for obsolescent functions which
 ;; set screen size.
 
@@ -284,6 +295,8 @@
   (interactive)
   (set-frame-size (selected-frame) 80 25))
 
+(define-obsolete-function-alias 'mode25 'dos-mode25 "24.1")
+
 (defun dos-mode4350 ()
   "Changes the number of rows to 43 or 50.
 Emacs always tries to set the screen height to 50 rows first.
@@ -295,6 +308,8 @@
       nil  ; the original built-in function returned nil
     (set-frame-size (selected-frame) 80 43)))
 
+(define-obsolete-function-alias 'mode4350 'dos-mode4350 "24.1")
+
 (provide 'dos-fns)
 
 ;; arch-tag: 00b03579-8ebb-4a02-8762-5c5a929774ad
--- a/lisp/files.el	Sat May 15 10:51:52 2010 +0300
+++ b/lisp/files.el	Sat May 15 11:31:40 2010 +0300
@@ -574,6 +574,9 @@
 	  (inhibit-file-name-operation op))
       (apply op args))))
 
+(declare-function dos-convert-standard-filename "dos-fns.el" (filename))
+(declare-function w32-convert-standard-filename "w32-fns.el" (filename))
+
 (defun convert-standard-filename (filename)
   "Convert a standard file's name to something suitable for the OS.
 This means to guarantee valid names and perhaps to canonicalize
@@ -591,15 +594,20 @@
 `w32-shell-dos-semantics').
 
 See Info node `(elisp)Standard File Names' for more details."
-  (if (eq system-type 'cygwin)
-      (let ((name (copy-sequence filename))
-	    (start 0))
-	;; Replace invalid filename characters with !
-	(while (string-match "[?*:<>|\"\000-\037]" name start)
-	       (aset name (match-beginning 0) ?!)
-	  (setq start (match-end 0)))
-	name)
-    filename))
+  (cond
+   ((eq system-type 'cygwin)
+    (let ((name (copy-sequence filename))
+	  (start 0))
+      ;; Replace invalid filename characters with !
+      (while (string-match "[?*:<>|\"\000-\037]" name start)
+	(aset name (match-beginning 0) ?!)
+	(setq start (match-end 0)))
+      name))
+   ((eq system-type 'windows-nt)
+    (w32-convert-standard-filename filename))
+   ((eq system-type 'ms-dos)
+    (dos-convert-standard-filename filename))
+   (t filename)))
 
 (defun read-directory-name (prompt &optional dir default-dirname mustmatch initial)
   "Read directory name, prompting with PROMPT and completing in directory DIR.
--- a/lisp/w32-fns.el	Sat May 15 10:51:52 2010 +0300
+++ b/lisp/w32-fns.el	Sat May 15 11:31:40 2010 +0300
@@ -253,15 +253,16 @@
 ;;	    (setq source-directory (file-name-as-directory
 ;;				     (expand-file-name ".." exec-directory)))))
 
-(defun convert-standard-filename (filename)
-  "Convert a standard file's name to something suitable for the current OS.
+(defun w32-convert-standard-filename (filename)
+  "Convert a standard file's name to something suitable for the MS-Windows.
 This means to guarantee valid names and perhaps to canonicalize
 certain patterns.
 
-On Windows and DOS, replace invalid characters.  On DOS, make
-sure to obey the 8.3 limitations.  On Windows, turn Cygwin names
-into native names, and also turn slashes into backslashes if the
-shell requires it (see `w32-shell-dos-semantics')."
+This function is called by `convert-standard-filename'.
+
+Replace invalid characters and turn Cygwin names into native
+names, and also turn slashes into backslashes if the shell
+requires it (see `w32-shell-dos-semantics')."
   (save-match-data
     (let ((name
 	   (if (string-match "\\`/cygdrive/\\([a-zA-Z]\\)/" filename)