diff options
| author | Stephen Berman | 2018-09-13 22:19:22 +0200 |
|---|---|---|
| committer | Stephen Berman | 2018-09-13 22:19:22 +0200 |
| commit | 755fa346eba212b4650c8541023bb78e1658d77b (patch) | |
| tree | 223d2061202e22841626c9d27f3a80103453b696 | |
| parent | f066999b6540451c590cbe32113fae61c4778ba3 (diff) | |
| download | emacs-755fa346eba212b4650c8541023bb78e1658d77b.tar.gz emacs-755fa346eba212b4650c8541023bb78e1658d77b.zip | |
Fix wdired handling of symlinks when restoring filename property
* lisp/wdired.el (wdired--restore-dired-filename-prop): Use
dired-permission-flags-regexp instead of dired-filename to test
whether the file is a symlink, since calling file-symlink-p on the
latter may fail in wdired-mode (bug#32673).
| -rw-r--r-- | lisp/wdired.el | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/lisp/wdired.el b/lisp/wdired.el index be0bde290ab..3157e887d77 100644 --- a/lisp/wdired.el +++ b/lisp/wdired.el | |||
| @@ -607,15 +607,22 @@ Optional arguments are ignored." | |||
| 607 | (defun wdired--restore-dired-filename-prop (beg end _len) | 607 | (defun wdired--restore-dired-filename-prop (beg end _len) |
| 608 | (save-match-data | 608 | (save-match-data |
| 609 | (save-excursion | 609 | (save-excursion |
| 610 | (beginning-of-line) | 610 | (let ((lep (line-end-position))) |
| 611 | (when (re-search-forward directory-listing-before-filename-regexp | 611 | (beginning-of-line) |
| 612 | (line-end-position) t) | 612 | (when (re-search-forward |
| 613 | (setq beg (point) | 613 | directory-listing-before-filename-regexp lep t) |
| 614 | end (if (and (file-symlink-p (dired-get-filename)) | 614 | (setq beg (point) |
| 615 | (search-forward " -> " (line-end-position) t)) | 615 | ;; If the file is a symlink, put the dired-filename |
| 616 | (goto-char (match-beginning 0)) | 616 | ;; property only on the link name. (Using |
| 617 | (line-end-position))) | 617 | ;; (file-symlink-p (dired-get-filename)) fails in |
| 618 | (put-text-property beg end 'dired-filename t))))) | 618 | ;; wdired-mode, bug#32673.) |
| 619 | end (if (and (re-search-backward | ||
| 620 | dired-permission-flags-regexp nil t) | ||
| 621 | (looking-at "l") | ||
| 622 | (search-forward " -> " lep t)) | ||
| 623 | (goto-char (match-beginning 0)) | ||
| 624 | lep)) | ||
| 625 | (put-text-property beg end 'dired-filename t)))))) | ||
| 619 | 626 | ||
| 620 | (defun wdired-next-line (arg) | 627 | (defun wdired-next-line (arg) |
| 621 | "Move down lines then position at filename or the current column. | 628 | "Move down lines then position at filename or the current column. |