emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r106324: * emacs-lisp/find-func.el (f


From: thierry volpiatto
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r106324: * emacs-lisp/find-func.el (find-function-read): Fix incorrect use of default argument in `completing-read'.
Date: Tue, 08 Nov 2011 16:06:47 +0100
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 106324
committer: thierry volpiatto <address@hidden
branch nick: trunk
timestamp: Tue 2011-11-08 16:06:47 +0100
message:
  * emacs-lisp/find-func.el (find-function-read): Fix incorrect use of default 
argument in `completing-read'.
modified:
  lisp/emacs-lisp/find-func.el
=== modified file 'lisp/emacs-lisp/find-func.el'
--- a/lisp/emacs-lisp/find-func.el      2011-09-07 01:06:09 +0000
+++ b/lisp/emacs-lisp/find-func.el      2011-11-08 15:06:47 +0000
@@ -363,29 +363,23 @@
 Otherwise TYPE should be `defvar' or `defface'.
 If TYPE is nil, defaults using `function-called-at-point',
 otherwise uses `variable-at-point'."
-  (let ((symb (if (null type)
-                 (function-called-at-point)
-               (if (eq type 'defvar)
-                   (variable-at-point)
-                 (variable-at-point t))))
-       (predicate (cdr (assq type '((nil . fboundp) (defvar . boundp)
-                                    (defface . facep)))))
-       (prompt (cdr (assq type '((nil . "function") (defvar . "variable")
-                                 (defface . "face")))))
-       (enable-recursive-minibuffers t)
-       val)
-    (if (equal symb 0)
-       (setq symb nil))
-    (setq val (completing-read
-              (concat "Find "
-                      prompt
-                      (if symb
-                          (format " (default %s)" symb))
-                      ": ")
-              obarray predicate t nil))
-    (list (if (equal val "")
-             symb
-           (intern val)))))
+  (let* ((symb1 (cond ((null type) (function-called-at-point))
+                      ((eq type 'defvar) (variable-at-point))
+                      (t (variable-at-point t))))
+         (symb  (unless (eq symb1 0) symb1))
+         (predicate (cdr (assq type '((nil . fboundp)
+                                      (defvar . boundp)
+                                      (defface . facep)))))
+         (prompt-type (cdr (assq type '((nil . "function")
+                                        (defvar . "variable")
+                                        (defface . "face")))))
+         (prompt (concat "Find " prompt-type
+                         (and symb (format " (default %s)" symb))
+                         ": "))
+         (enable-recursive-minibuffers t))
+    (list (intern (completing-read
+                   prompt obarray predicate
+                   t nil nil (and symb (symbol-name symb)))))))
 
 (defun find-function-do-it (symbol type switch-fn)
   "Find Emacs Lisp SYMBOL in a buffer and display it.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]