Commit graph

154 commits

Author SHA1 Message Date
João Távora
079b0dc430 Delete, don't kill, dir dir fragments in icomplete-fido-backward-updir
Reported by: Andrew Schwartzmeyer <andrew@schwartzmeyer.com>

* lisp/icomplete.el (icomplete-fido-backward-updir): Don't save
dir fragments to kill ring.
2020-06-13 18:46:03 +01:00
João Távora
3916e63f9e Have Fido mode also imitate Ido mode in ignore-case options
Suggested by Sean Whitton <spwhitton@spwhitton.name>.

* lisp/icomplete.el (icomplete--fido-mode-setup): Set ignore-case
options.
2020-06-05 23:38:21 +01:00
João Távora
145a151d62 Correct Fido-mode's backspacing of directories with spaces
Fixes: bug#40625

* lisp/icomplete.el (icomplete-fido-backward-updir): Use
zap-up-to-char.
2020-04-16 09:33:37 +01:00
João Távora
660b9b8cfb Default completion-flex-nospace to nil
By default, the flex completion style _does_ match spaces.

Fixes: bug#40625

* lisp/icomplete.el (icomplete--fido-mode-setup): Force
completion-flex-nospace to nil.

* lisp/minibuffer.el (completion-flex-nospace): Default to nil.
2020-04-15 18:43:09 +01:00
João Távora
fc47e3ad99 Let fido-mode users force a minibuffer-exit
* lisp/icomplete.el (icomplete-fido-exit):
Add FORCE arg.  Rewrite docstring. (bug#38992)
2020-03-07 13:59:50 +00:00
Dmitry Gutov
e734961d4c icomplete-fido-exit: New command for the M-j binding
* lisp/icomplete.el (icomplete-fido-exit): New command.
(icomplete-fido-mode-map): Use it (bug#38992).
2020-03-07 13:51:03 +00:00
Dmitry Gutov
335a9bd215 minibuffer-force-complete-and-exit: Allow input with no matches
* lisp/minibuffer.el (minibuffer--require-match): New variable.
(completing-read-default): Bind it to the REQUIRE-MATCH value.
(minibuffer-force-complete-and-exit): Consult it to allow input
with no matches when a match is not required (bug#38992).

* lisp/icomplete.el (icomplete-exhibit): Use it to render the
correct parens around matches.
2020-03-07 13:50:42 +00:00
João Távora
beec9f64a5 Add comment on fido-mode's file-sorting semantics
* lisp/icomplete.el (icomplete--sorted-completions): Add comment.
2020-01-09 10:08:44 +00:00
João Távora
eb3c6ad325 Consider non-string minibuffer-default in icomplete
Fixes: bug#38992

* lisp/icomplete.el (icomplete--sorted-completions): Consider
non-string minibuffer-default.
2020-01-09 10:08:43 +00:00
Paul Eggert
365e01cc9f Update copyright year to 2020
Run "TZ=UTC0 admin/update-copyright $(git ls-files)".
2020-01-01 00:59:52 +00:00
João Távora
195bde9ea8 Don't always resort in recently introduced icomplete--sorted-completions
Doing so breaks icomplete-forward-completions and
icomplete-backward-completions.

* lisp/icomplete.el (icomplete--sorted-completions): Don't always
resort.

(cherry picked from commit 639fb50ed4)
2019-12-31 13:31:45 +00:00
João Távora
f2a349ba8d Don't force completion recalculation in icomplete-fido-ret
Besides the adverse effect of delaying completions, it tripped up the
useful logic of icomplete-force-complete-and-exit in the case where a
default was available, but no completions calculated yet.

* lisp/icomplete.el (icomplete-fido-ret): Don't force calculation
of completions.

(cherry picked from commit 13778aa5be)
2019-12-31 13:31:45 +00:00
João Távora
9b1053ba27 Correctly cache sorted completions in icomplete--sorted-completions
* lisp/icomplete.el (icomplete--sorted-completions): Use
completion--cache-all-sorted-completions.

(cherry picked from commit 83587bb688)
2019-12-31 13:31:45 +00:00
João Távora
b1c3ed9f32 Move flex style's minibuffer-default-aware sorting to lisp/icomplete.el
This moves the logic from the series of commits starting in the commit named:

  Improve sorting of flex completion style with non-nil minibuffer-default

to lisp/icomplete.el, so far the only confirmed beneficiary of that
functionality.

* lisp/icomplete.el (icomplete--sorted-completions): Consider
minibuffer-default here.

* lisp/minibuffer.el (completion--flex-adjust-metadata): Simplify.

(cherry picked from commit 0d2a711dc9)
2019-12-31 13:31:45 +00:00
João Távora
e3276f36c0 Make fido-mode behave more like ido-mode when finding directories
Notably C-x d (M-x dired) and C-x v d (M-x vc-dir) behaved quite
differently, having regular files as the default instead of ido's
usual "./".

* lisp/icomplete.el (icomplete--sorted-completions): New helper.
(icomplete-completions): Use it.

(cherry picked from commit ee914051fb)
2019-12-31 13:31:45 +00:00
João Távora
fe0ed17175 Slightly simplify lisp/icomplete.el with new icomplete--category helper
* lisp/icomplete.el (icomplete-fido-kill)
(icomplete-fido-delete-char, icomplete-fido-ret)
(icomplete-fido-backward-updir, icomplete-exhibit): Use
icomplete--category.
(icomplete--category): New helper.

(cherry picked from commit 24a1f520f9)
2019-12-31 13:31:45 +00:00
Paul Eggert
b0f20651e3 ; Spelling fixes 2019-12-10 20:05:49 -08:00
João Távora
aa79f4e8c6 * lisp/icomplete.el (icomplete-fido-kill): Unbreak yes-or-no-p usage
Discussed in the context of bug#19064, bug#17272.
2019-11-19 23:55:54 +00:00
João Távora
7fea1a3f26 Make icomplete-tidy-shadowed-file-names less aggressive
When using this option and editing input, some transient situations
may arise that lead to file-name shadowing, but that shouldn't
necessarily lead to auto-delete behaviour, which will be suprising.

In '/foo/x/bar', if the user deletes the 'x', shadowing occurs, but
probably shouldn't.  So, somewhat like ido-mode, only auto-tidy
shadowed file names if the user is inserting text at end of input.

* lisp/icomplete.el (icomplete-exhibit): Check this-command.
(icomplete-tidy-shadowed-file-names): Tweak docstring.
2019-11-15 20:27:18 +00:00
João Távora
bf7debec3b Avoid fido-mode's setup on non-icomplete minibuffers
Otherwise we would lose things like C-r (isearch-backward) when doing
simple stuff like non-icomplete pp-eval-expression.

* lisp/icomplete.el (icomplete--fido-mode-setup): Restrict setup
to when icomplete-mode really kicks in.
2019-11-13 09:49:47 +00:00
Jimmy Aguilar Mena
e3043a73fb Add extra bindings to fido-mode.
* lisp/icomplete.el (icomplete-fido-mode-map) : Add arrows and other
bindings to reproduce ido behaviour.
2019-11-10 04:48:23 +01:00
João Távora
afe4969a3b Revert "Nudge icomplete-mode a little closer to fido-mode"
Fixes bug#38131.

This is not the best way to have fido-mdoe emulate that particular bit
of ido-mode.

This reverts commit 5761a1a393.
2019-11-09 14:55:42 +00:00
João Távora
5c74b806a6 Rename some commands to reflect they are fido-mode specific
* lisp/icomplete.el (icomplete-fido-kill)
(icomplete-fido-delete-char, icomplete-fido-ret)
(icomplete-fido-backward-updir): Rename from icomplete-magic-ido-*
versions.
(icomplete-fido-mode-map): Use new command names.
2019-11-09 14:55:42 +00:00
João Távora
5761a1a393 Nudge icomplete-mode a little closer to fido-mode
* lisp/icomplete.el (icomplete-completions): Don't use ellipsis when
truncating determ in fido-mode.  Highlight the center part of
determ with icomplete-first-match.
2019-11-08 10:18:33 +00:00
João Távora
213643a890 Document fido-mode
* doc/emacs/buffers.texi (Icomplete): Document Fido Mode.

* etc/NEWS: Mention Fido Mode.

* lisp/icomplete.el (icomplete-mode): Ensure fido-mode is off.
(fido-mode): Ensure icomplete-mode is off.
(icomplete-magic-ido-ret): Don't force completions if no
completions.
2019-11-05 22:59:33 +00:00
João Távora
e1d24f3c4c New fido-mode, emulates ido-mode with icomplete-mode
* lisp/icomplete.el (icomplete-fido-mode-map): New variable.
(icomplete--fido-mode-setup): New function.
(fido-mode): New global minor mode.
2019-11-05 22:59:33 +00:00
João Távora
6911ef3da6 Correct merge blunder in last icomplete commit
* lisp/icomplete.el (icomplete-exhibit): Use
while-no-input-ignore-events.
2019-11-02 11:10:04 +00:00
João Távora
730e7da7ba New icomplete-tidy-shadowed-file-names variable
* lisp/icomplete.el (rfn-eshadow): Require it.
(icomplete-tidy-shadowed-file-names): New variable.
(icomplete-exhibit): Use icomplete-tidy-shadowed-file-names.
2019-11-02 02:38:45 +00:00
João Távora
0bb97ad8b8 Fix icomplete-force-complete-and-exit for no-input situations
If there is no minibuffer input, but the user has already cycled some
pre-calculated completions, we should be calling
minibuffer-force-complete-and-exit instead of
minibuffer-complete-and-exit.  The former is guaranteed to be fast in
this situation and yields the desired "selected" completion, while the
latter will just give us the default, ignoring all the cycling of
icomplete-{forward|backward}-completions.

* lisp/icomplete.el (icomplete-force-complete-and-exit): Add
comments and fix for empty input but some completions calculated.
2019-11-02 02:35:45 +00:00
João Távora
88f193ed05 Improve fix for icomplete's backward-kill-word bug#38024
* lisp/icomplete.el (icomplete-exhibit): Use
while-no-input-ignore-events, not redisplay.

Co-authored-by: Stefan Monnier <j.schmoe@example.org>
2019-11-02 02:35:45 +00:00
João Távora
5860fd3123 Make icomplete-exhibit actually work when navigating up directories
Sometimes, when finding files with icomplete-mode, backward-deleting
the previous word or sexp (to move up a directory) doesn't actually
refresh the file list of the new directory.  Forcing redisplay in
icomplete-exhibit misteriously fixes the problem.

* lisp/icomplete.el (icomplete-exhibit): Add call to redisplay.
2019-10-29 00:19:33 +00:00
João Távora
7373d6eae8 New commands for making icomplete behave more like ido
This tries (not particularly hard) to emulate Ido's magic C-k, C-d,
RET and DEL.  For now, the new commands have to be explicitly added to
an active map by the user, using something like this:

(let ((imap icomplete-minibuffer-map))
  (define-key imap (kbd "C-k") 'icomplete-magic-ido-kill)
  (define-key imap (kbd "C-d") 'icomplete-magic-ido-delete-char)
  (define-key imap (kbd "RET") 'icomplete-magic-ido-ret)
  (define-key imap (kbd "DEL") 'icomplete-magic-ido-backward-updir))

* lisp/icomplete.el (icomplete-magic-ido-kill)
(icomplete-magic-ido-delete-char, icomplete-magic-ido-ret)
(icomplete-magic-ido-backward-updir): New commands.
2019-10-29 00:19:33 +00:00
João Távora
1b687e171e Optimize lisp/icomplete.el when default completion available
Often, when using icomplete with icomplete-show-matches-on-no-input
and commands like C-h f, icomplete-exhibit will take a long time (like
several seconds) to show all the completions.

However, if there is a non-nil default value, like when the C-h f is
performed exactly on a function name, the minibuffer prompt will
reflect that immediately.  If the user immediately presses RE
(icomplete-force-complete-and-exit) we take that to mean "use the
default" and avoid the long wait.

As an extra performance tweak, this commit also removes an unneeded
call to icomplete-exhibit in icomplete-minibuffer-setup.

* lisp/icomplete.el (icomplete-force-complete-and-exit): Short-circuit
possibility of non-nil minibuffer-default.
(icomplete-minibuffer-setup): No need to explicitly icomplete-exhibit
here since icomplete-post-command-hook will call it unconditionally.
2019-10-27 13:21:22 +00:00
Paul Eggert
797ee5871e Remove Maintainer: when it duplicates Author:
The convention is that a file with Author: but not Maintainer:
means the author is a maintainer, which makes it confusing
when a file lists the same person as author and maintainer.
Avoid the confusion by removing the duplicate Maintainer: line.
2019-05-26 01:00:15 -07:00
Paul Eggert
bef1be8730 Fixes for "Maintainer:" and related lines
Mostly, this just removes "Maintainer: emacs-devel@gnu.org" lines,
which are not that useful.  It also cleans up and regularizes a
few similar lines.
2019-05-19 21:34:27 -07:00
Stefan Monnier
42732e2f8d Rework last commit to icomplete and minibuffer.el.
Rather than let minibuffer-force-complete set up cycling and then undoing it,
better tell it directly not to setup cycling.  Also be a bit more careful
to remove the transient map.
Additionally to bug#34077 and bug#34116, this also relates to bug#25644.

* lisp/minibuffer.el (completion--flush-all-sorted-completions):
Also take down the transient cycling map if applicable.
(minibuffer-force-complete): New arg dont-cycle.
Set completion-cycling to the actual function that takes down the
transient map rather than just t.
(minibuffer-force-complete-and-exit):
* lisp/icomplete.el (icomplete-force-complete): Use new dont-cycle arg.
2019-01-23 12:30:54 -05:00
João Távora
b9add0a5a7 Force completion in icomplete with C-M-i, but don't cycle (bug#34077)
Cycling after forcing a completion with C-M-i in icomplete can be
confusing, as it leaves rotated prospects in the minibuffer.  In C-x
C-f, for example it is very difficult to understand if the prospects
refer to subdirectories of the directory being completed to, which
happens naturally when the completion is unique; or if they are a
cycled version of prospects that match the new completion pattern, in
case the completion happens to still match other items.

To resolve this confusion, never cycle with C-M-i in icomplete:
non-ambiguous cycling can be achieved with C-. and C-,

The former behaviour can still be restored with:

(define-key icomplete-minibuffer-map (kbd "C-M-i") 'minibuffer-force-complete)

* lisp/icomplete.el (icomplete-force-complete): New command.
(icomplete-minibuffer-map): Bind C-M-i to icomplete-force-complete.
2019-01-23 16:31:11 +00:00
João Távora
5a6df06494 Simplify ignored extensions filtering in Icomplete (bug#34070)
* lisp/icomplete.el: Use lexical binding.
(icomplete-completions): Use minibuffer-completion-predicate
to filter out completion-ignored-extensions.
2019-01-17 15:17:02 +00:00
João Távora
7560ef7de9 Revert "Fix icomplete's cycling when filename filtering kicks in"
This reverts commit cdb082322d, which
was a fix for bug#34070.  A much better fix to be added soon.
2019-01-17 15:11:36 +00:00
João Távora
cdb082322d Fix icomplete's cycling when filename filtering kicks in
Fixes: bug#34070

* lisp/icomplete.el (icomplete--filtered-completions): New variable.
(icomplete-forward-completions, icomplete-backward-completions):
Use it.
(icomplete-completions): Set it.
2019-01-14 19:05:20 +00:00
Paul Eggert
ba809612c0 Merge from origin/emacs-26
2fcf2df Fix copyright years by hand
26bed8b Update copyright year to 2019
2814292 Fix value of default frame height.  (Bug#33921)
2018-12-31 17:57:29 -08:00
Paul Eggert
26bed8ba10 Update copyright year to 2019
Run 'TZ=UTC0 admin/update-copyright $(git ls-files)'.
2019-01-01 01:01:13 +00:00
John Shahid
ee3e432300 Optionally add argument description in minor mode DOC (bug#10754)
Add a paragraph to minor mode's docstring documenting the mode's ARG
usage if the supplied docstring doesn't already contain the word "ARG".

* easy-mmode.el (easy-mmode--arg-docstring): New const.
(easy-mmode--arg-docstring): New function.
(define-minor-mode): Use them.

Remove argument documentation from all minor modes.
2018-07-01 23:34:53 -04:00
Paul Eggert
5c7dd8a783 Update copyright year to 2018
Run admin/update-copyright.
2018-01-01 00:57:59 -08:00
Paul Eggert
bc511a64f6 Prefer HTTPS to FTP and HTTP in documentation
Most of this change is to boilerplate commentary such as license URLs.
This change was prompted by ftp://ftp.gnu.org's going-away party,
planned for November.  Change these FTP URLs to https://ftp.gnu.org
instead.  Make similar changes for URLs to other organizations moving
away from FTP.  Also, change HTTP to HTTPS for URLs to gnu.org and
fsf.org when this works, as this will further help defend against
man-in-the-middle attacks (for this part I omitted the MS-DOS and
MS-Windows sources and the test tarballs to keep the workload down).
HTTPS is not fully working to lists.gnu.org so I left those URLs alone
for now.
2017-09-13 15:54:37 -07:00
Noam Postavsky
5647c4a2c6 Give a fixed default value for icomplete-prospects-height (Bug#26939)
* lisp/icomplete.el (icomplete-prospects-height): Default to 2.
(icomplete-prospects-length): Remove.
* etc/NEWS: Announce removal.
2017-06-14 07:03:05 -04:00
Paul Eggert
bcf244ef9b Merge from origin/emacs-25
2e2a806 Fix copyright years by hand
5badc81 Update copyright year to 2017
2017-01-01 01:10:47 -08:00
Paul Eggert
5badc81c1c Update copyright year to 2017
Run admin/update-copyright.
2016-12-31 19:42:26 -08:00
Drew Adams
65797b1d75 Make icomplete respect `completion-ignored-extensions'
* lisp/icomplete.el (icomplete-completions): Heed
`completion-ignored-extensions' (bug#12939).
2016-04-28 19:31:43 +02:00
Paul Eggert
0e963201d0 Update copyright year to 2016
Run admin/update-copyright.
2016-01-01 01:34:24 -08:00