From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: locate-file-completion-table: Fixed point from lexical-binding? Date: Thu, 23 Feb 2012 01:27:06 -0500 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1329978433 28151 80.91.229.3 (23 Feb 2012 06:27:13 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 23 Feb 2012 06:27:13 +0000 (UTC) Cc: emacs-devel To: "Aaron S. Hawley" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Feb 23 07:27:13 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1S0S91-0006T0-Py for ged-emacs-devel@m.gmane.org; Thu, 23 Feb 2012 07:27:11 +0100 Original-Received: from localhost ([::1]:38908 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0S90-0008UO-Uz for ged-emacs-devel@m.gmane.org; Thu, 23 Feb 2012 01:27:10 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:48609) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0S8y-0008UJ-L9 for emacs-devel@gnu.org; Thu, 23 Feb 2012 01:27:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S0S8x-0007wb-Ml for emacs-devel@gnu.org; Thu, 23 Feb 2012 01:27:08 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:2305) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0S8x-0007wT-KQ for emacs-devel@gnu.org; Thu, 23 Feb 2012 01:27:07 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjwFANjbRU9Ld/XJ/2dsb2JhbABEr2SCdIEIgXMBAQQBViMFCws0EhQYDSSIFLg/jQQVUhcGBQMChRcKhBsEiE+bGYRb X-IronPort-AV: E=Sophos;i="4.73,468,1325480400"; d="scan'208";a="164260585" Original-Received: from 75-119-245-201.dsl.teksavvy.com (HELO pastel.home) ([75.119.245.201]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 23 Feb 2012 01:27:06 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 4FCAF5205F; Thu, 23 Feb 2012 01:27:06 -0500 (EST) In-Reply-To: (Aaron S. Hawley's message of "Wed, 22 Feb 2012 12:38:55 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 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:148718 Archived-At: > The problem started after revision 103798. This patch seems to fix > the issue for me. Good catch, thank you. Once again, `setq' bites. I installed the fix below which should work as well but avoids the use of setq instead. Stefan === modified file 'lisp/minibuffer.el' --- lisp/minibuffer.el 2012-02-15 13:45:02 +0000 +++ lisp/minibuffer.el 2012-02-23 04:31:34 +0000 @@ -226,9 +226,10 @@ (defun completion-table-with-context (prefix table string pred action) ;; TODO: add `suffix' maybe? + (let ((pred + (if (not (functionp pred)) ;; Notice that `pred' may not be a function in some abusive cases. - (when (functionp pred) - (setq pred + pred ;; Predicates are called differently depending on the nature of ;; the completion table :-( (cond @@ -240,7 +241,7 @@ (lambda (s) (funcall pred (concat prefix s)))) (t ;Lists and alists. (lambda (s) - (funcall pred (concat prefix (if (consp s) (car s) s)))))))) + (funcall pred (concat prefix (if (consp s) (car s) s))))))))) (if (eq (car-safe action) 'boundaries) (let* ((len (length prefix)) (bound (completion-boundaries string table pred (cdr action)))) @@ -249,7 +250,7 @@ (cond ;; In case of try-completion, add the prefix. ((stringp comp) (concat prefix comp)) - (t comp))))) + (t comp)))))) (defun completion-table-with-terminator (terminator table string pred action) "Construct a completion table like TABLE but with an extra TERMINATOR.