* lisp/simple.el (read--expression): New function, extracted from
authorStefan Monnier <monnier@iro.umontreal.ca>
Sat, 25 May 2013 02:21:49 +0000 (22:21 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sat, 25 May 2013 02:21:49 +0000 (22:21 -0400)
eval-expression.  Set completion-at-point-functions.
(eval-expression, eval-minibuffer): Use it.

* lisp/progmodes/flymake.el (flymake-nop): Don't return a string.
(flymake-set-at): Fix typo.

Fixes: debbugs:14465

lisp/ChangeLog
lisp/progmodes/flymake.el
lisp/simple.el

index 3cb0535..0fa162b 100644 (file)
@@ -1,3 +1,12 @@
+2013-05-25  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * progmodes/flymake.el (flymake-nop): Don't return a string.
+       (flymake-set-at): Fix typo.
+
+       * simple.el (read--expression): New function, extracted from
+       eval-expression.  Set completion-at-point-functions (bug#14465).
+       (eval-expression, eval-minibuffer): Use it.
+
 2013-05-25  Xue Fuqiao  <xfq.free@gmail.com>
 
        * progmodes/flymake.el (flymake-save-buffer-in-file)
index aed62b2..99b48e8 100644 (file)
@@ -170,7 +170,8 @@ See `x-popup-menu' for the menu specifier format."
 (if (featurep 'xemacs) (progn
 
 (defun flymake-nop ()
-  "Do nothing.")
+  "Do nothing."
+  nil)
 
 (defun flymake-make-xemacs-menu (menu-data)
   "Return a menu specifier using MENU-DATA."
@@ -251,15 +252,14 @@ are the string substitutions (see the function `format')."
 (defun flymake-ins-after (list pos val)
   "Insert VAL into LIST after position POS.
 POS counts from zero."
-  (let ((tmp (copy-sequence list)))    ; Bind `tmp' to a copy of LIST
+  (let ((tmp (copy-sequence list)))
     (setcdr (nthcdr pos tmp) (cons val (nthcdr (1+ pos) tmp)))
     tmp))
 
 (defun flymake-set-at (list pos val)
-)
-"Set VAL at position POS in LIST.
+  "Set VAL at position POS in LIST.
 POS counts from zero."
-(let ((tmp (copy-sequence list)))      ; Bind `tmp' to a copy of LIST
+  (let ((tmp (copy-sequence list)))
     (setcar (nthcdr pos tmp) val)
     tmp))
 
index 82c7100..18a360f 100644 (file)
@@ -1268,9 +1268,7 @@ 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)))
+  (eval (read--expression prompt initial-contents)))
 
 (defvar minibuffer-completing-symbol nil
   "Non-nil means completing a Lisp symbol in the minibuffer.")
@@ -1322,6 +1320,17 @@ display the result of expression evaluation."
 (defvar eval-expression-minibuffer-setup-hook nil
   "Hook run by `eval-expression' when entering the minibuffer.")
 
+(defun read--expression (prompt &optional initial-contents)
+  (let ((minibuffer-completing-symbol t))
+    (minibuffer-with-setup-hook
+        (lambda ()
+          (add-hook 'completion-at-point-functions
+                    #'lisp-completion-at-point nil t)
+          (run-hooks 'eval-expression-minibuffer-setup-hook))
+      (read-from-minibuffer prompt initial-contents
+                            read-expression-map t
+                            'read-expression-history))))
+
 ;; We define this, rather than making `eval' interactive,
 ;; for the sake of completion of names like eval-region, eval-buffer.
 (defun eval-expression (exp &optional insert-value)
@@ -1338,12 +1347,7 @@ and `eval-expression-print-level'.
 If `eval-expression-debug-on-error' is non-nil, which is the default,
 this command arranges for all errors to enter the debugger."
   (interactive
-   (list (let ((minibuffer-completing-symbol t))
-          (minibuffer-with-setup-hook
-              (lambda () (run-hooks 'eval-expression-minibuffer-setup-hook))
-            (read-from-minibuffer "Eval: "
-                                  nil read-expression-map t
-                                  'read-expression-history)))
+   (list (read--expression "Eval: ")
         current-prefix-arg))
 
   (if (null eval-expression-debug-on-error)