unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: [PATCH] Incorrect use of completing-read in `find-function-read'
Date: Tue, 08 Nov 2011 11:01:50 +0100	[thread overview]
Message-ID: <87zkg7lypd.fsf@gmail.com> (raw)
In-Reply-To: 87hb2guwax.fsf@gmail.com

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

Thierry Volpiatto <thierry.volpiatto@gmail.com> 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	other threads:[~2011-11-08 10:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-07  9:16 [PATCH] Incorrect use of completing-read in `find-function-read' Thierry Volpiatto
2011-11-08 10:01 ` Thierry Volpiatto [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zkg7lypd.fsf@gmail.com \
    --to=thierry.volpiatto@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).