comparison lisp/eshell/esh-util.el @ 62915:b89e30bcd2bb

Changed all uses of `directory-sep-char' to ?/, and all uses of `string-to-int' to `string-to-number'.
author John Wiegley <johnw@newartisans.com>
date Tue, 31 May 2005 00:14:26 +0000
parents 695cf19ef79e
children 18a818a2ee7c 01137c1fdbe9
comparison
equal deleted inserted replaced
62914:6c8a535adaf3 62915:b89e30bcd2bb
251 (let ((len (length path)) 251 (let ((len (length path))
252 (i 0) (li 0) 252 (i 0) (li 0)
253 parts) 253 parts)
254 (if (and (eshell-under-windows-p) 254 (if (and (eshell-under-windows-p)
255 (> len 2) 255 (> len 2)
256 (eq (aref path 0) directory-sep-char) 256 (eq (aref path 0) ?/)
257 (eq (aref path 1) directory-sep-char)) 257 (eq (aref path 1) ?/))
258 (setq i 2)) 258 (setq i 2))
259 (while (< i len) 259 (while (< i len)
260 (if (and (eq (aref path i) directory-sep-char) 260 (if (and (eq (aref path i) ?/)
261 (not (get-text-property i 'escaped path))) 261 (not (get-text-property i 'escaped path)))
262 (setq parts (cons (if (= li i) 262 (setq parts (cons (if (= li i) "/"
263 (char-to-string directory-sep-char)
264 (substring path li (1+ i))) parts) 263 (substring path li (1+ i))) parts)
265 li (1+ i))) 264 li (1+ i)))
266 (setq i (1+ i))) 265 (setq i (1+ i)))
267 (if (< li i) 266 (if (< li i)
268 (setq parts (cons (substring path li i) parts))) 267 (setq parts (cons (substring path li i) parts)))
269 (if (and (eshell-under-windows-p) 268 (if (and (eshell-under-windows-p)
270 (string-match "\\`[A-Za-z]:\\'" (car (last parts)))) 269 (string-match "\\`[A-Za-z]:\\'" (car (last parts))))
271 (setcar (last parts) 270 (setcar (last parts) (concat (car (last parts)) "/")))
272 (concat (car (last parts))
273 (char-to-string directory-sep-char))))
274 (nreverse parts))) 271 (nreverse parts)))
275 272
276 (defun eshell-to-flat-string (value) 273 (defun eshell-to-flat-string (value)
277 "Make value a string. If separated by newlines change them to spaces." 274 "Make value a string. If separated by newlines change them to spaces."
278 (let ((text (eshell-stringify value))) 275 (let ((text (eshell-stringify value)))
448 (let* ((fields 445 (let* ((fields
449 (split-string (buffer-substring 446 (split-string (buffer-substring
450 (point) (progn (end-of-line) 447 (point) (progn (end-of-line)
451 (point))) ":"))) 448 (point))) ":")))
452 (if (and (and fields (nth 0 fields) (nth 2 fields)) 449 (if (and (and fields (nth 0 fields) (nth 2 fields))
453 (not (assq (string-to-int (nth 2 fields)) names))) 450 (not (assq (string-to-number (nth 2 fields)) names)))
454 (setq names (cons (cons (string-to-int (nth 2 fields)) 451 (setq names (cons (cons (string-to-number (nth 2 fields))
455 (nth 0 fields)) 452 (nth 0 fields))
456 names)))) 453 names))))
457 (forward-line)))) 454 (forward-line))))
458 names)) 455 names))
459 456