[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#55743: 28.1.50; No directory error in comp-run-async-workers
From: |
Juri Linkov |
Subject: |
bug#55743: 28.1.50; No directory error in comp-run-async-workers |
Date: |
Wed, 01 Jun 2022 09:10:56 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) |
>>> 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
- bug#55743: 28.1.50; No directory error in comp-run-async-workers, (continued)
- bug#55743: 28.1.50; No directory error in comp-run-async-workers, Andreas Schwab, 2022/06/02
- bug#55743: 28.1.50; No directory error in comp-run-async-workers, Eli Zaretskii, 2022/06/02
- bug#55743: 28.1.50; No directory error in comp-run-async-workers, Juri Linkov, 2022/06/02
- bug#55743: 28.1.50; No directory error in comp-run-async-workers, Eli Zaretskii, 2022/06/02
- bug#55743: 28.1.50; No directory error in comp-run-async-workers, Juri Linkov, 2022/06/03
- bug#55743: 28.1.50; No directory error in comp-run-async-workers, Eli Zaretskii, 2022/06/03
bug#55743: 28.1.50; No directory error in comp-run-async-workers,
Juri Linkov <=