From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/72302 Path: news.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.gnus.general Subject: Re: [PATCH] Introduce gnus-completing-read Date: Thu, 30 Sep 2010 11:48:42 -0500 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: <87pqvv6utx.fsf@lifelogs.com> References: <1285688153-19680-1-git-send-email-julien@danjou.info> <87wrq5ammm.fsf@tardis.home.perldition.org> <87eicdacn6.fsf@tardis.home.perldition.org> <87hbh9tx2x.fsf@keller.adm.naquadah.org> <87y6aj7mp2.fsf@marauder.physik.uni-ulm.de> <87y6aj4jjk.fsf@tardis.home.perldition.org> <87hbh74gb5.fsf@tardis.home.perldition.org> <87d3rv4fvz.fsf@tardis.home.perldition.org> <87sk0r2xzc.fsf@tardis.home.perldition.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1285865349 30528 80.91.229.12 (30 Sep 2010 16:49:09 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 30 Sep 2010 16:49:09 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M20675@lists.math.uh.edu Thu Sep 30 18:49:07 2010 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1P1MJf-0000YE-76 for ding-account@gmane.org; Thu, 30 Sep 2010 18:49:07 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1P1MJc-0004Jv-Nv; Thu, 30 Sep 2010 11:49:04 -0500 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1P1MJa-0004Ji-Sq for ding@lists.math.uh.edu; Thu, 30 Sep 2010 11:49:02 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtp (Exim 4.72) (envelope-from ) id 1P1MJW-0008Uh-KU for ding@lists.math.uh.edu; Thu, 30 Sep 2010 11:49:02 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]) by quimby.gnus.org with esmtp (Exim 3.36 #1 (Debian)) id 1P1MJV-0001FV-00 for ; Thu, 30 Sep 2010 18:48:57 +0200 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1P1MJS-0000TP-G9 for ding@gnus.org; Thu, 30 Sep 2010 18:48:54 +0200 Original-Received: from 38.98.147.130 ([38.98.147.130]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 30 Sep 2010 18:48:54 +0200 Original-Received: from tzz by 38.98.147.130 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 30 Sep 2010 18:48:54 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 69 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 38.98.147.130 X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6;d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:fqcLtk6Ym78UaXB5AY7iF2fk41o= X-Spam-Score: -0.7 (/) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:72302 Archived-At: On Thu, 30 Sep 2010 18:33:44 +0200 Lars Magne Ingebrigtsen wrote: LMI> Florian Ragwitz writes: >> However, I do intend to properly clean up after myself and revert all my >> changes, assuming a patch doing that could actually be applied without >> me doing pesky paperwork first. I'd be quite happy to not submit a patch >> reverting things if someone also declared 29395112 as a trivial change. LMI> If there are more than ten lines of code, then it can't be counted as a LMI> (tiny change), and we need to revert it. If it is, could you create a LMI> patch to revert those lines? The biggest chunk of the patch are these three functions. The two wrappers are trivially rewritten. `gnus-icompleting-read' can be rewritten pretty easily; I think the main portion (the lambda) can be rewritten as: ... (let ((iswitchb-make-buflist-hook (lambda () (setq iswitchb-temp-buflist (let ((choices (append (when initial-input (list initial-input)) history collection)) filtered-choices) (dolist (x choices) (setq filtered-choices (adjoin x filtered-choices))) (nreverse filtered-choices)))))) ... Which is inspired by the original patch but not a copy (Florian, can you check for correctness?). If that's reasonable I can rewrite more, as much as needed to make the remainder trivial. This did make me wish for a "collect unique x" option for the CL loop :) Ted (defun gnus-std-completing-read (prompt collection &optional require-match initial-input history def) (completing-read prompt collection nil require-match initial-input history def)) (defun gnus-icompleting-read (prompt collection &optional require-match initial-input history def) (let ((iswitchb-make-buflist-hook (lambda () (setq iswitchb-temp-buflist (let ((choices (append (list) (when initial-input (list initial-input)) history collection)) filtered-choices) (while choices (when (and (car choices) (not (member (car choices) filtered-choices))) (setq filtered-choices (cons (car choices) filtered-choices))) (setq choices (cdr choices))) (nreverse filtered-choices)))))) (unwind-protect (progn (when (not iswitchb-mode) (add-hook 'minibuffer-setup-hook 'iswitchb-minibuffer-setup)) (iswitchb-read-buffer prompt def require-match)) (when (not iswitchb-mode) (remove-hook 'minibuffer-setup-hook 'iswitchb-minibuffer-setup))))) (defun gnus-ido-completing-read (prompt collection &optional require-match initial-input history def) (ido-completing-read prompt collection nil require-match initial-input history def))