Subject: bug#18859: 24.3; ibuffer-mark-by-file-name-regexp does not match displayed name

From: Lars Ingebrigtsen <[email-masked]>
Date: Sat, 03 Aug 2019 18:54:07 +0200

Reuben Thomas <[email-masked]> writes:

> In the *IBuffer*, files in my home directory are displayed with names
> starting with ‘~’, but when I type % f ~ RET I get no matches. If I type
> instead % f /home/MYUSER RET then all files in my home directory are
> matched.
>
> I’m not convinced that the matches should be made in the second case,
> even; but certainly they _should_ be made in the first.

The following patch fixes this by matching on the abbreviated file name
(which is what ibuffer uses to create the displayed file name).

But I guess this could be a controversial change -- does anybody have an
objection to making this change?  

diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el
index 1b69574a39..06a2248d40 100644
--- a/lisp/ibuf-ext.el
+++ b/lisp/ibuf-ext.el
@@ -1846,7 +1846,8 @@ ibuffer-mark-by-file-name-regexp
 			  (stringp dired-directory)
 			  dired-directory)))))
 	 (when name
-	   (string-match regexp name))))))
+           ;; Match on the displayed file name (which is abbreviated).
+	   (string-match regexp (abbreviate-file-name name)))))))
 
 ;;;###autoload
 (defun ibuffer-mark-by-content-regexp (regexp &optional all-buffers)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no