From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "B. T. Raven" Newsgroups: gmane.emacs.help Subject: Re: More convenient editing of recentf files Date: Sun, 15 Mar 2009 19:09:08 -0600 Message-ID: References: <-P2dnR3ZpK8hoCDUnZ2dnUVZ_sudnZ2d@posted.cpinternet> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1237164049 10705 80.91.229.12 (16 Mar 2009 00:40:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 16 Mar 2009 00:40:49 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Mar 16 01:42:06 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Lj0u4-0002iT-Ll for geh-help-gnu-emacs@m.gmane.org; Mon, 16 Mar 2009 01:42:04 +0100 Original-Received: from localhost ([127.0.0.1]:37966 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lj0si-0000Sz-E3 for geh-help-gnu-emacs@m.gmane.org; Sun, 15 Mar 2009 20:40:40 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news2.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.posted.cpinternet!news.posted.cpinternet.POSTED!not-for-mail Original-NNTP-Posting-Date: Sun, 15 Mar 2009 19:07:43 -0500 User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) Original-Newsgroups: gnu.emacs.help In-Reply-To: Original-Lines: 117 X-Usenet-Provider: http://www.giganews.com Original-NNTP-Posting-Host: 64.61.220.49 Original-X-Trace: sv3-HusZ+grsxMKAoUPY03QiozSlomQhmeDLaxthGXPttFf3IPPynSDnL1vC84Cq29TRuoDBlPMq7LZOqb5!ci/gDebdPBQ2JS7ImfgZHL0nLrdJlHwbdfkbGaU0XwGxz6U8TPzvWmvok63r2Ez7wr4wQdT3xYQ/!Ia04pCWKOwq5ueGXsA== Original-X-Complaints-To: abuse@cpinternet.com X-DMCA-Complaints-To: abuse@cpinternet.com X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.39 Original-Xref: news.stanford.edu gnu.emacs.help:167666 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:62961 Archived-At: Drew Adams wrote: >> From: B. T. Raven Sent: Sunday, March 15, 2009 11:43 AM >> In .emacs I have: >> (add-to-list 'same-window-buffer-names "*Buffer List*") >> and '(iswitchb-mode t nil (iswitchb)) in custom-set-variables >> so I can navigate to buffers quickly with C-x b and kill >> selected ones with C-x C-b via D, SPC, and X keys. > >> Is there a way to do something like this with recentf files? >> Now I have to use the mousey checkbox interface: >> menubar > Open Recent > Edit list > check ... check ... check >> .... move to bottom of list ... check ok > > Perhaps someone else will give you an Iswitchb-specific answer for recentf file > deletion. If not, the following might help. > > If you use Icicles, you can use `Remove from Recent Files List' in menu Files > > Icicles, or use `M-x icicle-remove-file-from-recentf-list'. > > During completion, you can filter candidates with your input (e.g. substring, > regexp, prefix), and cycle among matches. Use `C-RET' or `C-mouse-2' repeatedly > to remove as many individual file names as you like. > > Use `C-!' to remove all file names that match the current input pattern - use as > many patterns as you like. Use `C-~' (complement) to match against all > candidates that do *not* match some input pattern. Use `M-SPC' to combine input > patterns (logical AND): progessive completion. > > (And yes, you can use Iswitchb with Icicles.) > > ---- > > Without Icicles, you could call, within a loop, a command that reads a single > absolute file name using completion (letting the user quit the loop with, e.g., > `C-g'). A user would then complete file names to remove them from > `recentf-list'. > > (defun remove-some-recent-files () > "Remove some files from the list of recently used files." > (interactive) > (while recentf-list > (call-interactively #'remove-a-recent-file))) > > Within the loop, call `completing-read' against `recentf-list'. E.g.: > > (defun remove-a-recent-file (file) > "Remove a file from the list of recently used files." > (interactive > (list > (completing-read > "Remove from recent files list (`C-g' when done): " > (mapcar #'list > (progn > (unless (boundp 'recentf-list)(require 'recentf)) > (when (fboundp 'recentf-mode) (recentf-mode 99)) > (unless (consp recentf-list) > (error "No recently accessed files")) > recentf-list)) > nil (and (fboundp 'confirm-nonexistent-file-or-buffer) > (confirm-nonexistent-file-or-buffer)) ; Emacs23. > nil 'file-name-history (car recentf-list)))) > (setq recentf-list (delete file recentf-list)) > (message "`%s' removed from `recentf-list'" file)) > > If you know you're going to have `recentf.el' loaded and be in `recentf-mode', > then you can skip the first part of the `progn'. If you know you have Emacs 22+, > you can skip the `mapcar'. If you know you have Emacs 23, you can skip the > `fboundp' for `confirm-...'. Thanks, Drew. I called the main defun prune-recentf-list and it worked but with deeply nested file hierarchy, it's still a lot of typing. For now I'll just use: (defalias 'rel 'recentf-edit-list) (defalias 'rof 'recentf-open-files) (defalias 'rsl 'recentf-save-list) so I can avoid the mouse. Does the code below require that Icicles be installed? It looks like it depends on the existence of icicle-define-command. I probably will install icicles someday. It looks intriguing but I need to keep things as close to the standard Emacs install as possible for now. Ed > > ---- > > FYI, a nearly identical definition suffices to define the Icicles multi-command > (no loop needed) that lets you remove as many files as you want from the list: > > (icicle-define-command icicle-remove-file-from-recentf-list > "Remove some files from the list of recently used files." > icicle-remove-from-recentf-candidate-action > "Remove from recent files list: " > (mapcar #'list > (progn > (unless (boundp 'recentf-list) (require 'recentf)) > (when (fboundp 'recentf-mode) (recentf-mode 99)) > (unless (consp recentf-list) > (error "No recently accessed files")) > recentf-list)) > nil (and (fboundp 'confirm-nonexistent-file-or-buffer) > (confirm-nonexistent-file-or-buffer)) > nil 'file-name-history (car recentf-list) nil > ((icicle-use-candidates-only-once-flag t))) > > (defun icicle-remove-from-recentf-candidate-action (file) > "Action function for `icicle-remove-file-from-recentf-list'." > (setq recentf-list (delete file recentf-list)) > (message "`%s' removed from `recentf-list'" file)) > > HTH. > > >