bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#41412: bug#41424: 26.1; default-directory in *Completions* buffer


From: Lars Ingebrigtsen
Subject: bug#41412: bug#41424: 26.1; default-directory in *Completions* buffer
Date: Mon, 09 May 2022 13:00:13 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> I think the correct thing to do is to look at the `(cdr (last completions))`
> where `completions` is what `completion-all-completions` returned.
> That gives what used to be called `completion-base-size`.

The call sequence here seems to be somewhat convoluted, so I'm not sure
how to get at that.  But wouldn't just doing the following simple patch
fix the issue without regressing anything?


diff --git a/lisp/simple.el b/lisp/simple.el
index 861d9eefde..65b2a482e2 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -9495,9 +9495,11 @@ completion-setup-function
           ;; - With fancy completion styles, the code below will not always
           ;;   find the right base directory.
           (if minibuffer-completing-file-name
-              (file-name-as-directory
-               (expand-file-name
-                (buffer-substring (minibuffer-prompt-end) (point)))))))
+              (let ((file (expand-file-name
+                           (buffer-substring (minibuffer-prompt-end) 
(point)))))
+                (if (file-directory-p file)
+                    (file-name-as-directory file)
+                  (file-name-directory file))))))
     (with-current-buffer standard-output
       (let ((base-position completion-base-position)
             (base-affixes completion-base-affixes)


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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]