all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] Incorrect use of completing-read in `find-function-read'
@ 2011-11-07  9:16 Thierry Volpiatto
  2011-11-08 10:01 ` Thierry Volpiatto
  0 siblings, 1 reply; 2+ messages in thread
From: Thierry Volpiatto @ 2011-11-07  9:16 UTC (permalink / raw
  To: emacs-devel

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:

--8<---------------cut here---------------start------------->8---
=== 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.
--8<---------------cut here---------------end--------------->8---


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




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Incorrect use of completing-read in `find-function-read'
  2011-11-07  9:16 [PATCH] Incorrect use of completing-read in `find-function-read' Thierry Volpiatto
@ 2011-11-08 10:01 ` Thierry Volpiatto
  0 siblings, 0 replies; 2+ messages in thread
From: Thierry Volpiatto @ 2011-11-08 10:01 UTC (permalink / raw
  To: emacs-devel

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 




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-11-08 10:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-07  9:16 [PATCH] Incorrect use of completing-read in `find-function-read' Thierry Volpiatto
2011-11-08 10:01 ` Thierry Volpiatto

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.