unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* buffers
@ 2003-01-25  2:04 chris.danx
  2003-01-25 10:23 ` buffers Alan Mackenzie
  2003-01-27 11:59 ` buffers Kester Clegg
  0 siblings, 2 replies; 12+ messages in thread
From: chris.danx @ 2003-01-25  2:04 UTC (permalink / raw)


Hi,

I found some code to switch between buffers in the google archives of 
this group, but on some emacs it doesn't work as expected or rather it 
does but it goes to "hidden buffers" that don't show up in others.  At 
home (emacs 21.1.1 on mandrake) it works fine, going to/from any buffers 
open in order but at uni (running rh 7.2 - no emacs version number 
sorry) some buffers are selected which contain lots of symbols and err, 
other junk - it's probably not junk but it's incomprehensible to me.  I 
don't know off hand what these buffers are, only that they don't show up 
at home when cycling through the entire buffer list.


Is there any way to prevent certain buffers from being selected when you 
cycle through buffers?  Are their "hidden buffers" in emacs?


The code is

;switch between buffers
(defalias 'switch-to-next-buffer 'bury-buffer)
(defun switch-to-previous-buffer ()
   "Switches to previous buffer"
   (interactive)
   (switch-to-buffer (nth (- (length (buffer-list)) 1) (buffer-list)))
)

(global-set-key "\C-c\j" 'switch-to-previous-buffer)
(global-set-key "\C-c\k" 'switch-to-next-buffer)



Cheers,
Chris

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

* Re: buffers
  2003-01-25  2:04 buffers chris.danx
@ 2003-01-25 10:23 ` Alan Mackenzie
  2003-01-27 11:59 ` buffers Kester Clegg
  1 sibling, 0 replies; 12+ messages in thread
From: Alan Mackenzie @ 2003-01-25 10:23 UTC (permalink / raw)


chris.danx <spamoff.danx@ntlworld.com> wrote on Sat, 25 Jan 2003 02:04:24
+0000:
> Hi,

> I found some code to switch between buffers in the google archives of
> this group, but on some emacs it doesn't work as expected or rather it
> does but it goes to "hidden buffers" that don't show up in others.  At
> home (emacs 21.1.1 on mandrake) it works fine, going to/from any
> buffers open in order but at uni (running rh 7.2 - no emacs version
> number sorry) some buffers are selected which contain lots of symbols
> and err, other junk - it's probably not junk but it's incomprehensible
> to me.  I don't know off hand what these buffers are, only that they
> don't show up at home when cycling through the entire buffer list.

> Is there any way to prevent certain buffers from being selected when
> you cycle through buffers?  Are their "hidden buffers" in emacs?

There are buffers in emacs which do contain, er, junk, but their names
all start with a space.  Go to the *scratch* buffer, and execute
(buffer-list) with C-u C-x C-e.  Note the difference between

#<buffer cc-defs.el>             and
#<buffer  *Echo Area 0*>
         ^
         |

> The code is

> ;switch between buffers
> (defalias 'switch-to-next-buffer 'bury-buffer)
> (defun switch-to-previous-buffer ()
>    "Switches to previous buffer"
>    (interactive)
>    (switch-to-buffer (nth (- (length (buffer-list)) 1) (buffer-list)))
> )

> (global-set-key "\C-c\j" 'switch-to-previous-buffer)
> (global-set-key "\C-c\k" 'switch-to-next-buffer)

It might be an idea to reprogram these commands so that internal buffers
are normally filtered out from the buffer list, but with a C-u prefix,
they would be treated as normal buffers.

> Chris

-- 
Alan Mackenzie (Munich, Germany)
Email: aacm@muuc.dee; to decode, wherever there is a repeated letter
(like "aa"), remove half of them (leaving, say, "a").

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

* Re: buffers
  2003-01-25  2:04 buffers chris.danx
  2003-01-25 10:23 ` buffers Alan Mackenzie
@ 2003-01-27 11:59 ` Kester Clegg
  2003-01-27 12:43   ` buffers John Paul Wallington
  2003-01-28  0:53   ` buffers chris.danx
  1 sibling, 2 replies; 12+ messages in thread
From: Kester Clegg @ 2003-01-27 11:59 UTC (permalink / raw)


"chris.danx" <spamoff.danx@ntlworld.com> writes:

> Is there any way to prevent certain buffers from being selected when
> you cycle through buffers?  Are their "hidden buffers" in emacs?

I have the following in mine, stolen from somewhere I can't remember:

;;-- trick for switching buffers nice and fast (use Ctrl-right or left arrow)
;;-- see also key binding for control tab above ----------------------------

(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 we never want to see
(defvar crs-hated-buffers
  '("KILL" "*Compile-Log*" "*scratch*"))

(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)))))

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

It's not perfect, but it's OK for what I need.

-- 
************************************************************************
Kester Clegg				Dept. of Computer Science,
Research Assistant (UTC)		University of York, 
Tel (01904) 43 27 49			email: kester at cs.york.ac.uk
************************************************************************

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

* Re: buffers
  2003-01-27 11:59 ` buffers Kester Clegg
@ 2003-01-27 12:43   ` John Paul Wallington
  2003-01-27 13:07     ` buffers Kester Clegg
  2003-01-28  0:53   ` buffers chris.danx
  1 sibling, 1 reply; 12+ messages in thread
From: John Paul Wallington @ 2003-01-27 12:43 UTC (permalink / raw)


Kester Clegg wrote:

> > Is there any way to prevent certain buffers from being selected
> > when you cycle through buffers?  Are their "hidden buffers" in
> > emacs?
>  
>  I have the following in mine, stolen from somewhere I can't
>  remember:
>  
>  ;;-- trick for switching buffers nice and fast (use Ctrl-right or
>  ;;-- left arrow) see also key binding for control tab above
>  ;;-- ----------------------------
>  
>  (defun crs-delete-these

That's from Charles Seybold's .emacs
see http://www.messengers-of-messiah.org/~csebold/emacs/

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

* Re: buffers
  2003-01-27 12:43   ` buffers John Paul Wallington
@ 2003-01-27 13:07     ` Kester Clegg
  0 siblings, 0 replies; 12+ messages in thread
From: Kester Clegg @ 2003-01-27 13:07 UTC (permalink / raw)


John Paul Wallington <jpw@gnu.org> writes:

> That's from Charles Seybold's .emacs
> see http://www.messengers-of-messiah.org/~csebold/emacs/

Mmmm, that really is a big .emacs file!

-- 
************************************************************************
Kester Clegg				Dept. of Computer Science,
Research Assistant (UTC)		University of York, 
Tel (01904) 43 27 49			email: kester at cs.york.ac.uk
************************************************************************

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

* Re: buffers
  2003-01-27 11:59 ` buffers Kester Clegg
  2003-01-27 12:43   ` buffers John Paul Wallington
@ 2003-01-28  0:53   ` chris.danx
  2003-01-28 11:10     ` buffers Stefan Kamphausen
  1 sibling, 1 reply; 12+ messages in thread
From: chris.danx @ 2003-01-28  0:53 UTC (permalink / raw)


Kester Clegg wrote:

> It's not perfect, but it's OK for what I need.

Thanks for that, it's really useful!  I especially like the Ctrl left 
and ctrl right switching!


Thanks again,
Chris Campbell

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

* Re: buffers
  2003-01-28  0:53   ` buffers chris.danx
@ 2003-01-28 11:10     ` Stefan Kamphausen
  2003-01-28 12:56       ` buffers Kai Großjohann
  2003-01-28 13:26       ` buffers chris.danx
  0 siblings, 2 replies; 12+ messages in thread
From: Stefan Kamphausen @ 2003-01-28 11:10 UTC (permalink / raw)


"chris.danx" <spamoff.danx@ntlworld.com> wrote in message news:<NukZ9.5725$RZ.53161@newsfep4-win.server.ntli.net>...
> Kester Clegg wrote:
> 
> > It's not perfect, but it's OK for what I need.
> 
> Thanks for that, it's really useful!  I especially like the Ctrl left 
> and ctrl right switching!

You might be interested in an elisp file I've written which gives you
the plain buffer cycling (using a skipping predicate) on Shift
left/right (default; of course you can use your own keybindings) and
extents that mechanism to user defined subgroups of buffers and
positions (several might be in the same buffer). You choose the
subgroup to cycle with Shift up/down (default...). I hope I could
explain that in an understandable way ;-)

If you are interested:
http://www.skamphausen.de/software/skamacs/mtorus.html

I am currently working on a complete rewrite of that thing which I
hope to finish within the next 3-4 weeks but it already works quite
well for some people. It should work OK in GNU Emacs, too, I think but
I haven't tested that thoroughly.

Best Regards
Stefan Kamphausen

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

* Re: buffers
  2003-01-28 11:10     ` buffers Stefan Kamphausen
@ 2003-01-28 12:56       ` Kai Großjohann
  2003-01-28 13:20         ` buffers Kester Clegg
  2003-01-29  9:02         ` buffers Stefan Kamphausen
  2003-01-28 13:26       ` buffers chris.danx
  1 sibling, 2 replies; 12+ messages in thread
From: Kai Großjohann @ 2003-01-28 12:56 UTC (permalink / raw)


kamphausen@creativepharma.com (Stefan Kamphausen) writes:

> You might be interested in an elisp file I've written which gives you
> the plain buffer cycling (using a skipping predicate) on Shift
> left/right (default; of course you can use your own keybindings)

Maybe you can suggest some bindings for folks who use CUA mode?
-- 
Ambibibentists unite!

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

* Re: buffers
  2003-01-28 12:56       ` buffers Kai Großjohann
@ 2003-01-28 13:20         ` Kester Clegg
  2003-01-28 17:13           ` buffers Kai Großjohann
  2003-01-29  9:02         ` buffers Stefan Kamphausen
  1 sibling, 1 reply; 12+ messages in thread
From: Kester Clegg @ 2003-01-28 13:20 UTC (permalink / raw)


kai.grossjohann@uni-duisburg.de (Kai Großjohann) writes:

> Maybe you can suggest some bindings for folks who use CUA mode?

Kai, have you noticed that you can't use C-c C-e to elide in gnus with
CUA mode?  


-- 
************************************************************************
Kester Clegg				Dept. of Computer Science,
Research Assistant (UTC)		University of York, 
Tel (01904) 43 27 49			email: kester at cs.york.ac.uk
************************************************************************

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

* Re: buffers
  2003-01-28 11:10     ` buffers Stefan Kamphausen
  2003-01-28 12:56       ` buffers Kai Großjohann
@ 2003-01-28 13:26       ` chris.danx
  1 sibling, 0 replies; 12+ messages in thread
From: chris.danx @ 2003-01-28 13:26 UTC (permalink / raw)


Stefan Kamphausen wrote:

> You might be interested in an elisp file I've written which gives you
> the plain buffer cycling (using a skipping predicate) on Shift
> left/right (default; of course you can use your own keybindings) and
> extents that mechanism to user defined subgroups of buffers and
> positions (several might be in the same buffer). You choose the
> subgroup to cycle with Shift up/down (default...). I hope I could
> explain that in an understandable way ;-)


Hmm, interesting!  This would certainly be useful.

I will take a look later, thanks!


Chris

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

* Re: buffers
  2003-01-28 13:20         ` buffers Kester Clegg
@ 2003-01-28 17:13           ` Kai Großjohann
  0 siblings, 0 replies; 12+ messages in thread
From: Kai Großjohann @ 2003-01-28 17:13 UTC (permalink / raw)


Kester Clegg <kester@cs.york.ac.uk> writes:

> kai.grossjohann@uni-duisburg.de (Kai Großjohann) writes:
>
>> Maybe you can suggest some bindings for folks who use CUA mode?
>
> Kai, have you noticed that you can't use C-c C-e to elide in gnus with
> CUA mode?  

No.  But maybe that's because I've turned off the CUA keys C-x, C-c
and C-v.
-- 
Ambibibentists unite!

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

* Re: buffers
  2003-01-28 12:56       ` buffers Kai Großjohann
  2003-01-28 13:20         ` buffers Kester Clegg
@ 2003-01-29  9:02         ` Stefan Kamphausen
  1 sibling, 0 replies; 12+ messages in thread
From: Stefan Kamphausen @ 2003-01-29  9:02 UTC (permalink / raw)


kai.grossjohann@uni-duisburg.de (Kai Großjohann wrote in message news:<841y2xwhz6.fsf@lucy.is.informatik.uni-duisburg.de>...
> kamphausen@creativepharma.com (Stefan Kamphausen) writes:
> 
> > You might be interested in an elisp file I've written which gives you
> > the plain buffer cycling (using a skipping predicate) on Shift
> > left/right (default; of course you can use your own keybindings)
> 
> Maybe you can suggest some bindings for folks who use CUA mode?

I'd like to, but .... (good opener? ;-)
Do you have any idea how they should be like?

I understand that CUA makes shifted cursor movement selecting text,
right?
Then I can't use them for cycling. But I really think that it should
be something that you can type very fast so no combination should be
used. Who would want to hit C-c > several times to get to the right
buffer...? Is it better style to use F-keys for such a thing? I'm
already using F11 and F12 and one could use F9 and F10 for the cycling
functions (with modifier for cycling groups). Then all the mtorus
functionality would live in one F-key block.

The problem is that the keyboard has too few keys and emacs too many
functions :-)

Best Regards
Stefan Kamphausen

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

end of thread, other threads:[~2003-01-29  9:02 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-25  2:04 buffers chris.danx
2003-01-25 10:23 ` buffers Alan Mackenzie
2003-01-27 11:59 ` buffers Kester Clegg
2003-01-27 12:43   ` buffers John Paul Wallington
2003-01-27 13:07     ` buffers Kester Clegg
2003-01-28  0:53   ` buffers chris.danx
2003-01-28 11:10     ` buffers Stefan Kamphausen
2003-01-28 12:56       ` buffers Kai Großjohann
2003-01-28 13:20         ` buffers Kester Clegg
2003-01-28 17:13           ` buffers Kai Großjohann
2003-01-29  9:02         ` buffers Stefan Kamphausen
2003-01-28 13:26       ` buffers chris.danx

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).