all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* define tab for dired-buffer selection
@ 2007-09-09 20:36 Fabian Braennstroem
  2007-09-09 21:36 ` Peter Dyballa
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Fabian Braennstroem @ 2007-09-09 20:36 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

I often have multiple windows with some dired and some
text-mode buffers. Now, I would like to
 define 'tab' to switch just dired between dired windows.
Would be nice, if this works somehow!?
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))
       ))

But this jumps in every window!?

Regards!
Fabian

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

* Re: define tab for dired-buffer selection
  2007-09-09 20:36 define tab for dired-buffer selection Fabian Braennstroem
@ 2007-09-09 21:36 ` Peter Dyballa
       [not found] ` <mailman.591.1189373818.18990.help-gnu-emacs@gnu.org>
  2007-09-12 15:53 ` Mathias Dahl
  2 siblings, 0 replies; 5+ messages in thread
From: Peter Dyballa @ 2007-09-09 21:36 UTC (permalink / raw)
  To: Fabian Braennstroem; +Cc: help-gnu-emacs


Am 09.09.2007 um 22:36 schrieb Fabian Braennstroem:

> Now, I would like to
>  define 'tab' to switch just dired between dired windows.

Have you thought of adding this (other-window) as a local key binding  
to dired-mode-map?

--
Mit friedvollen Grüßen

   Pete

Wer eher stirbt ist schon 'mal länger tot!

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

* Re: define tab for dired-buffer selection
       [not found] ` <mailman.591.1189373818.18990.help-gnu-emacs@gnu.org>
@ 2007-09-10  6:26   ` Fabian Braennstroem
  0 siblings, 0 replies; 5+ messages in thread
From: Fabian Braennstroem @ 2007-09-10  6:26 UTC (permalink / raw)
  To: help-gnu-emacs

Hi Peter,

Peter Dyballa schrieb am 09/09/2007 09:36 PM:
> Am 09.09.2007 um 22:36 schrieb Fabian Braennstroem:
> 
>> Now, I would like to
>>  define 'tab' to switch just dired between dired windows.
> 
> Have you thought of adding this (other-window) as a local key binding  
> to dired-mode-map?

No, but it should actually not affect any other buffer; the
tab should just walk through the visible open dired
buffers... but you are right, it would be enough to define
it for dired-mode-map.

Fabian

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

* Re: define tab for dired-buffer selection
  2007-09-09 20:36 define tab for dired-buffer selection Fabian Braennstroem
  2007-09-09 21:36 ` Peter Dyballa
       [not found] ` <mailman.591.1189373818.18990.help-gnu-emacs@gnu.org>
@ 2007-09-12 15:53 ` Mathias Dahl
  2007-09-16 21:11   ` Fabian Braennstroem
  2 siblings, 1 reply; 5+ messages in thread
From: Mathias Dahl @ 2007-09-12 15:53 UTC (permalink / raw)
  To: help-gnu-emacs

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

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

* Re: define tab for dired-buffer selection
  2007-09-12 15:53 ` Mathias Dahl
@ 2007-09-16 21:11   ` Fabian Braennstroem
  0 siblings, 0 replies; 5+ messages in thread
From: Fabian Braennstroem @ 2007-09-16 21:11 UTC (permalink / raw)
  To: help-gnu-emacs

Hi Mathias,

sorry for the late response!

Mathias Dahl schrieb am 09/12/2007 03:53 PM:
> 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.

Thanks, it works well!
Fabian

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

end of thread, other threads:[~2007-09-16 21:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-09 20:36 define tab for dired-buffer selection Fabian Braennstroem
2007-09-09 21:36 ` Peter Dyballa
     [not found] ` <mailman.591.1189373818.18990.help-gnu-emacs@gnu.org>
2007-09-10  6:26   ` Fabian Braennstroem
2007-09-12 15:53 ` Mathias Dahl
2007-09-16 21:11   ` Fabian Braennstroem

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.