GNU bug report logs -
#16648
[PATCH] Improved ffap-completable
Previous Next
Reported by: E Sabof <esabof <at> gmail.com>
Date: Wed, 5 Feb 2014 07:16:01 UTC
Severity: wishlist
Tags: patch
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 16648 in the body.
You can then email your comments to 16648 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#16648
; Package
emacs
.
(Wed, 05 Feb 2014 07:16:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
E Sabof <esabof <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Wed, 05 Feb 2014 07:16:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Assuming that point is at the word "The", and the complete filename follows. The current version will work when the default-directory contains one file "The first file.txt". But it won't if there is another file "The second file.txt", since file-name-completion will only give a partial completion.
Evgeni
diff --git a/lisp/ffap.el b/lisp/ffap.el
index bb0f61d..4655639 100644
--- a/lisp/ffap.el
+++ b/lisp/ffap.el
@@ -819,8 +819,28 @@ URL, or nil. If nil, search the alist for further matches.")
(defun ffap-completable (name)
(let* ((dir (or (file-name-directory name) default-directory))
- (cmp (file-name-completion (file-name-nondirectory name) dir)))
- (and cmp (concat dir cmp))))
+ (completions (file-name-all-completions
+ (file-name-nondirectory name) dir))
+ (looking-at-candidate
+ (lambda (candidate)
+ (string-equal (buffer-substring
+ (point)
+ (min (+ (point) (length candidate))
+ (point-max)))
+ candidate)))
+ start)
+ (when (and completions (cdr completions))
+ (setq completions
+ (or (cl-remove-if-not looking-at-candidate
+ completions)
+ (and (setq start (car (bounds-of-thing-at-point 'symbol)))
+ (/= start (point))
+ (save-excursion
+ (goto-char start)
+ (cl-remove-if-not looking-at-candidate
+ completions))))))
+ (when completions
+ (concat dir (car completions)))))
(defun ffap-home (name) (ffap-locate-file name t '("~")))
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#16648
; Package
emacs
.
(Wed, 24 Feb 2016 03:25:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 16648 <at> debbugs.gnu.org (full text, mbox):
E Sabof <esabof <at> gmail.com> writes:
> Assuming that point is at the word "The", and the complete filename
> follows. The current version will work when the default-directory
> contains one file "The first file.txt". But it won't if there is
> another file "The second file.txt", since file-name-completion will
> only give a partial completion.
I think the patch below looks reasonable, but I rarely use ffap, so I'm
not quite sure. Anybody have an opinion?
Also, this patch is more than 15 lines, so we need FSF copyright
assignment papers before applying it. Would you be willing so sign such
papers?
>
> diff --git a/lisp/ffap.el b/lisp/ffap.el
> index bb0f61d..4655639 100644
> --- a/lisp/ffap.el
> +++ b/lisp/ffap.el
> @@ -819,8 +819,28 @@ URL, or nil. If nil, search the alist for further matches.")
>
> (defun ffap-completable (name)
> (let* ((dir (or (file-name-directory name) default-directory))
> - (cmp (file-name-completion (file-name-nondirectory name) dir)))
> - (and cmp (concat dir cmp))))
> + (completions (file-name-all-completions
> + (file-name-nondirectory name) dir))
> + (looking-at-candidate
> + (lambda (candidate)
> + (string-equal (buffer-substring
> + (point)
> + (min (+ (point) (length candidate))
> + (point-max)))
> + candidate)))
> + start)
> + (when (and completions (cdr completions))
> + (setq completions
> + (or (cl-remove-if-not looking-at-candidate
> + completions)
> + (and (setq start (car (bounds-of-thing-at-point 'symbol)))
> + (/= start (point))
> + (save-excursion
> + (goto-char start)
> + (cl-remove-if-not looking-at-candidate
> + completions))))))
> + (when completions
> + (concat dir (car completions)))))
>
> (defun ffap-home (name) (ffap-locate-file name t '("~")))
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#16648
; Package
emacs
.
(Wed, 26 Jun 2019 14:45:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 16648 <at> debbugs.gnu.org (full text, mbox):
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
> Also, this patch is more than 15 lines, so we need FSF copyright
> assignment papers before applying it. Would you be willing so sign such
> papers?
This was asked three years ago about a two year old patch, so I don't
think there's going to be any progress here, and I'm closing the bug
report.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
bug closed, send any further explanations to
16648 <at> debbugs.gnu.org and E Sabof <esabof <at> gmail.com>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Wed, 26 Jun 2019 14:46:01 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 25 Jul 2019 11:24:10 GMT)
Full text and
rfc822 format available.
This bug report was last modified 4 years and 275 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.