comparison lisp/files.el @ 2630:47cf3a387530

* files.el (insert-directory): Undo change of March 23; dereferencing links is inappropriate for dired. * files.el (abbreviate-file-name): If abbreviated-home-dir ends with a slash, don't remove the corresponding slash from filename when we collapse the home directory to ~.
author Jim Blandy <jimb@redhat.com>
date Mon, 03 May 1993 03:37:22 +0000
parents 15cb6ba42da3
children b69eef4cf31d
comparison
equal deleted inserted replaced
2629:137117f5c44c 2630:47cf3a387530
479 (concat "^" (abbreviate-file-name (expand-file-name "~")))))) 479 (concat "^" (abbreviate-file-name (expand-file-name "~"))))))
480 ;; If FILENAME starts with the abbreviated homedir, 480 ;; If FILENAME starts with the abbreviated homedir,
481 ;; make it start with `~' instead. 481 ;; make it start with `~' instead.
482 (if (string-match abbreviated-home-dir filename) 482 (if (string-match abbreviated-home-dir filename)
483 (setq filename 483 (setq filename
484 (concat "~" (substring filename (match-end 0))))) 484 (concat "~"
485 ;; If abbreviated-home-dir ends with a slash,
486 ;; don't remove the corresponding slash from
487 ;; filename. On MS-DOS and OS/2, you can have
488 ;; home directories like "g:/", in which it is
489 ;; important not to remove the slash. And what
490 ;; about poor root on Unix systems?
491 (if (eq ?/ (aref abbreviated-home-dir
492 (1- (length abbreviated-home-dir))))
493 "/"
494 "")
495 (substring filename (match-end 0)))))
485 filename)) 496 filename))
486 497
487 (defvar find-file-not-true-dirname-list nil 498 (defvar find-file-not-true-dirname-list nil
488 "*List of logical names for which visiting shouldn't save the true dirname. 499 "*List of logical names for which visiting shouldn't save the true dirname.
489 On VMS, when you visit a file using a logical name that searches a path, 500 On VMS, when you visit a file using a logical name that searches a path,
1776 (let ((default-directory (file-name-directory file))) 1787 (let ((default-directory (file-name-directory file)))
1777 (call-process shell-file-name nil t nil 1788 (call-process shell-file-name nil t nil
1778 "-c" (concat insert-directory-program 1789 "-c" (concat insert-directory-program
1779 " -d " switches " " 1790 " -d " switches " "
1780 (file-name-nondirectory file)))) 1791 (file-name-nondirectory file))))
1781 ;; Chase links till we reach a non-link. 1792 ;; Barry Margolin says: "SunOS 4.1.3 (and SV and POSIX?)
1782 ;; This used to be commented out, but Barry Margolin says: 1793 ;; lists the link if we give a link to a directory - yuck!"
1783 ;; SunOS 4.1.3 (and SV and POSIX?) lists the link 1794 ;; That's why we used to chase symlinks. But we don't want
1784 ;; if we give a link to a directory - yuck! 1795 ;; to chase links before passing the filename to ls; that
1785 (let (symlink) 1796 ;; would mean that our line of output would not display
1786 (while (setq symlink (file-symlink-p file)) 1797 ;; FILE's name as given. To really address the problem that
1787 (setq file symlink))) 1798 ;; SunOS 4.1.3 has, we need to find the right switch to get
1799 ;; a descripton of the link itself.
1800 ;; (let (symlink)
1801 ;; (while (setq symlink (file-symlink-p file))
1802 ;; (setq file symlink)))
1788 (call-process insert-directory-program nil t nil switches file)))))) 1803 (call-process insert-directory-program nil t nil switches file))))))
1789 1804
1790 (defun save-buffers-kill-emacs (&optional arg) 1805 (defun save-buffers-kill-emacs (&optional arg)
1791 "Offer to save each buffer, then kill this Emacs process. 1806 "Offer to save each buffer, then kill this Emacs process.
1792 With prefix arg, silently save all file-visiting buffers, then kill." 1807 With prefix arg, silently save all file-visiting buffers, then kill."