1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-29 11:02:01 +00:00

* lisp/simple.el (read-expression-map): Use completion-at-point.

Move the declaration from C.
(read-minibuffer, eval-minibuffer): Move from C.
(completion-setup-function): Avoid minibuffer-completion-contents.
* src/minibuf.c (Fread_minibuffer, Feval_minibuffer): Move to Elisp.
(syms_of_minibuf): Adjust accodingly.
* src/lread.c (Fread):
* src/callint.c (Fcall_interactively): Adjust calls accordingly.

Fixes: debbugs:14255
This commit is contained in:
Stefan Monnier 2013-05-04 15:27:41 -04:00
parent 5bebd1866b
commit 30c7e54299
6 changed files with 70 additions and 60 deletions

View File

@ -1,9 +1,16 @@
2013-05-04 Stefan Monnier <monnier@iro.umontreal.ca>
* simple.el (read-expression-map): Use completion-at-point (bug#14255).
Move the declaration from C.
(read-minibuffer, eval-minibuffer): Move from C.
(completion-setup-function): Avoid minibuffer-completion-contents.
2013-05-03 Leo Liu <sdl.web@gmail.com>
* progmodes/octave.el (octave-font-lock-keywords): Do not
dehighlight 'end' in comments or strings.
(octave-completing-read, octave-goto-function-definition): New
helpers.
(octave-completing-read, octave-goto-function-definition):
New helpers.
(octave-help-buffer): New user variable.
(octave-help-file, octave-help-function): New button types.
(octave-help): New command and bind it to C-h ;.
@ -24,8 +31,8 @@
2013-05-02 Leo Liu <sdl.web@gmail.com>
* progmodes/octave.el (octave-syntax-propertize-function): Include
the case when ' is at line beginning. (Bug#14336)
* progmodes/octave.el (octave-syntax-propertize-function):
Include the case when ' is at line beginning. (Bug#14336)
2013-05-02 Glenn Morris <rgm@gnu.org>
@ -75,8 +82,8 @@
2013-04-30 Alan Mackenzie <acm@muc.de>
Handle arbitrarily long C++ member initialisation lists.
* progmodes/cc-engine.el (c-back-over-member-initializers): new
function.
* progmodes/cc-engine.el (c-back-over-member-initializers):
new function.
(c-guess-basic-syntax): New CASE 5R (extracted from 5B) to handle
(most) member init lists.
@ -172,8 +179,8 @@
2013-04-27 Ingo Lohmar <i.lohmar@gmail.com> (tiny change)
* ls-lisp.el (ls-lisp-insert-directory): If no files are
displayed, move point to after the totals line. See
http://lists.gnu.org/archive/html/emacs-devel/2013-04/msg00677.html
displayed, move point to after the totals line.
See http://lists.gnu.org/archive/html/emacs-devel/2013-04/msg00677.html
for the details.
2013-04-27 Stefan Monnier <monnier@iro.umontreal.ca>

View File

@ -1236,13 +1236,35 @@ in *Help* buffer. See also the command `describe-char'."
bidi-fixer encoding-msg pos total percent col hscroll))))))
;; Initialize read-expression-map. It is defined at C level.
(let ((m (make-sparse-keymap)))
(define-key m "\M-\t" 'lisp-complete-symbol)
;; Might as well bind TAB to completion, since inserting a TAB char is much
;; too rarely useful.
(define-key m "\t" 'lisp-complete-symbol)
(set-keymap-parent m minibuffer-local-map)
(setq read-expression-map m))
(defvar read-expression-map
(let ((m (make-sparse-keymap)))
(define-key m "\M-\t" 'completion-at-point)
;; Might as well bind TAB to completion, since inserting a TAB char is
;; much too rarely useful.
(define-key m "\t" 'completion-at-point)
(set-keymap-parent m minibuffer-local-map)
m))
(defun read-minibuffer (prompt &optional initial-contents)
"Return a Lisp object read using the minibuffer, unevaluated.
Prompt with PROMPT. If non-nil, optional second arg INITIAL-CONTENTS
is a string to insert in the minibuffer before reading.
\(INITIAL-CONTENTS can also be a cons of a string and an integer.
Such arguments are used as in `read-from-minibuffer'.)"
;; Used for interactive spec `x'.
(read-from-minibuffer prompt initial-contents minibuffer-local-map
t minibuffer-history))
(defun eval-minibuffer (prompt &optional initial-contents)
"Return value of Lisp expression read using the minibuffer.
Prompt with PROMPT. If non-nil, optional second arg INITIAL-CONTENTS
is a string to insert in the minibuffer before reading.
\(INITIAL-CONTENTS can also be a cons of a string and an integer.
Such arguments are used as in `read-from-minibuffer'.)"
;; Used for interactive spec `X'.
;; FIXME: Share code with `eval-expression'.
(eval (read-from-minibuffer prompt initial-contents read-expression-map
t read-expression-history)))
(defvar minibuffer-completing-symbol nil
"Non-nil means completing a Lisp symbol in the minibuffer.")
@ -6714,15 +6736,21 @@ Called from `temp-buffer-show-hook'."
(defun completion-setup-function ()
(let* ((mainbuf (current-buffer))
(base-dir
;; When reading a file name in the minibuffer,
;; try and find the right default-directory to set in the
;; completion list buffer.
;; FIXME: Why do we do that, actually? --Stef
;; FIXME: This is a bad hack. We try to set the default-directory
;; in the *Completions* buffer so that the relative file names
;; displayed there can be treated as valid file names, independently
;; from the completion context. But this suffers from many problems:
;; - It's not clear when the completions are file names. With some
;; completion tables (e.g. bzr revision specs), the listed
;; completions can mix file names and other things.
;; - It doesn't pay attention to possible quoting.
;; - With fancy completion styles, the code below will not always
;; find the right base directory.
(if minibuffer-completing-file-name
(file-name-as-directory
(expand-file-name
(substring (minibuffer-completion-contents)
0 (or completion-base-size 0)))))))
(buffer-substring (minibuffer-prompt-end)
(- (point) (or completion-base-size 0))))))))
(with-current-buffer standard-output
(let ((base-size completion-base-size) ;Read before killing localvars.
(base-position completion-base-position)

View File

@ -1,8 +1,15 @@
2013-05-04 Stefan Monnier <monnier@iro.umontreal.ca>
* minibuf.c (Fread_minibuffer, Feval_minibuffer): Move to Elisp.
(syms_of_minibuf): Adjust accodingly.
* lread.c (Fread):
* callint.c (Fcall_interactively): Adjust calls accordingly.
2013-05-04 Eli Zaretskii <eliz@gnu.org>
* dispextern.h (WINDOW_WANTS_HEADER_LINE_P): Verify that
w->contents is a buffer before computing everything else. Use
parentheses to disambiguate last part of the condition.
w->contents is a buffer before computing everything else.
Use parentheses to disambiguate last part of the condition.
* w32fns.c (w32_wnd_proc): Remove temporary code used to trap
assertion violations. (Bug#14062)

View File

@ -733,12 +733,12 @@ invoke it. If KEYS is omitted or nil, the return value of
break;
case 'x': /* Lisp expression read but not evaluated. */
args[i] = Fread_minibuffer (callint_message, Qnil);
args[i] = call1 (intern ("read-minibuffer"), callint_message);
visargs[i] = last_minibuf_string;
break;
case 'X': /* Lisp expression read and evaluated. */
args[i] = Feval_minibuffer (callint_message, Qnil);
args[i] = call1 (intern ("eval-minibuffer"), callint_message);
visargs[i] = last_minibuf_string;
break;

View File

@ -1976,7 +1976,9 @@ STREAM or the value of `standard-input' may be:
if (EQ (stream, Qt))
stream = Qread_char;
if (EQ (stream, Qread_char))
return Fread_minibuffer (build_string ("Lisp expression: "), Qnil);
/* FIXME: ¿¡ When is this used !? */
return call1 (intern ("read-minibuffer"),
build_string ("Lisp expression: "));
return read_internal_start (stream, Qnil, Qnil);
}

View File

@ -986,34 +986,6 @@ and some related functions, which use zero-indexing for POSITION. */)
return val;
}
DEFUN ("read-minibuffer", Fread_minibuffer, Sread_minibuffer, 1, 2, 0,
doc: /* Return a Lisp object read using the minibuffer, unevaluated.
Prompt with PROMPT. If non-nil, optional second arg INITIAL-CONTENTS
is a string to insert in the minibuffer before reading.
\(INITIAL-CONTENTS can also be a cons of a string and an integer.
Such arguments are used as in `read-from-minibuffer'.) */)
(Lisp_Object prompt, Lisp_Object initial_contents)
{
CHECK_STRING (prompt);
return read_minibuf (Vminibuffer_local_map, initial_contents,
prompt, 1, Qminibuffer_history,
make_number (0), Qnil, 0, 0);
}
DEFUN ("eval-minibuffer", Feval_minibuffer, Seval_minibuffer, 1, 2, 0,
doc: /* Return value of Lisp expression read using the minibuffer.
Prompt with PROMPT. If non-nil, optional second arg INITIAL-CONTENTS
is a string to insert in the minibuffer before reading.
\(INITIAL-CONTENTS can also be a cons of a string and an integer.
Such arguments are used as in `read-from-minibuffer'.) */)
(Lisp_Object prompt, Lisp_Object initial_contents)
{
return Feval (read_minibuf (Vread_expression_map, initial_contents,
prompt, 1, Qread_expression_history,
make_number (0), Qnil, 0, 0),
Qnil);
}
/* Functions that use the minibuffer to read various things. */
DEFUN ("read-string", Fread_string, Sread_string, 1, 5, 0,
@ -2137,15 +2109,9 @@ properties. */);
Vminibuffer_prompt_properties
= Fcons (intern_c_string ("read-only"), Fcons (Qt, Qnil));
DEFVAR_LISP ("read-expression-map", Vread_expression_map,
doc: /* Minibuffer keymap used for reading Lisp expressions. */);
Vread_expression_map = Qnil;
defsubr (&Sactive_minibuffer_window);
defsubr (&Sset_minibuffer_window);
defsubr (&Sread_from_minibuffer);
defsubr (&Seval_minibuffer);
defsubr (&Sread_minibuffer);
defsubr (&Sread_string);
defsubr (&Sread_command);
defsubr (&Sread_variable);