From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Rami A Newsgroups: gmane.emacs.help Subject: Cycling through favored buffers Date: Wed, 24 Apr 2013 15:59:12 -0700 (PDT) Message-ID: <69f8e714-2046-4726-b418-b199fe7c7df8@googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1366844831 22099 80.91.229.3 (24 Apr 2013 23:07:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 24 Apr 2013 23:07:11 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Apr 25 01:07:15 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 1UV8mQ-00087z-N0 for geh-help-gnu-emacs@m.gmane.org; Thu, 25 Apr 2013 01:07:14 +0200 Original-Received: from localhost ([::1]:52910 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UV8mQ-0002PK-80 for geh-help-gnu-emacs@m.gmane.org; Wed, 24 Apr 2013 19:07:14 -0400 X-Received: by 10.180.188.52 with SMTP id fx20mr74709wic.3.1366844353848; Wed, 24 Apr 2013 15:59:13 -0700 (PDT) X-Received: by 10.50.27.4 with SMTP id p4mr19876igg.3.1366844353295; Wed, 24 Apr 2013 15:59:13 -0700 (PDT) Original-Path: usenet.stanford.edu!15no5601702wij.0!news-out.google.com!hg5ni22664wib.1!nntp.google.com!bx2no3624467wib.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=148.87.19.198; posting-account=HZ4YzgoAAABkTSCruZ7Bs4hufjlOUmBF Original-NNTP-Posting-Host: 148.87.19.198 User-Agent: G2/1.0 Injection-Date: Wed, 24 Apr 2013 22:59:13 +0000 Original-Xref: usenet.stanford.edu gnu.emacs.help:198071 X-Mailman-Approved-At: Wed, 24 Apr 2013 19:07:01 -0400 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:90338 Archived-At: Hi, I have some code in my dotemacs file that would allow me to switch between opened files and ignoring specific buffers, like "TAGS" "Messages" and some folder names "headers" "source". I am binding this behavior to both C-Tab and C-M-Tab. I have two questions" 1. How do I ignore "all directory type buffers" and limit the switching to be between files only. 2. How do I create another list of buffers that only includes directories "headers" and "source" and when press a combination of keys lets say C-M-S-Tab to cycle through only these? This is the snippet of code that I have: ;; Control TABbuffer Cycling ; necessary support function for buffer burial (defun crs-delete-these (delete-these from-this-list) "Delete DELETE-THESE FROM-THIS-LIST." (cond ((car delete-these) (if (member (car delete-these) from-this-list) (crs-delete-these (cdr delete-these) (delete (car delete-these) from-this-list)) (crs-delete-these (cdr delete-these) from-this-list))) (t from-this-list))) ; this is the list of buffers I never want to see (defvar crs-hated-buffers '("KILL" "*Compile-Log*" "*Buffer List*" "*Messages*" "*compilation*" "TAGS" "*scratch*" "source" "headers")) ; might as well use this for both (setq iswitchb-buffer-ignore (append '("^ " "*Buffer") crs-hated-buffers)) (defun crs-hated-buffers () "List of buffers I never want to see, converted from names to buffers." (delete nil (append (mapcar 'get-buffer crs-hated-buffers) (mapcar (lambda (this-buffer) (if (string-match "^ " (buffer-name this-buffer)) this-buffer)) (buffer-list))))) ; I'm sick of switching buffers only to find KILL right in front of me (defun crs-bury-buffer (&optional n) (interactive) (unless n (setq n 1)) (let ((my-buffer-list (crs-delete-these (crs-hated-buffers) (buffer-list (selected-frame))))) (switch-to-buffer (if (< n 0) (nth (+ (length my-buffer-list) n) my-buffer-list) (bury-buffer) (nth n my-buffer-list))))) ; Key Bindings (global-set-key [(control tab)] 'crs-bury-buffer) (global-set-key [(control meta tab)] (lambda () (interactive) (crs-bury-buffer -1)))