aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2010-05-12 20:35:07 -0400
committerStefan Monnier2010-05-12 20:35:07 -0400
commit5a70d10f7874061ffbfa2591990b1ceeca5aed96 (patch)
treec277ef6cb308ead76918d3fc0b0163d3d13f03cd
parent4c9d39abf9adf2f6d1542f5c42ece4d2e952c7cb (diff)
downloademacs-5a70d10f7874061ffbfa2591990b1ceeca5aed96.tar.gz
emacs-5a70d10f7874061ffbfa2591990b1ceeca5aed96.zip
* dos-fns.el: Add "dos-" prefix for namespace control.
(convert-standard-filename): Define as alias for dos-convert-standard-filename but only if applicable.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/dos-fns.el39
2 files changed, 28 insertions, 17 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 39001a369fa..45f1167412a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12010-05-13 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * dos-fns.el: Add "dos-" prefix for namespace control.
4 (convert-standard-filename): Define as alias for
5 dos-convert-standard-filename but only if applicable.
6
12010-05-12 Alan Mackenzie <acm@muc.de> 72010-05-12 Alan Mackenzie <acm@muc.de>
2 8
3 * progmodes/cc-cmds.el (c-beginning-of-defun, c-end-of-defun): 9 * progmodes/cc-cmds.el (c-beginning-of-defun, c-end-of-defun):
diff --git a/lisp/dos-fns.el b/lisp/dos-fns.el
index c1c2517bc22..5834afae8bc 100644
--- a/lisp/dos-fns.el
+++ b/lisp/dos-fns.el
@@ -31,7 +31,7 @@
31(declare-function msdos-long-file-names "msdos.c") 31(declare-function msdos-long-file-names "msdos.c")
32 32
33;; This overrides a trivial definition in files.el. 33;; This overrides a trivial definition in files.el.
34(defun convert-standard-filename (filename) 34(defun dos-convert-standard-filename (filename)
35 "Convert a standard file's name to something suitable for the current OS. 35 "Convert a standard file's name to something suitable for the current OS.
36This means to guarantee valid names and perhaps to canonicalize 36This means to guarantee valid names and perhaps to canonicalize
37certain patterns. 37certain patterns.
@@ -48,7 +48,7 @@ shell requires it (see `w32-shell-dos-semantics')."
48 (let ((flen (length filename))) 48 (let ((flen (length filename)))
49 ;; If FILENAME has a trailing slash, remove it and recurse. 49 ;; If FILENAME has a trailing slash, remove it and recurse.
50 (if (memq (aref filename (1- flen)) '(?/ ?\\)) 50 (if (memq (aref filename (1- flen)) '(?/ ?\\))
51 (concat (convert-standard-filename 51 (concat (dos-convert-standard-filename
52 (substring filename 0 (1- flen))) 52 (substring filename 0 (1- flen)))
53 "/") 53 "/")
54 (let* (;; ange-ftp gets in the way for names like "/foo:bar". 54 (let* (;; ange-ftp gets in the way for names like "/foo:bar".
@@ -122,12 +122,17 @@ shell requires it (see `w32-shell-dos-semantics')."
122 (aset string (1- (length string)) lastchar)))) 122 (aset string (1- (length string)) lastchar))))
123 (concat (if (and (stringp dir) 123 (concat (if (and (stringp dir)
124 (memq (aref dir dlen-m-1) '(?/ ?\\))) 124 (memq (aref dir dlen-m-1) '(?/ ?\\)))
125 (concat (convert-standard-filename 125 (concat (dos-convert-standard-filename
126 (substring dir 0 dlen-m-1)) 126 (substring dir 0 dlen-m-1))
127 "/") 127 "/")
128 (convert-standard-filename dir)) 128 (dos-convert-standard-filename dir))
129 string)))))) 129 string))))))
130 130
131;; Only redirect convert-standard-filename if it has a chance of working,
132;; otherwise loading dos-fns.el might make your non-DOS Emacs misbehave.
133(when (fboundp 'msdos-long-file-names)
134 (defalias 'convert-standard-filename 'dos-convert-standard-filename))
135
131(defun dos-8+3-filename (filename) 136(defun dos-8+3-filename (filename)
132 "Truncate FILENAME to DOS 8+3 limits." 137 "Truncate FILENAME to DOS 8+3 limits."
133 (if (or (not (stringp filename)) 138 (if (or (not (stringp filename))
@@ -188,12 +193,12 @@ shell requires it (see `w32-shell-dos-semantics')."
188 193
189;; This is for the sake of standard file names elsewhere in Emacs that 194;; This is for the sake of standard file names elsewhere in Emacs that
190;; are defined as constant strings or via defconst, and whose 195;; are defined as constant strings or via defconst, and whose
191;; conversion via `convert-standard-filename' does not give good 196;; conversion via `dos-convert-standard-filename' does not give good
192;; enough results. 197;; enough results.
193(defun dosified-file-name (file-name) 198(defun dosified-file-name (file-name)
194 "Return a variant of FILE-NAME that is valid on MS-DOS filesystems. 199 "Return a variant of FILE-NAME that is valid on MS-DOS filesystems.
195 200
196This function is for those rare cases where `convert-standard-filename' 201This function is for those rare cases where `dos-convert-standard-filename'
197does not do a job that is good enough, e.g. if you need to preserve the 202does not do a job that is good enough, e.g. if you need to preserve the
198file-name extension. It recognizes only certain specific file names 203file-name extension. It recognizes only certain specific file names
199that are used in Emacs Lisp sources; any other file name will be 204that are used in Emacs Lisp sources; any other file name will be
@@ -209,13 +214,13 @@ returned unaltered."
209(defvar msdos-shells) 214(defvar msdos-shells)
210 215
211;; Override settings chosen at startup. 216;; Override settings chosen at startup.
212(defun set-default-process-coding-system () 217(defun dos-set-default-process-coding-system ()
213 (setq default-process-coding-system 218 (setq default-process-coding-system
214 (if (default-value 'enable-multibyte-characters) 219 (if (default-value 'enable-multibyte-characters)
215 '(undecided-dos . undecided-dos) 220 '(undecided-dos . undecided-dos)
216 '(raw-text-dos . raw-text-dos)))) 221 '(raw-text-dos . raw-text-dos))))
217 222
218(add-hook 'before-init-hook 'set-default-process-coding-system) 223(add-hook 'before-init-hook 'dos-set-default-process-coding-system)
219 224
220;; File names defined in preloaded packages can be incorrect or 225;; File names defined in preloaded packages can be incorrect or
221;; invalid if long file names were available during dumping, but not 226;; invalid if long file names were available during dumping, but not
@@ -232,17 +237,17 @@ returned unaltered."
232 237
233(add-hook 'before-init-hook 'dos-reevaluate-defcustoms) 238(add-hook 'before-init-hook 'dos-reevaluate-defcustoms)
234 239
235(defvar register-name-alist 240(defvar dos-register-name-alist
236 '((ax . 0) (bx . 1) (cx . 2) (dx . 3) (si . 4) (di . 5) 241 '((ax . 0) (bx . 1) (cx . 2) (dx . 3) (si . 4) (di . 5)
237 (cflag . 6) (flags . 7) 242 (cflag . 6) (flags . 7)
238 (al . (0 . 0)) (bl . (1 . 0)) (cl . (2 . 0)) (dl . (3 . 0)) 243 (al . (0 . 0)) (bl . (1 . 0)) (cl . (2 . 0)) (dl . (3 . 0))
239 (ah . (0 . 1)) (bh . (1 . 1)) (ch . (2 . 1)) (dh . (3 . 1)))) 244 (ah . (0 . 1)) (bh . (1 . 1)) (ch . (2 . 1)) (dh . (3 . 1))))
240 245
241(defun make-register () 246(defun dos-make-register ()
242 (make-vector 8 0)) 247 (make-vector 8 0))
243 248
244(defun register-value (regs name) 249(defun dos-register-value (regs name)
245 (let ((where (cdr (assoc name register-name-alist)))) 250 (let ((where (cdr (assoc name dos-register-name-alist))))
246 (cond ((consp where) 251 (cond ((consp where)
247 (let ((tem (aref regs (car where)))) 252 (let ((tem (aref regs (car where))))
248 (if (zerop (cdr where)) 253 (if (zerop (cdr where))
@@ -252,10 +257,10 @@ returned unaltered."
252 (aref regs where)) 257 (aref regs where))
253 (t nil)))) 258 (t nil))))
254 259
255(defun set-register-value (regs name value) 260(defun dos-set-register-value (regs name value)
256 (and (numberp value) 261 (and (numberp value)
257 (>= value 0) 262 (>= value 0)
258 (let ((where (cdr (assoc name register-name-alist)))) 263 (let ((where (cdr (assoc name dos-register-name-alist))))
259 (cond ((consp where) 264 (cond ((consp where)
260 (let ((tem (aref regs (car where))) 265 (let ((tem (aref regs (car where)))
261 (value (logand value 255))) 266 (value (logand value 255)))
@@ -268,18 +273,18 @@ returned unaltered."
268 (aset regs where (logand value 65535)))))) 273 (aset regs where (logand value 65535))))))
269 regs) 274 regs)
270 275
271(defsubst intdos (regs) 276(defsubst dos-intdos (regs)
272 (int86 33 regs)) 277 (int86 33 regs))
273 278
274;; Backward compatibility for obsolescent functions which 279;; Backward compatibility for obsolescent functions which
275;; set screen size. 280;; set screen size.
276 281
277(defun mode25 () 282(defun dos-mode25 ()
278 "Changes the number of screen rows to 25." 283 "Changes the number of screen rows to 25."
279 (interactive) 284 (interactive)
280 (set-frame-size (selected-frame) 80 25)) 285 (set-frame-size (selected-frame) 80 25))
281 286
282(defun mode4350 () 287(defun dos-mode4350 ()
283 "Changes the number of rows to 43 or 50. 288 "Changes the number of rows to 43 or 50.
284Emacs always tries to set the screen height to 50 rows first. 289Emacs always tries to set the screen height to 50 rows first.
285If this fails, it will try to set it to 43 rows, on the assumption 290If this fails, it will try to set it to 43 rows, on the assumption