diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/minibuf.c | 32 |
2 files changed, 30 insertions, 8 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 4a27cac6fb9..d0b52872983 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2005-10-16 Masatake YAMATO <jet@gyve.org> | ||
| 2 | |||
| 3 | * minibuf.c (Fdisplay_completion_list): Add new optional | ||
| 4 | argument COMMON_SUBSTRING. Bind `completion-common-substring' | ||
| 5 | to the optional argument during running `completion-setup-hook'. | ||
| 6 | |||
| 1 | 2005-10-16 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | 7 | 2005-10-16 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> |
| 2 | 8 | ||
| 3 | * mac.c [TARGET_API_MAC_CARBON] (get_cfstring_encoding_from_lisp): | 9 | * mac.c [TARGET_API_MAC_CARBON] (get_cfstring_encoding_from_lisp): |
diff --git a/src/minibuf.c b/src/minibuf.c index 28789b60bde..d7ef048c138 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -2351,7 +2351,7 @@ Return nil if there is no valid completion, else t. */) | |||
| 2351 | } | 2351 | } |
| 2352 | 2352 | ||
| 2353 | DEFUN ("display-completion-list", Fdisplay_completion_list, Sdisplay_completion_list, | 2353 | DEFUN ("display-completion-list", Fdisplay_completion_list, Sdisplay_completion_list, |
| 2354 | 1, 1, 0, | 2354 | 1, 2, 0, |
| 2355 | doc: /* Display the list of completions, COMPLETIONS, using `standard-output'. | 2355 | doc: /* Display the list of completions, COMPLETIONS, using `standard-output'. |
| 2356 | Each element may be just a symbol or string | 2356 | Each element may be just a symbol or string |
| 2357 | or may be a list of two strings to be printed as if concatenated. | 2357 | or may be a list of two strings to be printed as if concatenated. |
| @@ -2361,14 +2361,23 @@ alternative, the second serves as annotation. | |||
| 2361 | The actual completion alternatives, as inserted, are given `mouse-face' | 2361 | The actual completion alternatives, as inserted, are given `mouse-face' |
| 2362 | properties of `highlight'. | 2362 | properties of `highlight'. |
| 2363 | At the end, this runs the normal hook `completion-setup-hook'. | 2363 | At the end, this runs the normal hook `completion-setup-hook'. |
| 2364 | It can find the completion buffer in `standard-output'. */) | 2364 | It can find the completion buffer in `standard-output'. |
| 2365 | (completions) | 2365 | The optional second arg COMMON-SUBSTRING is a string. |
| 2366 | It is used to put faces, `completions-first-difference` and | ||
| 2367 | `completions-common-part' on the completion bufffer. The | ||
| 2368 | `completions-common-part' face is put on the common substring | ||
| 2369 | specified by COMMON-SUBSTRING. If COMMON-SUBSTRING is nil, | ||
| 2370 | the faces are not put. | ||
| 2371 | Internally, COMMON-SUBSTRING is bound to `completion-common-substring' | ||
| 2372 | during running `completion-setup-hook'. */) | ||
| 2373 | (completions, common_substring) | ||
| 2366 | Lisp_Object completions; | 2374 | Lisp_Object completions; |
| 2375 | Lisp_Object common_substring; | ||
| 2367 | { | 2376 | { |
| 2368 | Lisp_Object tail, elt; | 2377 | Lisp_Object tail, elt; |
| 2369 | register int i; | 2378 | register int i; |
| 2370 | int column = 0; | 2379 | int column = 0; |
| 2371 | struct gcpro gcpro1, gcpro2; | 2380 | struct gcpro gcpro1, gcpro2, gcpro3; |
| 2372 | struct buffer *old = current_buffer; | 2381 | struct buffer *old = current_buffer; |
| 2373 | int first = 1; | 2382 | int first = 1; |
| 2374 | 2383 | ||
| @@ -2377,7 +2386,7 @@ It can find the completion buffer in `standard-output'. */) | |||
| 2377 | except for ELT. ELT can be pointing to a string | 2386 | except for ELT. ELT can be pointing to a string |
| 2378 | when terpri or Findent_to calls a change hook. */ | 2387 | when terpri or Findent_to calls a change hook. */ |
| 2379 | elt = Qnil; | 2388 | elt = Qnil; |
| 2380 | GCPRO2 (completions, elt); | 2389 | GCPRO3 (completions, elt, common_substring); |
| 2381 | 2390 | ||
| 2382 | if (BUFFERP (Vstandard_output)) | 2391 | if (BUFFERP (Vstandard_output)) |
| 2383 | set_buffer_internal (XBUFFER (Vstandard_output)); | 2392 | set_buffer_internal (XBUFFER (Vstandard_output)); |
| @@ -2526,13 +2535,20 @@ It can find the completion buffer in `standard-output'. */) | |||
| 2526 | } | 2535 | } |
| 2527 | } | 2536 | } |
| 2528 | 2537 | ||
| 2529 | UNGCPRO; | ||
| 2530 | |||
| 2531 | if (BUFFERP (Vstandard_output)) | 2538 | if (BUFFERP (Vstandard_output)) |
| 2532 | set_buffer_internal (old); | 2539 | set_buffer_internal (old); |
| 2533 | 2540 | ||
| 2534 | if (!NILP (Vrun_hooks)) | 2541 | if (!NILP (Vrun_hooks)) |
| 2535 | call1 (Vrun_hooks, intern ("completion-setup-hook")); | 2542 | { |
| 2543 | int count1 = SPECPDL_INDEX (); | ||
| 2544 | |||
| 2545 | specbind (intern ("completion-common-substring"), common_substring); | ||
| 2546 | call1 (Vrun_hooks, intern ("completion-setup-hook")); | ||
| 2547 | |||
| 2548 | unbind_to (count1, Qnil); | ||
| 2549 | } | ||
| 2550 | |||
| 2551 | UNGCPRO; | ||
| 2536 | 2552 | ||
| 2537 | return Qnil; | 2553 | return Qnil; |
| 2538 | } | 2554 | } |