unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: "Omar Antolín Camarena" <omar@matem.unam.mx>,
	41424@debbugs.gnu.org, 41412@debbugs.gnu.org,
	"Stefan Kangas" <stefankangas@gmail.com>
Subject: bug#41412: bug#41424: 26.1; default-directory in *Completions* buffer
Date: Mon, 09 May 2022 13:00:13 +0200	[thread overview]
Message-ID: <87y1zb7yyq.fsf_-_@gnus.org> (raw)
In-Reply-To: <jwvczxvpb9a.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sat, 23 Jan 2021 17:00:00 -0500")

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	other threads:[~2022-05-09 11:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-20 17:49 bug#41424: 26.1; default-directory in *Completions* buffer Omar Antolín Camarena
2021-01-22 20:28 ` bug#41424: bug#41412: 27.0.90; Value of default directory in completions buffer Lars Ingebrigtsen
2021-01-22 22:50   ` Stefan Monnier
2021-01-23 18:47     ` bug#41424: " Lars Ingebrigtsen
2021-01-23 22:00       ` Stefan Monnier
2022-05-09 11:00         ` Lars Ingebrigtsen [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-05-19 23:06 Karthik Chikmagalur
2022-06-06 13:07 ` bug#41412: bug#41424: 26.1; default-directory in *Completions* buffer Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y1zb7yyq.fsf_-_@gnus.org \
    --to=larsi@gnus.org \
    --cc=41412@debbugs.gnu.org \
    --cc=41424@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=omar@matem.unam.mx \
    --cc=stefankangas@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).