Re: other-window-or-buffer

2006-05-16 Thread Martin Blais
John Sturdy  ul.ie> writes:

> 
> Here's one of those "commands I wouldn't be without", to avoid all that
> typing of buffer names (and all that hurried mistyping of buffer
> names).
> 
> (defun other-window-or-buffer ()

I've got something different but similar in spirit, which cycles 
between all the windows of all the frames (all my emacs frames live 
in a single winmgr workspace):

(defun other-window-all-frames ()
  (interactive)
  (let* ((w (next-window nil nil 'visible))
 (f (window-frame w)))
(select-frame-set-input-focus f)
(select-window w)))

(substitute-key-definition
 'other-window (repeatable-command-def 'other-window-all-frames)
  (current-global-map))





___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: other-window-or-buffer

2006-05-07 Thread John Sturdy
> Just out of curiousity, which keybinding have you replaced?  C-x o or
> C-x b ?

The keybinding it replaces is actually C-kp-next, but that's because,
in order to reduce the load on my hands (I have RSI) I have a set of
footswitch units daisy-chained onto the keyboard, each unit having
three buttons (large central one, small one on each side), the left one
doing Ctrl, Shift and Meta, and the right one doing various commands,
bound to some keys that I wasn't using but can be read with a full set
of modifiers. So as I see it, the keybinding is "leftmost switch on the
left foot and rightmost switch on the right foot"! I originally had
this bound the same as C-x o, but then realized that (pedal allocation
being a scarce resource) I was wasting a useful pedal combination when
there was only one window, so I wrote this.

(I have developed some software that lets you put different kinds of
movement easily onto the cursor keys, and I use this with the left and
middle pedals on the right, with modifiers -- I'll be posting this
soon. And the rightmost right pedal brings up a slightly hacked tmm
(text mode menu), the other right-foot pedals navigate the menu tree
when in tmm, and the "menu" pedal again selects the current entry. I
can recommend this setup highly to anyone who wants to offload some of
the work from their hands.)

___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


RE: other-window-or-buffer

2006-05-05 Thread Drew Adams
> "Switch to the next window, or, if there is only one
> window, the next buffer.
> If done repeatedly when there is only one window, keeps getting
> different buffers from the buffer list"

If you want to cycle through buffers, have you looked at the M-x
iswitchb-mode minor mode?

There are many ways to cycle through buffers. Have a look at this discussion
and comparison: http://www.emacswiki.org/cgi-bin/wiki/SwitchingBuffers.



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: other-window-or-buffer

2006-05-05 Thread liyer . vijay
John Sturdy wrote:
> Here's one of those "commands I wouldn't be without", to avoid all that
> typing of buffer names (and all that hurried mistyping of buffer
> names).
>
> (defun other-window-or-buffer ()

Just out of curiousity, which keybinding have you replaced?  C-x o or
C-x b ?

>   "Switch to the next window, or, if there is only one window, the next
> buffer.
> If done repeatedly when there is only one window, keeps getting
> different
> buffers from the buffer list"

If you want to cycle through buffers, have you looked at the M-x
iswitchb-mode minor mode?

Cheers
Vijay Lakshminarayanan

> Can we quote you on that?
A long time ago, someone in the Lisp industry told me it was poor form
quote people; it suggests that they lack value.
-- Kent M Pitman <[EMAIL PROTECTED]> in comp.lang.lisp

___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


other-window-or-buffer

2006-05-05 Thread John Sturdy
Here's one of those "commands I wouldn't be without", to avoid all that
typing of buffer names (and all that hurried mistyping of buffer
names).

(defun other-window-or-buffer ()
  (interactive)
  "Switch to the next window, or, if there is only one window, the next
buffer.
If done repeatedly when there is only one window, keeps getting
different
buffers from the buffer list"
  (setq other-window-or-buffer-consecutive-count
    (if (eq last-command 'other-window-or-buffer)
    (1+ other-window-or-buffer-consecutive-count)
  1))
  (if (one-window-p)
   (if (<= other-window-or-buffer-consecutive-count 2)
   (switch-to-buffer (other-buffer))
     (switch-to-buffer (nth other-window-or-buffer-consecutive-count
(buffer-list)))
 (message "Next one will be %s"
          (buffer-name (nth (1+ 
other-window-or-buffer-consecutive-count)
            (buffer-list)

(if (<= other-window-or-buffer-consecutive-count 2)
  (other-window 1)
  (delete-other-windows

___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources