unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* swtching between buffers?
@ 2003-05-10 16:09 Miguel Ulloa
  2003-05-10 16:49 ` Marco Parrone
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Miguel Ulloa @ 2003-05-10 16:09 UTC (permalink / raw)


Hello,

I would like to know if there is a command to circularly navigate all 
opened buffers in emacs, thanks in advance.

mig

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: swtching between buffers?
  2003-05-10 16:09 swtching between buffers? Miguel Ulloa
@ 2003-05-10 16:49 ` Marco Parrone
  2003-05-10 17:08 ` Kai Großjohann
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Marco Parrone @ 2003-05-10 16:49 UTC (permalink / raw)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Miguel Ulloa <migu71@yahoo.com> writes:

> I would like to know if there is a command to circularly navigate all
> opened buffers in emacs, thanks in advance.
> 
> mig

There are a few extensions, see gnu.emacs.sources and Emacs Lisp List
[1] and Emacs Wiki [2].

1. http://anc.ed.ac.uk/~stephen/emacs/ell.html
2. http://www.emacswiki.org

- -- 
Marco Parrone - marc0@autistici.org
www.autistici.org/marc0
2143 9E77 D5E6 115A 48AD  A170 D0EE F736 (4E88 99C2)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>

iD8DBQE+vS2H0O73Nk6ImcIRAjvIAJ9W8h50/U08lKfeMtJQZsA8gQFJvACcDlHQ
s2g1RmyJW+bKEyupOAzxLbE=
=ziVg
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: swtching between buffers?
  2003-05-10 16:09 swtching between buffers? Miguel Ulloa
  2003-05-10 16:49 ` Marco Parrone
@ 2003-05-10 17:08 ` Kai Großjohann
  2003-05-11  0:53   ` Yan Tang
  2003-05-10 18:22 ` John Paul Wallington
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Kai Großjohann @ 2003-05-10 17:08 UTC (permalink / raw)


Miguel Ulloa <migu71@yahoo.com> writes:

> I would like to know if there is a command to circularly navigate all
> opened buffers in emacs, thanks in advance.

M-x bury-buffer RET
-- 
file-error; Data: (Opening input file no such file or directory ~/.signature)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: swtching between buffers?
  2003-05-10 16:09 swtching between buffers? Miguel Ulloa
  2003-05-10 16:49 ` Marco Parrone
  2003-05-10 17:08 ` Kai Großjohann
@ 2003-05-10 18:22 ` John Paul Wallington
  2003-05-10 19:52   ` Miguel Ulloa
  2003-05-10 19:04 ` Jiri Pejchal
  2003-05-12  8:19 ` Stefan Kamphausen
  4 siblings, 1 reply; 8+ messages in thread
From: John Paul Wallington @ 2003-05-10 18:22 UTC (permalink / raw)


Miguel Ulloa <migu71@yahoo.com> wrote:

> I would like to know if there is a command to circularly navigate all
> opened buffers in emacs, thanks in advance.

There are `prev-buffer' and `next-buffer', bound to C-x <left> and
C-x <right> respectively, in the development sources:

(define-key global-map [?\C-x right] 'next-buffer)
(define-key global-map [?\C-x left] 'prev-buffer)
(defun next-buffer ()
  "Switch to the next buffer in cyclic order."
  (interactive)
  (let ((buffer (current-buffer)))
    (switch-to-buffer (other-buffer buffer))
    (bury-buffer buffer)))

(defun prev-buffer ()
  "Switch to the previous buffer in cyclic order."
  (interactive)
  (let ((list (nreverse (buffer-list)))
	found)
    (while (and (not found) list)
      (let ((buffer (car list)))
	(if (and (not (get-buffer-window buffer))
		 (not (string-match "\\` " (buffer-name buffer))))
	    (setq found buffer)))
      (setq list (cdr list)))
    (switch-to-buffer found)))

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: swtching between buffers?
  2003-05-10 16:09 swtching between buffers? Miguel Ulloa
                   ` (2 preceding siblings ...)
  2003-05-10 18:22 ` John Paul Wallington
@ 2003-05-10 19:04 ` Jiri Pejchal
  2003-05-12  8:19 ` Stefan Kamphausen
  4 siblings, 0 replies; 8+ messages in thread
From: Jiri Pejchal @ 2003-05-10 19:04 UTC (permalink / raw)


Miguel Ulloa <migu71@yahoo.com> writes:

> Hello,
> 
> I would like to know if there is a command to circularly navigate all
> opened buffers in emacs, thanks in advance.

Check bs-cycle-next and bs-cycle-previous.


--
Jiri Pejchal

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: swtching between buffers?
  2003-05-10 18:22 ` John Paul Wallington
@ 2003-05-10 19:52   ` Miguel Ulloa
  0 siblings, 0 replies; 8+ messages in thread
From: Miguel Ulloa @ 2003-05-10 19:52 UTC (permalink / raw)


Thanks a lot

John Paul Wallington wrote:
> Miguel Ulloa <migu71@yahoo.com> wrote:
> 
> 
>>I would like to know if there is a command to circularly navigate all
>>opened buffers in emacs, thanks in advance.
> 
> 
> There are `prev-buffer' and `next-buffer', bound to C-x <left> and
> C-x <right> respectively, in the development sources:
> 
> (define-key global-map [?\C-x right] 'next-buffer)
> (define-key global-map [?\C-x left] 'prev-buffer)
> (defun next-buffer ()
>   "Switch to the next buffer in cyclic order."
>   (interactive)
>   (let ((buffer (current-buffer)))
>     (switch-to-buffer (other-buffer buffer))
>     (bury-buffer buffer)))
> 
> (defun prev-buffer ()
>   "Switch to the previous buffer in cyclic order."
>   (interactive)
>   (let ((list (nreverse (buffer-list)))
> 	found)
>     (while (and (not found) list)
>       (let ((buffer (car list)))
> 	(if (and (not (get-buffer-window buffer))
> 		 (not (string-match "\\` " (buffer-name buffer))))
> 	    (setq found buffer)))
>       (setq list (cdr list)))
>     (switch-to-buffer found)))

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: swtching between buffers?
  2003-05-10 17:08 ` Kai Großjohann
@ 2003-05-11  0:53   ` Yan Tang
  0 siblings, 0 replies; 8+ messages in thread
From: Yan Tang @ 2003-05-11  0:53 UTC (permalink / raw)


I have another trick for cycle buffer, stolen from the famous cycle
buffer and modified by myself.

The following are my codes.
When you press C-o to cycle buffer, buffer list will be appeared in
mini-buffer, and cycle right, just like alt-tab in M$ windows.
The first one in mini-buffer will be the next main buffer.
------------------------------------------------------------------------
----
;; C-<TAB> only work in XWindow, so I have to define C-o, but why?
(global-set-key "\C-o" 'next-buffer)
;(global-set-key [\C-tab] 'next-buffer) ;forward reference
;(global-set-key [\C-\S-tab] 'prev-buffer) ;forward reference

;; Dired mode has its own ctrl-o, I have to do local key rebinding.
(add-hook 'dired-mode-hook
          '(lambda ()
             (define-key dired-mode-map "\C-o" 'next-buffer)))

(defun next-buffer ()
  "Switch to the other buffer (2nd in list-buffer) in current window."
  (interactive)
  (bury-buffer (current-buffer))
  (cycle-buffer (buffer-list)))

(defun prev-buffer ()
  "Switch to previous buffer in current window."
  (interactive)
  (cycle-buffer (reverse (buffer-list))))

(defun cycle-buffer (ls)
  (let* ((ptr ls) bf bn)
    (setq ptr (append ptr (list '<BUFFER-FLAG>)))
    (while (not (equal (car ptr) '<BUFFER-FLAG>))
      (setq bf (car ptr)
            bn (buffer-name bf))
      (if (null (ignore-buffer bn))
          (setq ptr (append (cdr ptr) (list (car ptr))))
        (setq ptr (cdr ptr))))
    (setq ptr (cdr ptr))
    (setq bf (car ptr))
    (setq ptr (append (cdr ptr) (list (car ptr))))
    (message "%s" ptr)
    (if bf
        (switch-to-buffer bf))))

(defun ignore-buffer (str)
  (or
    ;;buffers I don't want to switch to 
   (string-match "\\*Buffer List\\*" str)
   (string-match "\\*Compilation\\*" str)
   (string-match "^TAGS" str)
   (string-match "^\\*Messages\\*$" str)
   (string-match "^\\*Completions\\*$" str)
   (string-match "output\\*$" str)
   (string-match "^ " str)
   
   ;(memq str (mapcar 
   ;   (lambda (x) (buffer-name (window-buffer (frame-selected-window
x))))
   ;   (visible-frame-list)))
   ))
------------------------------------------------------------------------
----

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: swtching between buffers?
  2003-05-10 16:09 swtching between buffers? Miguel Ulloa
                   ` (3 preceding siblings ...)
  2003-05-10 19:04 ` Jiri Pejchal
@ 2003-05-12  8:19 ` Stefan Kamphausen
  4 siblings, 0 replies; 8+ messages in thread
From: Stefan Kamphausen @ 2003-05-12  8:19 UTC (permalink / raw)


Miguel Ulloa <migu71@yahoo.com> wrote in message news:<5v9va.3476$kH.1029551@twister.nyc.rr.com>...
> Hello,
> 
> I would like to know if there is a command to circularly navigate all 
> opened buffers in emacs, thanks in advance.

If I may put a shameless self-ad here: you might want to take a look
at mtorus.el which lets you create cyclic groups of buffer positions
with the groups being arranged on another cycle. The feature you
requested is implemented there as a special case. I wrote it for
XEmacs but it should work in GNU Emacs, too. If you are interested
take a look at www.skamphausen.de/software/skamacs/mtorus.html

Kind Regards
Stefan Kamphausen

PS: I've been working on a re-implementation of the whole thing which
isn't ready for the public yet.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2003-05-12  8:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-10 16:09 swtching between buffers? Miguel Ulloa
2003-05-10 16:49 ` Marco Parrone
2003-05-10 17:08 ` Kai Großjohann
2003-05-11  0:53   ` Yan Tang
2003-05-10 18:22 ` John Paul Wallington
2003-05-10 19:52   ` Miguel Ulloa
2003-05-10 19:04 ` Jiri Pejchal
2003-05-12  8:19 ` Stefan Kamphausen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).