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

Reply via email to