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

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

bug#21649: 25.0.50; [PATCH] Allow M-x man to reuse an existing window


From: martin rudalics
Subject: bug#21649: 25.0.50; [PATCH] Allow M-x man to reuse an existing window
Date: Fri, 23 Oct 2015 10:01:48 +0200

> Here's most of the patch :
>
> +      (`manly
> +       (and (frame-live-p saved-frame)
> +            (select-frame saved-frame))
> +       (if-let ((window (seq-some-p
> +                         (lambda (window)
> +                           (with-current-buffer (window-buffer window)
> +                             (derived-mode-p 'Man-mode)))
> +                         (window-list))))
> +           (set-window-buffer window man-buffer)
> +         (display-buffer man-buffer)))
>
>> How about writing an action function, say ‘man-display-buffer-my-way’, and
>> adding a clause like
>>
>>        (`my-way
>>         (and (frame-live-p saved-frame)
>>              (select-frame saved-frame))
>>         (display-buffer man-buffer
>>         '((man-display-buffer-my-way ...)
>>         . nil)))
>
> Sure, why not!

Maybe we could add something like ‘display-buffer-reuse-mode-window’ to
window.el.  In that case I'd proceed as follows:

(1) The frame(s) to scan for a suitable window should be determined by a
‘reusable-frames’ entry just as in ‘display-buffer-reuse-window’.

(2) Allow to specify the desired (parent) mode via an ALIST ‘mode’
entry.  As value we could allow a single mode or a list of modes.  Then
a window showing a buffer in the same mode as the buffer we want to
display should maybe given preference to a window showing a buffer in
another mode, derived from the same parent mode.  If a same-mode-window
exists on another and a derived-mode-window exists on the selected
frame, one of these should be given preference consistently.

(3) Not use functions like ‘if-let’ and ‘seq-some-p’.  window.el is
preloaded and if not utterly necessary I'd prefer not loading subr-x.el
there.  BTW, I have no idea from where you get ‘seq-some-p’.  Did you
compile your patched man.el with emacs -Q?

WDYT?

martin






reply via email to

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