diff options
| author | Karl Heuer | 1997-12-19 14:54:55 +0000 |
|---|---|---|
| committer | Karl Heuer | 1997-12-19 14:54:55 +0000 |
| commit | eebbfb01172dea298ed9ac24acda07ed4827cca7 (patch) | |
| tree | ddebb29456c2469cab85d7a9337e6f4ae8ccef3b | |
| parent | 4d0e6a116760293be10a30f7301026476bc81d45 (diff) | |
| download | emacs-eebbfb01172dea298ed9ac24acda07ed4827cca7.tar.gz emacs-eebbfb01172dea298ed9ac24acda07ed4827cca7.zip | |
(Vread_buffer_function): New var.
(syms_of_minibuf): Set up Lisp var.
(Fread_buffer): Use Vread_buffer_function.
| -rw-r--r-- | src/minibuf.c | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/src/minibuf.c b/src/minibuf.c index b8c9f503af3..2465808211d 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -86,6 +86,9 @@ Lisp_Object Qread_file_name_internal; | |||
| 86 | Lisp_Object Qminibuffer_setup_hook, Vminibuffer_setup_hook; | 86 | Lisp_Object Qminibuffer_setup_hook, Vminibuffer_setup_hook; |
| 87 | Lisp_Object Qminibuffer_exit_hook, Vminibuffer_exit_hook; | 87 | Lisp_Object Qminibuffer_exit_hook, Vminibuffer_exit_hook; |
| 88 | 88 | ||
| 89 | /* Function to call to read a buffer name. */ | ||
| 90 | Lisp_Object Vread_buffer_function; | ||
| 91 | |||
| 89 | /* Nonzero means completion ignores case. */ | 92 | /* Nonzero means completion ignores case. */ |
| 90 | 93 | ||
| 91 | int completion_ignore_case; | 94 | int completion_ignore_case; |
| @@ -792,19 +795,32 @@ If optional third arg REQUIRE-MATCH is non-nil, only existing buffer names are a | |||
| 792 | Lisp_Object prompt, def, require_match; | 795 | Lisp_Object prompt, def, require_match; |
| 793 | { | 796 | { |
| 794 | Lisp_Object tem; | 797 | Lisp_Object tem; |
| 795 | Lisp_Object args[3]; | 798 | Lisp_Object args[4]; |
| 796 | 799 | ||
| 797 | if (BUFFERP (def)) | 800 | if (BUFFERP (def)) |
| 798 | def = XBUFFER (def)->name; | 801 | def = XBUFFER (def)->name; |
| 799 | if (!NILP (def)) | 802 | |
| 803 | if (NILP (Vread_buffer_function)) | ||
| 804 | { | ||
| 805 | if (!NILP (def)) | ||
| 806 | { | ||
| 807 | args[0] = build_string ("%s(default %s) "); | ||
| 808 | args[1] = prompt; | ||
| 809 | args[2] = def; | ||
| 810 | prompt = Fformat (3, args); | ||
| 811 | } | ||
| 812 | |||
| 813 | return Fcompleting_read (prompt, Vbuffer_alist, Qnil, | ||
| 814 | require_match, Qnil, Qnil, def, Qnil); | ||
| 815 | } | ||
| 816 | else | ||
| 800 | { | 817 | { |
| 801 | args[0] = build_string ("%s(default %s) "); | 818 | args[0] = Vread_buffer_function; |
| 802 | args[1] = prompt; | 819 | args[1] = prompt; |
| 803 | args[2] = def; | 820 | args[2] = def; |
| 804 | prompt = Fformat (3, args); | 821 | args[3] = require_match; |
| 822 | return Ffuncall(4, args); | ||
| 805 | } | 823 | } |
| 806 | return Fcompleting_read (prompt, Vbuffer_alist, Qnil, | ||
| 807 | require_match, Qnil, Qnil, def, Qnil); | ||
| 808 | } | 824 | } |
| 809 | 825 | ||
| 810 | DEFUN ("try-completion", Ftry_completion, Stry_completion, 2, 3, 0, | 826 | DEFUN ("try-completion", Ftry_completion, Stry_completion, 2, 3, 0, |
| @@ -1982,6 +1998,10 @@ syms_of_minibuf () | |||
| 1982 | Qactivate_input_method = intern ("activate-input-method"); | 1998 | Qactivate_input_method = intern ("activate-input-method"); |
| 1983 | staticpro (&Qactivate_input_method); | 1999 | staticpro (&Qactivate_input_method); |
| 1984 | 2000 | ||
| 2001 | DEFVAR_LISP ("read-buffer-function", &Vread_buffer_function, | ||
| 2002 | "If this is non-nil, `read-buffer' does its work by calling this function."); | ||
| 2003 | Vread_buffer_function = Qnil; | ||
| 2004 | |||
| 1985 | DEFVAR_LISP ("minibuffer-setup-hook", &Vminibuffer_setup_hook, | 2005 | DEFVAR_LISP ("minibuffer-setup-hook", &Vminibuffer_setup_hook, |
| 1986 | "Normal hook run just after entry to minibuffer."); | 2006 | "Normal hook run just after entry to minibuffer."); |
| 1987 | Vminibuffer_setup_hook = Qnil; | 2007 | Vminibuffer_setup_hook = Qnil; |