1350 |
(defun dired-get-file-for-visit () |
(defun dired-get-file-for-visit () |
1351 |
"Get the current line's file name, with an error if file does not exist." |
"Get the current line's file name, with an error if file does not exist." |
1352 |
(interactive) |
(interactive) |
1353 |
(let ((file-name (file-name-sans-versions (dired-get-filename) t))) |
;; We pass t for second arg so that we don't get error for `.' and `..'. |
1354 |
|
(let ((raw (dired-get-filename nil t)) |
1355 |
|
file-name) |
1356 |
|
(if (null raw) |
1357 |
|
(error "No file on this line")) |
1358 |
|
(setq file-name (file-name-sans-versions raw t)) |
1359 |
(if (file-exists-p file-name) |
(if (file-exists-p file-name) |
1360 |
file-name |
file-name |
1361 |
(if (file-symlink-p file-name) |
(if (file-symlink-p file-name) |
1487 |
(cond |
(cond |
1488 |
((null file) |
((null file) |
1489 |
nil) |
nil) |
1490 |
|
((and (not no-error-if-not-filep) |
1491 |
|
(save-excursion |
1492 |
|
(beginning-of-line) |
1493 |
|
(looking-at dired-re-dir))) |
1494 |
|
(error "Cannot operate on `.' or `..'")) |
1495 |
((eq localp 'verbatim) |
((eq localp 'verbatim) |
1496 |
file) |
file) |
1497 |
((and (eq localp 'no-dir) already-absolute) |
((and (eq localp 'no-dir) already-absolute) |
2668 |
(re-search-forward dired-re-mark nil t) |
(re-search-forward dired-re-mark nil t) |
2669 |
(search-forward string nil t)) |
(search-forward string nil t)) |
2670 |
(if (or (not arg) |
(if (or (not arg) |
2671 |
(dired-query 'query "Unmark file `%s'? " |
(let ((file (dired-get-filename t t))) |
2672 |
(dired-get-filename t))) |
(and file |
2673 |
|
(dired-query 'query "Unmark file `%s'? " |
2674 |
|
file)))) |
2675 |
(progn (subst-char-in-region (1- (point)) (point) |
(progn (subst-char-in-region (1- (point)) (point) |
2676 |
(preceding-char) ?\ ) |
(preceding-char) ?\ ) |
2677 |
(setq count (1+ count))))) |
(setq count (1+ count))))) |