From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: RE: Cycling through favored buffers Date: Thu, 25 Apr 2013 15:14:04 -0700 Message-ID: <36E143CB907A42B3B88E5D479610252B@us.oracle.com> References: <69f8e714-2046-4726-b418-b199fe7c7df8@googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1366928064 2893 80.91.229.3 (25 Apr 2013 22:14:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 25 Apr 2013 22:14:24 +0000 (UTC) To: "'Rami A'" , Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Apr 26 00:14:28 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UVUQu-0001tP-06 for geh-help-gnu-emacs@m.gmane.org; Fri, 26 Apr 2013 00:14:28 +0200 Original-Received: from localhost ([::1]:46929 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVUQt-0004Uz-GM for geh-help-gnu-emacs@m.gmane.org; Thu, 25 Apr 2013 18:14:27 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:56632) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVUQe-0004Ub-0A for help-gnu-emacs@gnu.org; Thu, 25 Apr 2013 18:14:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UVUQc-0003Rd-G5 for help-gnu-emacs@gnu.org; Thu, 25 Apr 2013 18:14:11 -0400 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:22232) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVUQc-0003R8-9n for help-gnu-emacs@gnu.org; Thu, 25 Apr 2013 18:14:10 -0400 Original-Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r3PME7uh008366 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 25 Apr 2013 22:14:08 GMT Original-Received: from userz7022.oracle.com (userz7022.oracle.com [156.151.31.86]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r3PME6tK027696 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Thu, 25 Apr 2013 22:14:07 GMT Original-Received: from abhmt105.oracle.com (abhmt105.oracle.com [141.146.116.57]) by userz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r3PME6Df011433; Thu, 25 Apr 2013 22:14:06 GMT Original-Received: from dradamslap1 (/130.35.178.8) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 25 Apr 2013 15:14:06 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Thread-Index: Ac5B/jePz7Xg5RvFRImPJpYakp34yQAAYoGw X-Source-IP: ucsinet21.oracle.com [156.151.31.93] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 141.146.126.69 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:90350 Archived-At: > not sure how to incorporate your suggestion in my code. > > So in the code that I have crs-hated-buffers, which are the > buffers to ignore: > (defvar crs-hated-buffers > '("KILL" "*Compile-Log*" "*Buffer List*" "*Messages*" > "*compilation*" "TAGS" "*scratch*" "source" "headers")) > > How do I add the cl-remove-if to this variable so it would > include all dired type buffers? You don't add it to that variable. You treat your removal of those buffers as one way to filter `buffer-list' and checking (derived-mode-p 'dired-mode) as another way to filter. IOW filter another way what you've already filtered one way. (Or typically better, filter both at the same time, so you traverse `buffer-list' only once.) > secondly, the code that I have cycles through all buffers > "except" the ignored ones mentioned above. > So after I construct cl-remove-if-not that includes the > directories I want to only cycle through, how to apply that > on my code? or maybe I need a totally new function that would > do the trick? Not sure what you really are trying to do. You mentioned having two different commands, one to remove hated stuff and dirs and the other keep only dir buffers "headers" and "source". But if you instead want a single command that removes (a) your hated buffers and (b) buffers that are directories except "headers" and "source", then do just that. Your `crs-bury-buffer' uses a list of buffers. Right now, you construct that list by removing some (hated) buffers from `buffer-list'. Conceptually, you can do this: after you have removed those buffers, remove also the other ones you want to remove. And add back any others you want to keep. But it is better to just use a single predicate (lambda (buf)...) that filters `buffer-list' only once, in all of the ways you want, whatever they might be: remove if this-or-that but not if such-and-such. (let ((my-buflist (cl-remove-if (lambda (bf) (and (or it-is-a-hated-buffer it-is-a-directory) (not it-is-headers-or-source))) (buffer-list)))) (switch-to-buffer...)