diff options
| author | Dmitry Gutov | 2020-02-25 01:03:28 +0200 |
|---|---|---|
| committer | Dmitry Gutov | 2020-02-25 01:03:42 +0200 |
| commit | 9ec6eb1065c65b32e9a565a6b66298aa4f2e527c (patch) | |
| tree | d147ded8a6da0ff0851c1276bee0801a3315724a | |
| parent | e74fb4688b78f549fbc79a2163c92ba64296ee3d (diff) | |
| download | emacs-9ec6eb1065c65b32e9a565a6b66298aa4f2e527c.tar.gz emacs-9ec6eb1065c65b32e9a565a6b66298aa4f2e527c.zip | |
vc-dir-ignore: More accurately choose base directory
* lisp/vc/vc-dir.el:
(vc-dir-ignore): Use it (bug#37189).
* lisp/vc/vc.el:
(vc--ignore-base-dir): Extract from vc-ignore.
| -rw-r--r-- | lisp/vc/vc-dir.el | 7 | ||||
| -rw-r--r-- | lisp/vc/vc.el | 18 |
2 files changed, 14 insertions, 11 deletions
diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el index e5c5e16a17a..38b4937e854 100644 --- a/lisp/vc/vc-dir.el +++ b/lisp/vc/vc-dir.el | |||
| @@ -879,9 +879,10 @@ If a prefix argument is given, ignore all marked files." | |||
| 879 | (vc-ignore (vc-dir-fileinfo->name filearg)) | 879 | (vc-ignore (vc-dir-fileinfo->name filearg)) |
| 880 | t)) | 880 | t)) |
| 881 | vc-ewoc) | 881 | vc-ewoc) |
| 882 | (vc-ignore | 882 | (let ((rel-dir (vc--ignore-base-dir))) |
| 883 | (file-relative-name (vc-dir-current-file)) | 883 | (vc-ignore |
| 884 | default-directory))) | 884 | (file-relative-name (vc-dir-current-file) rel-dir) |
| 885 | rel-dir)))) | ||
| 885 | 886 | ||
| 886 | (defun vc-dir-current-file () | 887 | (defun vc-dir-current-file () |
| 887 | (let ((node (ewoc-locate vc-ewoc))) | 888 | (let ((node (ewoc-locate vc-ewoc))) |
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 53491dd1b04..fe666413168 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el | |||
| @@ -1406,14 +1406,7 @@ When called interactively, prompt for a FILE to ignore, unless a | |||
| 1406 | prefix argument is given, in which case prompt for a file FILE to | 1406 | prefix argument is given, in which case prompt for a file FILE to |
| 1407 | remove from the list of ignored files." | 1407 | remove from the list of ignored files." |
| 1408 | (interactive | 1408 | (interactive |
| 1409 | (let* ((backend (vc-responsible-backend default-directory)) | 1409 | (let* ((rel-dir (vc--ignore-base-dir)) |
| 1410 | (rel-dir | ||
| 1411 | (condition-case nil | ||
| 1412 | (file-name-directory | ||
| 1413 | (vc-call-backend backend 'find-ignore-file | ||
| 1414 | default-directory)) | ||
| 1415 | (vc-not-supported | ||
| 1416 | default-directory))) | ||
| 1417 | (file (read-file-name "File to ignore: "))) | 1410 | (file (read-file-name "File to ignore: "))) |
| 1418 | (when (and (file-name-absolute-p file) | 1411 | (when (and (file-name-absolute-p file) |
| 1419 | (file-in-directory-p file rel-dir)) | 1412 | (file-in-directory-p file rel-dir)) |
| @@ -1426,6 +1419,15 @@ remove from the list of ignored files." | |||
| 1426 | (error "Unknown backend")))) | 1419 | (error "Unknown backend")))) |
| 1427 | (vc-call-backend backend 'ignore file directory remove))) | 1420 | (vc-call-backend backend 'ignore file directory remove))) |
| 1428 | 1421 | ||
| 1422 | (defun vc--ignore-base-dir () | ||
| 1423 | (let ((backend (vc-responsible-backend default-directory))) | ||
| 1424 | (condition-case nil | ||
| 1425 | (file-name-directory | ||
| 1426 | (vc-call-backend backend 'find-ignore-file | ||
| 1427 | default-directory)) | ||
| 1428 | (vc-not-supported | ||
| 1429 | default-directory)))) | ||
| 1430 | |||
| 1429 | (defun vc-default-ignore (backend file &optional directory remove) | 1431 | (defun vc-default-ignore (backend file &optional directory remove) |
| 1430 | "Ignore FILE under DIRECTORY (default is `default-directory'). | 1432 | "Ignore FILE under DIRECTORY (default is `default-directory'). |
| 1431 | FILE is a wildcard specification relative to DIRECTORY. | 1433 | FILE is a wildcard specification relative to DIRECTORY. |