emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] Incorrect use of completing-read in `find-function-read'


From: Thierry Volpiatto
Subject: Re: [PATCH] Incorrect use of completing-read in `find-function-read'
Date: Tue, 08 Nov 2011 11:01:50 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.91 (gnu/linux)

If there is no objection, i will install this patch tomorrow.

Thierry Volpiatto <address@hidden> writes:

> Hi, `find-function-read' doesn't use default argument of
> `completing-read'.
> While I was at it, I simplify the code, please have a look:
>
> === modified file 'lisp/emacs-lisp/find-func.el'
> *** lisp/emacs-lisp/find-func.el      2011-09-07 01:06:09 +0000
> --- lisp/emacs-lisp/find-func.el      2011-11-07 09:10:47 +0000
> ***************
> *** 363,391 ****
>   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)))))
>   
>   (defun find-function-do-it (symbol type switch-fn)
>     "Find Emacs Lisp SYMBOL in a buffer and display it.
> --- 363,385 ----
>   Otherwise TYPE should be `defvar' or `defface'.
>   If TYPE is nil, defaults using `function-called-at-point',
>   otherwise uses `variable-at-point'."
> !   (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.

-- 
  Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 




reply via email to

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