[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Soo many buffers

From: Tassilo Horn
Subject: Re: Soo many buffers
Date: Thu, 05 Aug 2010 18:19:52 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Andrea Crotti <> writes:

Hi Andrea,

> The only concern now is about the org-agenda-files (around 200 maybe).

WTF?!? How do you structure your projects, i.e. how do you decide to
create a new agenda file?  I only have 4...

> I would like to have them everywhere, so I should add to the
> "no-clear" list.  But in this way I lose the advantage of desktop mode
> and I'm still full of buffers.
> One thing that would be nice I think would be one command to toggle
> the visibility of the org buffers on and off.

At least with `ibuffer' (an advanced alternative to the normal
`list-buffers') you can group buffers, so that you get something looking
like Gnus group buffers with topics.  I also put org-related buffers in
one group.  Here's my definition:

--8<---------------cut here---------------start------------->8---
(setq ibuffer-saved-filter-groups
         ("Chat" (or
                  (mode . garak-mode)
                  (name . "^\\*Garak\\*$")
                  (mode . rcirc-mode)))
         ("Organization" (or
                          (mode . diary-mode)
                          (mode . org-mode)
                          (mode . org-agenda-mode)))
         ("Gnus & News" (or
                         (mode . message-mode)
                         (mode . bbdb-mode)
                         (mode . mail-mode)
                         (mode . gnus-group-mode)
                         (mode . gnus-summary-mode)
                         (mode . gnus-article-mode)
                         (name . "^\\(\\.bbdb\\|dot-bbdb\\)$")
                         (name . "^\\.newsrc-dribble$")
                         (mode . newsticker-mode)))
         ("Files" (filename . ".*"))
         ("File Management" (or
                             (mode . dired-mode)
                             (mode . shell-mode)))
         ("Documentation" (or
                           (mode . Info-mode)
                           (mode . apropos-mode)
                           (mode . woman-mode)
                           (mode . help-mode)
                           (mode . Man-mode))))))
--8<---------------cut here---------------end--------------->8---

If you want to get git of org-mode buffers for all buffer completion
(C-x b), you could rename all such buffers, so that they start with a
space.  Those are ignored by completion (unless you type a space

Here's a (only very briefly tested) snippet:

--8<---------------cut here---------------start------------->8---
(defun th-hide-org-buffers (arg)
  "Hide org-mode buffers from completion by prepending a space at the buffer 
When called with prefix arg (`C-u'), then remove this space again."
  (interactive "P")
  (dolist (b (buffer-list))
    (set-buffer b)
    (when (eq major-mode 'org-mode)
       (if arg 
           (replace-regexp-in-string "^[[:space:]]+" "" (buffer-name))
         (concat " " (buffer-name)))))))
--8<---------------cut here---------------end--------------->8---


reply via email to

[Prev in Thread] Current Thread [Next in Thread]