unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 55743@debbugs.gnu.org
Subject: bug#55743: 28.1.50; No directory error in comp-run-async-workers
Date: Wed, 01 Jun 2022 09:10:56 +0300	[thread overview]
Message-ID: <86sfoo7wm7.fsf@mail.linkov.net> (raw)
In-Reply-To: <86wne1trce.fsf@mail.linkov.net> (Juri Linkov's message of "Tue,  31 May 2022 22:49:37 +0300")

>>> So here are two problems: why completion sets default-directory to non-existent dir,
>>
>> That's the real problem.
>
> Oh, I see, it's a known problem.  In completion-setup-function:
>
>          (base-dir
>           ;; FIXME: This is a bad hack.  We try to set the default-directory
>           ;; in the *Completions* buffer so that the relative file names
>           ;; displayed there can be treated as valid file names, independently
>           ;; from the completion context.  But this suffers from many problems:
>           ;; - It's not clear when the completions are file names.  With some
>           ;;   completion tables (e.g. bzr revision specs), the listed
>           ;;   completions can mix file names and other things.
>           ;; - It doesn't pay attention to possible quoting.
>           ;; - 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)))))))
>       ...
>       (if base-dir (setq default-directory base-dir))

The problem can be solved by this patch that handles both the most
frequent cases: when the completion string is the default directory,
and when a file prefix is added to it.

diff --git a/lisp/simple.el b/lisp/simple.el
index 103e7f33dd..81e04f28e9 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -9803,7 +9802,7 @@ 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
+              (file-name-directory
                (expand-file-name
                 (buffer-substring (minibuffer-prompt-end) (point)))))))
     (with-current-buffer standard-output





      parent reply	other threads:[~2022-06-01  6:10 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-31 17:31 bug#55743: 28.1.50; No directory error in comp-run-async-workers Juri Linkov
2022-05-31 19:07 ` Eli Zaretskii
2022-05-31 19:49   ` Juri Linkov
2022-06-01  2:33     ` Eli Zaretskii
2022-06-01  6:13       ` Juri Linkov
2022-06-01 11:16         ` Eli Zaretskii
2022-06-01 19:13           ` Juri Linkov
2022-06-01 19:49             ` Eli Zaretskii
2022-06-02  7:40               ` Juri Linkov
2022-06-02  8:02                 ` Eli Zaretskii
2022-06-02  8:17                   ` Lars Ingebrigtsen
2022-06-02  8:44                     ` Eli Zaretskii
2022-06-02  8:51                       ` Lars Ingebrigtsen
2022-06-02 10:48                         ` Eli Zaretskii
2022-06-03  3:10                           ` Lars Ingebrigtsen
2022-06-03  5:55                             ` Eli Zaretskii
2022-06-03  8:22                               ` Andreas Schwab
2022-06-03 11:43                                 ` Eli Zaretskii
2022-06-02  8:17                   ` Andreas Schwab
2022-06-02  8:45                     ` Eli Zaretskii
2022-06-02 17:30                       ` Juri Linkov
2022-06-02 19:02                         ` Eli Zaretskii
2022-06-03  7:49                           ` Juri Linkov
2022-06-03 11:12                             ` Eli Zaretskii
2022-06-01  6:10     ` Juri Linkov [this message]

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=86sfoo7wm7.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=55743@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /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).