comparison lisp/shell.el @ 4676:a95bec390bc3

(shell-resync-dirs, shell-process-cd, shell-process-pushd, shell-process-popd): Prepend comint-filename-prefix to directory names when calling cd.
author Roland McGrath <roland@gnu.org>
date Wed, 08 Sep 1993 07:01:42 +0000
parents c9a0f06110bd
children 835ecfabae68
comparison
equal deleted inserted replaced
4675:f4ab5299a1e4 4676:a95bec390bc3
380 (defun shell-process-popd (arg) 380 (defun shell-process-popd (arg)
381 (let ((num (if (zerop (length arg)) 0 ; no arg means +0 381 (let ((num (if (zerop (length arg)) 0 ; no arg means +0
382 (shell-extract-num arg)))) 382 (shell-extract-num arg))))
383 (if (and num (< num (length shell-dirstack))) 383 (if (and num (< num (length shell-dirstack)))
384 (if (= num 0) ; condition-case because the CD could lose. 384 (if (= num 0) ; condition-case because the CD could lose.
385 (condition-case nil (progn (cd (car shell-dirstack)) 385 (condition-case nil (progn (cd (concat comint-filename-prefix
386 (car shell-dirstack)))
386 (setq shell-dirstack 387 (setq shell-dirstack
387 (cdr shell-dirstack)) 388 (cdr shell-dirstack))
388 (shell-dirstack-message)) 389 (shell-dirstack-message))
389 (error (message "Couldn't cd."))) 390 (error (message "Couldn't cd.")))
390 (let* ((ds (cons nil shell-dirstack)) 391 (let* ((ds (cons nil shell-dirstack))
401 (let ((new-dir (cond 402 (let ((new-dir (cond
402 ((zerop (length arg)) (getenv "HOME")) 403 ((zerop (length arg)) (getenv "HOME"))
403 ((string-equal "-" arg) shell-last-dir) 404 ((string-equal "-" arg) shell-last-dir)
404 (t arg)))) 405 (t arg))))
405 (setq shell-last-dir default-directory) 406 (setq shell-last-dir default-directory)
406 (cd new-dir) 407 (cd (concat comint-filename-prefix new-dir))
407 (shell-dirstack-message)) 408 (shell-dirstack-message))
408 (error (message "Couldn't cd.")))) 409 (error (message "Couldn't cd."))))
409 410
410 ;;; pushd [+n | dir] 411 ;;; pushd [+n | dir]
411 (defun shell-process-pushd (arg) 412 (defun shell-process-pushd (arg)
412 (if (zerop (length arg)) 413 (if (zerop (length arg))
413 ;; no arg -- swap pwd and car of shell stack 414 ;; no arg -- swap pwd and car of shell stack
414 (condition-case nil (if shell-dirstack 415 (condition-case nil (if shell-dirstack
415 (let ((old default-directory)) 416 (let ((old default-directory))
416 (cd (car shell-dirstack)) 417 (cd (concat comint-filename-prefix
418 (car shell-dirstack)))
417 (setq shell-dirstack 419 (setq shell-dirstack
418 (cons old (cdr shell-dirstack))) 420 (cons old (cdr shell-dirstack)))
419 (shell-dirstack-message)) 421 (shell-dirstack-message))
420 (message "Directory stack empty.")) 422 (message "Directory stack empty."))
421 (error 423 (error
429 (dslen (length ds)) 431 (dslen (length ds))
430 (front (nthcdr num ds)) 432 (front (nthcdr num ds))
431 (back (reverse (nthcdr (- dslen num) (reverse ds)))) 433 (back (reverse (nthcdr (- dslen num) (reverse ds))))
432 (new-ds (append front back))) 434 (new-ds (append front back)))
433 (condition-case nil 435 (condition-case nil
434 (progn (cd (car new-ds)) 436 (progn (cd (concat comint-filename-prefix (car new-ds)))
435 (setq shell-dirstack (cdr new-ds)) 437 (setq shell-dirstack (cdr new-ds))
436 (shell-dirstack-message)) 438 (shell-dirstack-message))
437 (error (message "Couldn't cd."))))) 439 (error (message "Couldn't cd.")))))
438 440
439 ;; pushd <dir> 441 ;; pushd <dir>
440 (let ((old-wd default-directory)) 442 (let ((old-wd default-directory))
441 (condition-case nil 443 (condition-case nil
442 (progn (cd arg) 444 (progn (cd (concat comint-filename-prefix arg))
443 (setq shell-dirstack 445 (setq shell-dirstack
444 (cons old-wd shell-dirstack)) 446 (cons old-wd shell-dirstack))
445 (shell-dirstack-message)) 447 (shell-dirstack-message))
446 (error (message "Couldn't cd.")))))))) 448 (error (message "Couldn't cd."))))))))
447 449
499 (setq ds (cons (substring dl (match-beginning 1) (match-end 1)) 501 (setq ds (cons (substring dl (match-beginning 1) (match-end 1))
500 ds)) 502 ds))
501 (setq i (match-end 0))) 503 (setq i (match-end 0)))
502 (let ((ds (reverse ds))) 504 (let ((ds (reverse ds)))
503 (condition-case nil 505 (condition-case nil
504 (progn (cd (car ds)) 506 (progn (cd (concat comint-filename-prefix (car ds)))
505 (setq shell-dirstack (cdr ds)) 507 (setq shell-dirstack (cdr ds))
506 (shell-dirstack-message)) 508 (shell-dirstack-message))
507 (error (message "Couldn't cd."))))))) 509 (error (message "Couldn't cd.")))))))
508 510
509 ;;; For your typing convenience: 511 ;;; For your typing convenience: