all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Rami A <rami.ammari@gmail.com>
To: gnu.emacs.help@googlegroups.com
Cc: help-gnu-emacs@gnu.org
Subject: Re: switch to previous buffer
Date: Sat, 30 Mar 2013 01:07:15 -0700 (PDT)	[thread overview]
Message-ID: <6b6e3269-8a0a-4777-abe8-f2ec4596b4a8@googlegroups.com> (raw)
In-Reply-To: <mailman.23083.1364627323.855.help-gnu-emacs@gnu.org>

Le Wang...
Thank you so much buddy. That is exactly what I wanted and even more.

I used this part of the page you recommended, I added *Buffer List" to the ignored list "crs-hated-buffers" and Boom...it worked.

    ; 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*"))
    ; 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)))))
    (global-set-key [(control tab)] 'crs-bury-buffer)
    (global-set-key [(control meta tab)] (lambda ()
                                           (interactive)
                                           (crs-bury-buffer -1)))



  parent reply	other threads:[~2013-03-30  8:07 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-29 22:07 switch to previous buffer Rami A
2013-03-29 22:58 ` Chris F.A. Johnson
2013-03-29 23:17   ` Rami A
2013-03-29 23:20     ` Rami A
2013-03-30  0:12     ` Chris F.A. Johnson
2013-03-30  0:23       ` Rami A
2013-03-30  6:51     ` Bob Proulx
2013-03-30  7:08       ` Le Wang
2013-03-30 14:31         ` Drew Adams
     [not found]       ` <mailman.23083.1364627323.855.help-gnu-emacs@gnu.org>
2013-03-30  8:07         ` Rami A [this message]
2013-03-31 13:01           ` Oleksandr Gavenko
2013-03-31 13:17             ` Teemu Likonen
2013-03-31 22:28               ` Oleksandr Gavenko
     [not found]           ` <mailman.23139.1364734910.855.help-gnu-emacs@gnu.org>
2013-03-31 19:46             ` Rami A
2013-04-01 20:53               ` Oleksandr Gavenko
     [not found]               ` <mailman.23252.1364849659.855.help-gnu-emacs@gnu.org>
2013-04-02  3:07                 ` Rami A
2013-03-30 11:03 ` Bernardo
2013-04-02 21:23 ` Michael Heerdegen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6b6e3269-8a0a-4777-abe8-f2ec4596b4a8@googlegroups.com \
    --to=rami.ammari@gmail.com \
    --cc=gnu.emacs.help@googlegroups.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.