Commit 30c7e542 authored by Stefan Monnier's avatar Stefan Monnier
Browse files

* 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
parent 5bebd186
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> 2013-05-03 Leo Liu <sdl.web@gmail.com>
   
* progmodes/octave.el (octave-font-lock-keywords): Do not * progmodes/octave.el (octave-font-lock-keywords): Do not
dehighlight 'end' in comments or strings. dehighlight 'end' in comments or strings.
(octave-completing-read, octave-goto-function-definition): New (octave-completing-read, octave-goto-function-definition):
helpers. New helpers.
(octave-help-buffer): New user variable. (octave-help-buffer): New user variable.
(octave-help-file, octave-help-function): New button types. (octave-help-file, octave-help-function): New button types.
(octave-help): New command and bind it to C-h ;. (octave-help): New command and bind it to C-h ;.
...@@ -24,8 +31,8 @@ ...@@ -24,8 +31,8 @@
   
2013-05-02 Leo Liu <sdl.web@gmail.com> 2013-05-02 Leo Liu <sdl.web@gmail.com>
   
* progmodes/octave.el (octave-syntax-propertize-function): Include * progmodes/octave.el (octave-syntax-propertize-function):
the case when ' is at line beginning. (Bug#14336) Include the case when ' is at line beginning. (Bug#14336)
   
2013-05-02 Glenn Morris <rgm@gnu.org> 2013-05-02 Glenn Morris <rgm@gnu.org>
   
...@@ -75,8 +82,8 @@ ...@@ -75,8 +82,8 @@
2013-04-30 Alan Mackenzie <acm@muc.de> 2013-04-30 Alan Mackenzie <acm@muc.de>
   
Handle arbitrarily long C++ member initialisation lists. Handle arbitrarily long C++ member initialisation lists.
* progmodes/cc-engine.el (c-back-over-member-initializers): new * progmodes/cc-engine.el (c-back-over-member-initializers):
function. new function.
(c-guess-basic-syntax): New CASE 5R (extracted from 5B) to handle (c-guess-basic-syntax): New CASE 5R (extracted from 5B) to handle
(most) member init lists. (most) member init lists.
   
...@@ -172,8 +179,8 @@ ...@@ -172,8 +179,8 @@
2013-04-27 Ingo Lohmar <i.lohmar@gmail.com> (tiny change) 2013-04-27 Ingo Lohmar <i.lohmar@gmail.com> (tiny change)
   
* ls-lisp.el (ls-lisp-insert-directory): If no files are * ls-lisp.el (ls-lisp-insert-directory): If no files are
displayed, move point to after the totals line. See displayed, move point to after the totals line.
http://lists.gnu.org/archive/html/emacs-devel/2013-04/msg00677.html See http://lists.gnu.org/archive/html/emacs-devel/2013-04/msg00677.html
for the details. for the details.
   
2013-04-27 Stefan Monnier <monnier@iro.umontreal.ca> 2013-04-27 Stefan Monnier <monnier@iro.umontreal.ca>
......
...@@ -1236,13 +1236,35 @@ in *Help* buffer. See also the command `describe-char'." ...@@ -1236,13 +1236,35 @@ in *Help* buffer. See also the command `describe-char'."
bidi-fixer encoding-msg pos total percent col hscroll)))))) bidi-fixer encoding-msg pos total percent col hscroll))))))
;; Initialize read-expression-map. It is defined at C level. ;; Initialize read-expression-map. It is defined at C level.
(let ((m (make-sparse-keymap))) (defvar read-expression-map
(define-key m "\M-\t" 'lisp-complete-symbol) (let ((m (make-sparse-keymap)))
;; Might as well bind TAB to completion, since inserting a TAB char is much (define-key m "\M-\t" 'completion-at-point)
;; too rarely useful. ;; Might as well bind TAB to completion, since inserting a TAB char is
(define-key m "\t" 'lisp-complete-symbol) ;; much too rarely useful.
(set-keymap-parent m minibuffer-local-map) (define-key m "\t" 'completion-at-point)
(setq read-expression-map m)) (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 (defvar minibuffer-completing-symbol nil
"Non-nil means completing a Lisp symbol in the minibuffer.") "Non-nil means completing a Lisp symbol in the minibuffer.")
...@@ -6714,15 +6736,21 @@ Called from `temp-buffer-show-hook'." ...@@ -6714,15 +6736,21 @@ Called from `temp-buffer-show-hook'."
(defun completion-setup-function () (defun completion-setup-function ()
(let* ((mainbuf (current-buffer)) (let* ((mainbuf (current-buffer))
(base-dir (base-dir
;; When reading a file name in the minibuffer, ;; FIXME: This is a bad hack. We try to set the default-directory
;; try and find the right default-directory to set in the ;; in the *Completions* buffer so that the relative file names
;; completion list buffer. ;; displayed there can be treated as valid file names, independently
;; FIXME: Why do we do that, actually? --Stef ;; 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 (if minibuffer-completing-file-name
(file-name-as-directory (file-name-as-directory
(expand-file-name (expand-file-name
(substring (minibuffer-completion-contents) (buffer-substring (minibuffer-prompt-end)
0 (or completion-base-size 0))))))) (- (point) (or completion-base-size 0))))))))
(with-current-buffer standard-output (with-current-buffer standard-output
(let ((base-size completion-base-size) ;Read before killing localvars. (let ((base-size completion-base-size) ;Read before killing localvars.
(base-position completion-base-position) (base-position completion-base-position)
......
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> 2013-05-04 Eli Zaretskii <eliz@gnu.org>
   
* dispextern.h (WINDOW_WANTS_HEADER_LINE_P): Verify that * dispextern.h (WINDOW_WANTS_HEADER_LINE_P): Verify that
w->contents is a buffer before computing everything else. Use w->contents is a buffer before computing everything else.
parentheses to disambiguate last part of the condition. Use parentheses to disambiguate last part of the condition.
   
* w32fns.c (w32_wnd_proc): Remove temporary code used to trap * w32fns.c (w32_wnd_proc): Remove temporary code used to trap
assertion violations. (Bug#14062) assertion violations. (Bug#14062)
......
...@@ -733,12 +733,12 @@ invoke it. If KEYS is omitted or nil, the return value of ...@@ -733,12 +733,12 @@ invoke it. If KEYS is omitted or nil, the return value of
break; break;
case 'x': /* Lisp expression read but not evaluated. */ 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; visargs[i] = last_minibuf_string;
break; break;
case 'X': /* Lisp expression read and evaluated. */ 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; visargs[i] = last_minibuf_string;
break; break;
......
...@@ -1976,7 +1976,9 @@ STREAM or the value of `standard-input' may be: ...@@ -1976,7 +1976,9 @@ STREAM or the value of `standard-input' may be:
if (EQ (stream, Qt)) if (EQ (stream, Qt))
stream = Qread_char; stream = Qread_char;
if (EQ (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); return read_internal_start (stream, Qnil, Qnil);
} }
......
...@@ -986,34 +986,6 @@ and some related functions, which use zero-indexing for POSITION. */) ...@@ -986,34 +986,6 @@ and some related functions, which use zero-indexing for POSITION. */)
return val; 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. */ /* Functions that use the minibuffer to read various things. */
DEFUN ("read-string", Fread_string, Sread_string, 1, 5, 0, DEFUN ("read-string", Fread_string, Sread_string, 1, 5, 0,
...@@ -2137,15 +2109,9 @@ properties. */); ...@@ -2137,15 +2109,9 @@ properties. */);
Vminibuffer_prompt_properties Vminibuffer_prompt_properties
= Fcons (intern_c_string ("read-only"), Fcons (Qt, Qnil)); = 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 (&Sactive_minibuffer_window);
defsubr (&Sset_minibuffer_window); defsubr (&Sset_minibuffer_window);
defsubr (&Sread_from_minibuffer); defsubr (&Sread_from_minibuffer);
defsubr (&Seval_minibuffer);
defsubr (&Sread_minibuffer);
defsubr (&Sread_string); defsubr (&Sread_string);
defsubr (&Sread_command); defsubr (&Sread_command);
defsubr (&Sread_variable); defsubr (&Sread_variable);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment