Commit graph

167 commits

Author SHA1 Message Date
Paul Eggert
ba05d005e5 Update copyright year to 2021
Run "TZ=UTC0 admin/update-copyright".
2021-01-01 01:13:56 -08:00
Juri Linkov
dc6e616dfe Don't show matches with no input for nil icomplete-show-matches-on-no-input
* lisp/icomplete.el (icomplete-show-matches-on-no-input): Fix docstring.
(icomplete--initial-input): New internal variable.
(icomplete-minibuffer-setup): Set buffer-local
icomplete--initial-input to icomplete--field-string.
(icomplete-ret, icomplete-force-complete-and-exit)
(icomplete--sorted-completions, icomplete-exhibit):
Compare icomplete--initial-input with icomplete--field-string
to detect no input.  (Bug#19031)

etc/NEWS: Remove duplicate entry.
2020-12-14 10:44:04 +02:00
Stefan Kangas
c50c0a19e3 Prefer setq-local in most files
* lisp/apropos.el (apropos-print):
* lisp/buff-menu.el (Buffer-menu-mode):
* lisp/calc/calc.el (calc-trail-buffer):
* lisp/chistory.el (command-history-mode):
* lisp/dabbrev.el:
* lisp/dframe.el (dframe-frame-mode):
* lisp/doc-view.el (doc-view-presentation-mode):
* lisp/ebuff-menu.el (electric-buffer-menu-mode)
(electric-buffer-update-highlight):
* lisp/edmacro.el (edit-kbd-macro):
* lisp/face-remap.el (buffer-face-set, buffer-face-toggle):
* lisp/files.el:
(find-file-noselect-1, hack-local-variables-confirm)
(set-visited-file-name, revert-buffer--default):
* lisp/filesets.el (filesets-spawn-external-viewer):
* lisp/find-dired.el (find-dired):
* lisp/find-lisp.el (find-lisp-find-dired-internal):
* lisp/finder.el (finder-mode):
* lisp/font-core.el (font-lock-default-function):
* lisp/format.el (format-annotate-function):
* lisp/help-fns.el (describe-variable):
* lisp/help-mode.el (help-mode):
* lisp/icomplete.el (icomplete-minibuffer-setup)
(icomplete--in-region-setup):
* lisp/ido.el (ido-completion-help, ido-tidy):
* lisp/international/robin.el (robin-activate):
* lisp/leim/quail/hangul.el (hangul-input-method-activate):
* lisp/leim/quail/uni-input.el (ucs-input-activate):
* lisp/man.el (Man-mode):
* lisp/master.el (master-set-slave):
* lisp/minibuffer.el (minibuffer-completion-help)
(read-file-name-default):
* lisp/outline.el (outline-minor-mode):
* lisp/pcomplete.el (pcomplete-comint-setup):
* lisp/proced.el (proced-mode):
* lisp/recentf.el (recentf-edit-list, recentf-open-files-items):
* lisp/replace.el (occur-1):
* lisp/reveal.el (reveal-mode):
* lisp/ruler-mode.el (ruler--save-header-line-format):
* lisp/scroll-lock.el (scroll-lock-mode):
* lisp/startup.el (normal-top-level, normal-splash-screen):
* lisp/strokes.el (strokes-list-strokes):
* lisp/thumbs.el (thumbs-insert-image, thumbs-show-thumbs-list):
* lisp/tree-widget.el (tree-widget-set-theme):
* lisp/window.el (read-buffer-to-switch):
* lisp/xwidget.el (xwidget-webkit-begin-edit-textarea): Prefer
setq-local.
2020-12-09 11:58:38 +01:00
Lars Ingebrigtsen
3568ff084c Clarify icomplete-show-matches-on-no-input doc string
* lisp/icomplete.el (icomplete-show-matches-on-no-input): Clarify
doc string (bug#19031), suggested by Andrii Kolomoiets.
2020-12-07 13:37:44 +01:00
Lars Ingebrigtsen
de7a741c7b Revert "Clarify icomplete-show-matches-on-no-input doc string"
This reverts commit f352c57972.

The new explanation of what icomplete does is wrong.
2020-12-07 13:37:44 +01:00
Lars Ingebrigtsen
f352c57972 Clarify icomplete-show-matches-on-no-input doc string
* lisp/icomplete.el (icomplete-show-matches-on-no-input): Clarify
the meaning of the variable (bug#19031).
2020-12-04 12:15:29 +01:00
João Távora
dd25055829 Fix up fix for bug#19032
* lisp/icomplete.el (icomplete-ret): Call
minibuffer-icomplete-and-exit, not minibuffer-exit.
2020-09-09 20:12:45 +01:00
João Távora
0fb5425442 Change icomplete-show-matches-on-no-input behaviour for Icomplete only
Fixes: bug#19032, bug#43120

Previous fixes to bug#19032 introduced bugs in Fido mode.  This fix
relies on a new command bound to RET.

* etc/NEWS (Miscellaneous): Mention icomplete-show-matches-on-no-input.

* lisp/icomplete.el (icomplete-show-matches-on-no-input): Add comment.
(icomplete-minibuffer-map): Rebind minibuffer-complete-and-exit to
icomplete-ret.
(icomplete-ret): New command.
2020-09-08 09:47:48 +01:00
João Távora
627e9c191e Revert two commits for bug#19032
This reverts:

- commit 585fe00557, which is titled
  "Fix up previous icomplete-show-matches-on-no-input change"

- commit 1b8d369c38, which is titled
  "Change icomplete-show-matches-on-no-input behavior".

A simpler, less intrusive fix follows shortly after this commit.
2020-09-08 09:47:34 +01:00
João Távora
c8472cc69d Better explain behaviour of icomplete--sorted-completions
* lisp/icomplete.el (icomplete--sorted-completions): Overhaul comment
2020-09-07 10:53:01 +01:00
João Távora
6fc502c1ef Don't resort Icomplete candidates when default already on top
Fixes: bug#43222

Icomplete mode re-sorts candidates, bubbling the default to top if
it's found somewhere down the list.  This is done according to two
criteria: exact match and prefix match.  Before this fix, it didn't
take into account the possibility that the exact match for the default
would already be on top, and would incorrectly bubble a prefixing
completion down the list to the top.  This commit fixes that.

* lisp/icomplete.el (icomplete--sorted-completions):
Rework. Recomment.
2020-09-06 08:36:39 +01:00
Lars Ingebrigtsen
585fe00557 Fix up previous icomplete-show-matches-on-no-input change
* lisp/icomplete.el (icomplete-completions): Ensure that the
default value is cleared (bug#43120).
2020-09-05 23:11:43 +02:00
Lars Ingebrigtsen
1b8d369c38 Change icomplete-show-matches-on-no-input behavior
* lisp/icomplete.el (icomplete-show-matches-on-no-input): Doc fix.
(icomplete-completions): Set completion-content-when-empty.

* lisp/minibuffer.el (completion-content-when-empty): New variable.
(completion--complete-and-exit): Use it (bug#19032).

Based on a patch by Matthew Leach <matthew@mattleach.net>.
2020-08-14 13:29:59 +02:00
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