aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2009-12-06 01:25:41 +0000
committerStefan Monnier2009-12-06 01:25:41 +0000
commit365b9a62960f67ae00d2ff2b987fbca23004dea3 (patch)
treeb81f3da6f453ab71fcc26c53f59615b59496a419
parent3e38b2bd429a04c577d42a0e08ee02e2eed318ff (diff)
downloademacs-365b9a62960f67ae00d2ff2b987fbca23004dea3.tar.gz
emacs-365b9a62960f67ae00d2ff2b987fbca23004dea3.zip
(minibuffer-complete-and-exit): Don't replace the
minibuffer's content with itself. Fold the confirm-after-completion case into the `confirm' case. (completion-pcm-word-delimiters): Add : and / to the delimiters.
-rw-r--r--lisp/ChangeLog18
-rw-r--r--lisp/minibuffer.el56
2 files changed, 50 insertions, 24 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e98993cb132..4c32fc87f98 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12009-12-06 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * minibuffer.el (minibuffer-complete-and-exit): Don't replace the
4 minibuffer's content with itself.
5 Fold the confirm-after-completion case into the `confirm' case.
6 (completion-pcm-word-delimiters): Add : and / to the delimiters.
7
12009-12-06 Kevin Ryde <user42@zip.com.au> 82009-12-06 Kevin Ryde <user42@zip.com.au>
2 9
3 * ffap.el (ffap-rfc-path): Make this a defcustom since 10 * ffap.el (ffap-rfc-path): Make this a defcustom since
@@ -22,8 +29,8 @@
22 * bindings.el (complete-symbol): Call semantic-ia-complete-symbol 29 * bindings.el (complete-symbol): Call semantic-ia-complete-symbol
23 if possible. 30 if possible.
24 31
25 * cedet/semantic/ia.el (semantic-ia-complete-symbol): Make 32 * cedet/semantic/ia.el (semantic-ia-complete-symbol):
26 argument optional. 33 Make argument optional.
27 34
28 * shell.el (shell): Require ansi-color (Bug#5113). 35 * shell.el (shell): Require ansi-color (Bug#5113).
29 36
@@ -82,12 +89,11 @@
82 (bibtex-field-braces-alist, bibtex-field-strings-alist) 89 (bibtex-field-braces-alist, bibtex-field-strings-alist)
83 (bibtex-field-re-init): Replace only space characters by regexp 90 (bibtex-field-re-init): Replace only space characters by regexp
84 for whitespace. 91 for whitespace.
85 (bibtex-generate-url-list, bibtex-cite-matcher-alist): Fix 92 (bibtex-generate-url-list, bibtex-cite-matcher-alist): Fix docstring.
86 docstring.
87 (bibtex-initialize): Also update bibtex-strings. 93 (bibtex-initialize): Also update bibtex-strings.
88 (bibtex-kill-field): Preserve white space at end of entry. 94 (bibtex-kill-field): Preserve white space at end of entry.
89 (bibtex-kill-entry, bibtex-yank-pop, bibtex-insert-kill): Update 95 (bibtex-kill-entry, bibtex-yank-pop, bibtex-insert-kill):
90 bibtex-reference-keys. 96 Update bibtex-reference-keys.
91 97
922009-12-05 Stefan Monnier <monnier@iro.umontreal.ca> 982009-12-05 Stefan Monnier <monnier@iro.umontreal.ca>
93 99
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index b850cef1ed9..62a0157c352 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -57,7 +57,25 @@
57 57
58;;; Todo: 58;;; Todo:
59 59
60;; - make partial-complete-mode obsolete: 60;; - extend `boundaries' to provide various other meta-data about the
61;; output of `all-completions':
62;; - quoting/unquoting (so we can complete files names with envvars
63;; and backslashes, and all-completion can list names without
64;; quoting backslashes and dollars).
65;; - indicate how to turn all-completion's output into
66;; try-completion's output: e.g. completion-ignored-extensions.
67;; maybe that could be merged with the "quote" operation above.
68;; - completion hook to run when the completion is
69;; selected/inserted (maybe this should be provided some other
70;; way, e.g. as text-property, so `try-completion can also return it?)
71;; both for when it's inserted via TAB or via choose-completion.
72;; - indicate that `all-completions' doesn't do prefix-completion
73;; but just returns some list that relates in some other way to
74;; the provided string (as is the case in filecache.el), in which
75;; case partial-completion (for example) doesn't make any sense
76;; and neither does the completions-first-difference highlight.
77
78;; - make partial-completion-mode obsolete:
61;; - (?) <foo.h> style completion for file names. 79;; - (?) <foo.h> style completion for file names.
62;; This can't be done identically just by tweaking completion, 80;; This can't be done identically just by tweaking completion,
63;; because partial-completion-mode's behavior is to expand <string.h> 81;; because partial-completion-mode's behavior is to expand <string.h>
@@ -414,8 +432,8 @@ Only the elements of table that satisfy predicate PRED are considered.
414POINT is the position of point within STRING. 432POINT is the position of point within STRING.
415The return value is a list of completions and may contain the base-size 433The return value is a list of completions and may contain the base-size
416in the last `cdr'." 434in the last `cdr'."
417 ;; FIXME: We need to additionally return completion-extra-size (similar 435 ;; FIXME: We need to additionally return the info needed for the
418 ;; to completion-base-size but for the text after point). 436 ;; second part of completion-base-position.
419 (completion--some (lambda (style) 437 (completion--some (lambda (style)
420 (funcall (nth 2 (assq style completion-styles-alist)) 438 (funcall (nth 2 (assq style completion-styles-alist))
421 string table pred point)) 439 string table pred point))
@@ -626,6 +644,12 @@ If `minibuffer-completion-confirm' is `confirm-after-completion',
626 ((test-completion (buffer-substring beg end) 644 ((test-completion (buffer-substring beg end)
627 minibuffer-completion-table 645 minibuffer-completion-table
628 minibuffer-completion-predicate) 646 minibuffer-completion-predicate)
647 ;; FIXME: completion-ignore-case has various slightly
648 ;; incompatible meanings. E.g. it can reflect whether the user
649 ;; wants completion to pay attention to case, or whether the
650 ;; string will be used in a context where case is significant.
651 ;; E.g. usually try-completion should obey the first, whereas
652 ;; test-completion should obey the second.
629 (when completion-ignore-case 653 (when completion-ignore-case
630 ;; Fixup case of the field, if necessary. 654 ;; Fixup case of the field, if necessary.
631 (let* ((string (buffer-substring beg end)) 655 (let* ((string (buffer-substring beg end))
@@ -633,7 +657,7 @@ If `minibuffer-completion-confirm' is `confirm-after-completion',
633 string 657 string
634 minibuffer-completion-table 658 minibuffer-completion-table
635 minibuffer-completion-predicate))) 659 minibuffer-completion-predicate)))
636 (when (and (stringp compl) 660 (when (and (stringp compl) (not (equal string compl))
637 ;; If it weren't for this piece of paranoia, I'd replace 661 ;; If it weren't for this piece of paranoia, I'd replace
638 ;; the whole thing with a call to do-completion. 662 ;; the whole thing with a call to do-completion.
639 ;; This is important, e.g. when the current minibuffer's 663 ;; This is important, e.g. when the current minibuffer's
@@ -646,22 +670,19 @@ If `minibuffer-completion-confirm' is `confirm-after-completion',
646 (delete-region beg end)))) 670 (delete-region beg end))))
647 (exit-minibuffer)) 671 (exit-minibuffer))
648 672
649 ((eq minibuffer-completion-confirm 'confirm) 673 ((memq minibuffer-completion-confirm '(confirm confirm-after-completion))
650 ;; The user is permitted to exit with an input that's rejected 674 ;; The user is permitted to exit with an input that's rejected
651 ;; by test-completion, after confirming her choice. 675 ;; by test-completion, after confirming her choice.
652 (if (eq last-command this-command) 676 (if (or (eq last-command this-command)
677 ;; For `confirm-after-completion' we only ask for confirmation
678 ;; if trying to exit immediately after typing TAB (this
679 ;; catches most minibuffer typos).
680 (and (eq minibuffer-completion-confirm 'confirm-after-completion)
681 (not (memq last-command minibuffer-confirm-exit-commands))))
653 (exit-minibuffer) 682 (exit-minibuffer)
654 (minibuffer-message "Confirm") 683 (minibuffer-message "Confirm")
655 nil)) 684 nil))
656 685
657 ((eq minibuffer-completion-confirm 'confirm-after-completion)
658 ;; Similar to the above, but only if trying to exit immediately
659 ;; after typing TAB (this catches most minibuffer typos).
660 (if (memq last-command minibuffer-confirm-exit-commands)
661 (progn (minibuffer-message "Confirm")
662 nil)
663 (exit-minibuffer)))
664
665 (t 686 (t
666 ;; Call do-completion, but ignore errors. 687 ;; Call do-completion, but ignore errors.
667 (case (condition-case nil 688 (case (condition-case nil
@@ -1080,9 +1101,6 @@ and PREDICATE, either by calling NEXT-FUN or by doing it themselves.")
1080 "Complete the text between START and END using COLLECTION. 1101 "Complete the text between START and END using COLLECTION.
1081Return nil if there is no valid completion, else t. 1102Return nil if there is no valid completion, else t.
1082Point needs to be somewhere between START and END." 1103Point needs to be somewhere between START and END."
1083 ;; FIXME: some callers need to setup completion-ignore-case,
1084 ;; completion-ignored-extensions. The latter can be embedded in the
1085 ;; completion tables, but the first cannot (actually, maybe it should).
1086 (assert (<= start (point)) (<= (point) end)) 1104 (assert (<= start (point)) (<= (point) end))
1087 ;; FIXME: undisplay the *Completions* buffer once the completion is done. 1105 ;; FIXME: undisplay the *Completions* buffer once the completion is done.
1088 (with-wrapper-hook 1106 (with-wrapper-hook
@@ -1247,6 +1265,8 @@ except that it passes the file name through `substitute-in-file-name'."
1247 ;; substitute-in-file-name turns "fo-$TO-ba" into "fo-o/b-ba", there's 1265 ;; substitute-in-file-name turns "fo-$TO-ba" into "fo-o/b-ba", there's
1248 ;; no way for us to return proper boundaries info, because the 1266 ;; no way for us to return proper boundaries info, because the
1249 ;; boundary is not (yet) in `string'. 1267 ;; boundary is not (yet) in `string'.
1268 ;; FIXME: Actually there is a way to return correct boundaries info,
1269 ;; at the condition of modifying the all-completions return accordingly.
1250 (let ((start (length (file-name-directory string))) 1270 (let ((start (length (file-name-directory string)))
1251 (end (string-match-p "/" (cdr action)))) 1271 (end (string-match-p "/" (cdr action))))
1252 (list* 'boundaries start end))) 1272 (list* 'boundaries start end)))
@@ -1644,7 +1664,7 @@ from lowercase to uppercase characters).")
1644(defun completion-pcm--prepare-delim-re (delims) 1664(defun completion-pcm--prepare-delim-re (delims)
1645 (setq completion-pcm--delim-wild-regex (concat "[" delims "*]"))) 1665 (setq completion-pcm--delim-wild-regex (concat "[" delims "*]")))
1646 1666
1647(defcustom completion-pcm-word-delimiters "-_. " 1667(defcustom completion-pcm-word-delimiters "-_./: "
1648 "A string of characters treated as word delimiters for completion. 1668 "A string of characters treated as word delimiters for completion.
1649Some arcane rules: 1669Some arcane rules:
1650If `]' is in this string, it must come first. 1670If `]' is in this string, it must come first.