From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.devel Subject: Re: filecache.el questions Date: Wed, 01 Oct 2008 15:33:20 -0500 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: <868wt82gz3.fsf@lifelogs.com> References: <864p3w457n.fsf@lifelogs.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1222893244 8869 80.91.229.12 (1 Oct 2008 20:34:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 1 Oct 2008 20:34:04 +0000 (UTC) Cc: pbreton , Emacs Development Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 01 22:35:02 2008 connect(): Connection refused Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Kl8PS-0003qi-Rk for ged-emacs-devel@m.gmane.org; Wed, 01 Oct 2008 22:34:59 +0200 Original-Received: from localhost ([127.0.0.1]:49951 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kl8OP-0008R8-Hj for ged-emacs-devel@m.gmane.org; Wed, 01 Oct 2008 16:33:53 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kl8OH-0008KV-Eq for emacs-devel@gnu.org; Wed, 01 Oct 2008 16:33:45 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kl8OF-0008JH-UU for emacs-devel@gnu.org; Wed, 01 Oct 2008 16:33:44 -0400 Original-Received: from [199.232.76.173] (port=46198 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kl8OF-0008Iq-Lo for emacs-devel@gnu.org; Wed, 01 Oct 2008 16:33:43 -0400 Original-Received: from [38.98.147.130] (port=34333 helo=internalsmtp.w2k.jumptrading.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Kl8Nx-0004zw-Ak for emacs-devel@gnu.org; Wed, 01 Oct 2008 16:33:43 -0400 Original-Received: from tzlatanov-ubuntu-desktop.jumptrading.com ([10.2.21.134]) by internalsmtp.w2k.jumptrading.com with Microsoft SMTPSVC(6.0.3790.1830); Wed, 1 Oct 2008 15:33:22 -0500 X-Hashcash: 1:20:081001:emacs-devel@gnu.org::ICeLScY4SuzqHYnc:0000000000000000000000000000000000000000008Qhx X-Hashcash: 1:20:081001:pbreton@cs.umb.edu::d8X7J6YB2rYXcPRs:00000000000000000000000000000000000000000000pGD 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" In-Reply-To: <864p3w457n.fsf@lifelogs.com> (Ted Zlatanov's message of "Wed, 01 Oct 2008 12:04:28 -0500") User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.60 (gnu/linux) X-OriginalArrivalTime: 01 Oct 2008 20:33:22.0031 (UTC) FILETIME=[F24C0FF0:01C92404] X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.4-2.6 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:104286 Archived-At: (I heard from Paul, who I didn't CC correctly on my last e-mail so he didn't see that this went to emacs-devel as well. Fixing this.) Paul Breton wrote: > If the code is fairly small, I think it wouldn't hurt to add an > optional way to save file-cache-alist. A list of locations sounds like > overkill to me, however; I would have one variable to say whether or > not to save it (defaulting to not), and another one to save where it > should be saved. > (Personally, I never save the cache because eventually it would get > out of sync with the actual filesystem; initializing once per emacs > session (which are fairly long-lived for me) works for me. However, > people who use it differently might benefit from the new code). I have to restart it often, and I need to scan a *lot* of directories, so it makes sense for me. I added a file-cache-rescan function that will rescan and save, and file-cache-initialize which will do a rescan if the save file doesn't exist (intended to be called when you load the library). It doesn't have to have a list of file locations, you're right. Does the rescan/initialize mechanism seem OK? The actual code is pretty trivial, though I keep wishing it was even simpler through some Emacs persistence mechanism. > Similarly, it has never bothered me very much to simply cycle thru the > various completions. I wouldn't use the display hack simply because it > seems like it could get ugly when there are a lot of > completions. Completing-read is a good idea; however, I haven't looked > at this code in a long time and am still scratching my head over how > the completion magic works :) Here's a patch to do a completing-read when more than one directory is available, using enable-recursive-minibuffers which is a bit hacky. It does work better than the current method, which just inserts the next value in the list. This replaces the current method; the two can coexist as well. Ted Index: filecache.el =================================================================== RCS file: /sources/emacs/emacs/lisp/filecache.el,v retrieving revision 1.37 diff -c -r1.37 filecache.el *** filecache.el 6 May 2008 07:57:35 -0000 1.37 --- filecache.el 1 Oct 2008 20:23:24 -0000 *************** *** 511,525 **** (t (let* ((minibuffer-dir (file-name-directory (minibuffer-contents))) (dir-list (member minibuffer-dir directory-list)) ) ! (setq directory ! ;; If the directory is in the list, return the next element ! ;; Otherwise, return the first element ! (if dir-list ! (or (elt directory-list ! (setq num (1+ (- len (length dir-list))))) ! (elt directory-list (setq num 0))) ! (elt directory-list (setq num 0)))) ) ) ) --- 511,521 ---- (t (let* ((minibuffer-dir (file-name-directory (minibuffer-contents))) (dir-list (member minibuffer-dir directory-list)) + (enable-recursive-minibuffers t) ) ! (setq directory (completing-read ! (format "Select a directory for %s: " file) ! directory-list nil t)) ) ) )