help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: define tab for dired-buffer selection


From: Mathias Dahl
Subject: Re: define tab for dired-buffer selection
Date: Wed, 12 Sep 2007 17:53:29 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (windows-nt)

Fabian Braennstroem <f.braennstroem@gmx.de> writes:


> My first approach was:
> (defun dired-change-window()
>   "Change to the other buffer"
>   (interactive)
>   (if (eq major-mode 'dired-mode) (other-window 1)
>   (while (not (eq major-mode 'dired-mode)) (other-window 1))
>        ))

This seems to work:

(defun dired-change-window()
  "Change to the other buffer"
  (interactive)
  (if (eq major-mode 'dired-mode)
      (select-window
       (get-window-with-predicate
        (lambda (x) 
          (eq
           (save-excursion (set-buffer (window-buffer x))
                           major-mode)
           'dired-mode))))))

I cannot say exactly why your code does not work though. Maybe the
major-mode does not change because you never really changes buffers.

/Mathias


reply via email to

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