From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Incorrect use of completing-read in `find-function-read' Date: Tue, 08 Nov 2011 11:01:50 +0100 Message-ID: <87zkg7lypd.fsf@gmail.com> References: <87hb2guwax.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1320746540 1024 80.91.229.12 (8 Nov 2011 10:02:20 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 8 Nov 2011 10:02:20 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Nov 08 11:02:14 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RNiVR-0008A1-N1 for ged-emacs-devel@m.gmane.org; Tue, 08 Nov 2011 11:02:13 +0100 Original-Received: from localhost ([::1]:51282 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RNiVR-0002Kc-AH for ged-emacs-devel@m.gmane.org; Tue, 08 Nov 2011 05:02:13 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:52299) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RNiVO-0002KE-1P for emacs-devel@gnu.org; Tue, 08 Nov 2011 05:02:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RNiVJ-00037T-U2 for emacs-devel@gnu.org; Tue, 08 Nov 2011 05:02:10 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]:45558) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RNiVJ-00037K-9H for emacs-devel@gnu.org; Tue, 08 Nov 2011 05:02:05 -0500 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1RNiVH-00086w-8I for emacs-devel@gnu.org; Tue, 08 Nov 2011 11:02:03 +0100 Original-Received: from 69.78.88.79.rev.sfr.net ([79.88.78.69]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 08 Nov 2011 11:02:03 +0100 Original-Received: from thierry.volpiatto by 69.78.88.79.rev.sfr.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 08 Nov 2011 11:02:03 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 71 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 69.78.88.79.rev.sfr.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.91 (gnu/linux) Cancel-Lock: sha1:fSScTJw7okJDqViEadg2In/smjs= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:145946 Archived-At: If there is no objection, i will install this patch tomorrow. Thierry Volpiatto 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