diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/minibuf.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/minibuf.c b/src/minibuf.c index eeaad5583e6..4b5185abdb1 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -318,6 +318,17 @@ read_minibuf_noninteractive (map, initial, prompt, backup_n, expflag, | |||
| 318 | return val; | 318 | return val; |
| 319 | } | 319 | } |
| 320 | 320 | ||
| 321 | DEFUN ("minibufferp", Fminibufferp, | ||
| 322 | Sminibufferp, 0, 0, 0, | ||
| 323 | doc: /* Return t if the current buffer is a minibuffer. */) | ||
| 324 | () | ||
| 325 | { | ||
| 326 | Lisp_Object tem; | ||
| 327 | |||
| 328 | tem = Fmemq (Fcurrent_buffer (), Vminibuffer_list); | ||
| 329 | return ! NILP (tem) ? Qt : Qnil; | ||
| 330 | } | ||
| 331 | |||
| 321 | DEFUN ("minibuffer-prompt-end", Fminibuffer_prompt_end, | 332 | DEFUN ("minibuffer-prompt-end", Fminibuffer_prompt_end, |
| 322 | Sminibuffer_prompt_end, 0, 0, 0, | 333 | Sminibuffer_prompt_end, 0, 0, 0, |
| 323 | doc: /* Return the buffer position of the end of the minibuffer prompt. | 334 | doc: /* Return the buffer position of the end of the minibuffer prompt. |
| @@ -325,8 +336,14 @@ Return (point-min) if current buffer is not a mini-buffer. */) | |||
| 325 | () | 336 | () |
| 326 | { | 337 | { |
| 327 | /* This function is written to be most efficient when there's a prompt. */ | 338 | /* This function is written to be most efficient when there's a prompt. */ |
| 328 | Lisp_Object beg = make_number (BEGV); | 339 | Lisp_Object beg, end, tem; |
| 329 | Lisp_Object end = Ffield_end (beg, Qnil, Qnil); | 340 | beg = make_number (BEGV); |
| 341 | |||
| 342 | tem = Fmemq (Fcurrent_buffer (), Vminibuffer_list); | ||
| 343 | if (NILP (tem)) | ||
| 344 | return beg; | ||
| 345 | |||
| 346 | end = Ffield_end (beg, Qnil, Qnil); | ||
| 330 | 347 | ||
| 331 | if (XINT (end) == ZV && NILP (Fget_char_property (beg, Qfield, Qnil))) | 348 | if (XINT (end) == ZV && NILP (Fget_char_property (beg, Qfield, Qnil))) |
| 332 | return beg; | 349 | return beg; |
| @@ -2581,6 +2598,7 @@ properties. */); | |||
| 2581 | defsubr (&Sminibuffer_depth); | 2598 | defsubr (&Sminibuffer_depth); |
| 2582 | defsubr (&Sminibuffer_prompt); | 2599 | defsubr (&Sminibuffer_prompt); |
| 2583 | 2600 | ||
| 2601 | defsubr (&Sminibufferp); | ||
| 2584 | defsubr (&Sminibuffer_prompt_end); | 2602 | defsubr (&Sminibuffer_prompt_end); |
| 2585 | defsubr (&Sminibuffer_contents); | 2603 | defsubr (&Sminibuffer_contents); |
| 2586 | defsubr (&Sminibuffer_contents_no_properties); | 2604 | defsubr (&Sminibuffer_contents_no_properties); |