Mercurial > emacs
comparison lisp/dired.el @ 16794:2de3fd99ae88
(dired-make-relative): Ignore the third argument;
never signal an error just bbcause FILE is not in DIR's tree.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 31 Dec 1996 18:29:49 +0000 |
parents | 97849649b875 |
children | 2a43d154b32b |
comparison
equal
deleted
inserted
replaced
16793:f932e8b3c525 | 16794:2de3fd99ae88 |
---|---|
1275 ;; redefined (for VMS?). | 1275 ;; redefined (for VMS?). |
1276 ;; It should be reasonably fast, though, as it is called in | 1276 ;; It should be reasonably fast, though, as it is called in |
1277 ;; dired-get-filename. | 1277 ;; dired-get-filename. |
1278 (concat (or dir default-directory) file)) | 1278 (concat (or dir default-directory) file)) |
1279 | 1279 |
1280 (defun dired-make-relative (file &optional dir no-error) | 1280 (defun dired-make-relative (file &optional dir ignore) |
1281 ;;"Convert FILE (an absolute file name) to a name relative to DIR. | 1281 "Convert FILE (an absolute file name) to a name relative to DIR. |
1282 ;; Else error (unless NO-ERROR is non-nil, then FILE is returned unchanged) | 1282 If this is impossible, return FILE unchanged. |
1283 ;;DIR defaults to default-directory." | 1283 DIR must be a directory name, not a file name." |
1284 ;; DIR must be file-name-as-directory, as with all directory args in | |
1285 ;; Emacs Lisp code. | |
1286 (or dir (setq dir default-directory)) | 1284 (or dir (setq dir default-directory)) |
1287 ;; This case comes into play if default-directory is set to | 1285 ;; This case comes into play if default-directory is set to |
1288 ;; use ~. | 1286 ;; use ~. |
1289 (if (and (> (length dir) 0) (= (aref dir 0) ?~)) | 1287 (if (and (> (length dir) 0) (= (aref dir 0) ?~)) |
1290 (setq dir (expand-file-name dir))) | 1288 (setq dir (expand-file-name dir))) |
1291 (if (string-match (concat "^" (regexp-quote dir)) file) | 1289 (if (string-match (concat "^" (regexp-quote dir)) file) |
1292 (substring file (match-end 0)) | 1290 (substring file (match-end 0)) |
1293 (if no-error | 1291 ;;; (or no-error |
1294 file | 1292 ;;; (error "%s: not in directory tree growing at %s" file dir)) |
1295 (error "%s: not in directory tree growing at %s" file dir)))) | 1293 file)) |
1296 | 1294 |
1297 ;;; Functions for finding the file name in a dired buffer line. | 1295 ;;; Functions for finding the file name in a dired buffer line. |
1298 | 1296 |
1299 (defvar dired-move-to-filename-regexp | 1297 (defvar dired-move-to-filename-regexp |
1300 " [A-Za-z\xa0-\xff][A-Za-z\xa0-\xff][A-Za-z\xa0-\xff] [0-3 ][0-9]\ | 1298 " [A-Za-z\xa0-\xff][A-Za-z\xa0-\xff][A-Za-z\xa0-\xff] [0-3 ][0-9]\ |