From: Nicolas Richard <youngfrog@members.fsf.org>
To: 21649@debbugs.gnu.org
Subject: bug#21649: 25.0.50; [PATCH] Allow M-x man to reuse an existing window
Date: Thu, 08 Oct 2015 17:54:02 +0200 [thread overview]
Message-ID: <877fmxz78l.fsf@members.fsf.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 459 bytes --]
When running M-x man RET man RET, then C-x o to select the newly created
window and then running M-x man RET sed RET, what you get is: two "man"
windows side by side. It would make sense to re-use the existing one.
How to best do that I do not know. If modifying the code is necessary,
here's an attempt at adding an option in Man-notify-method. (I'm not
attached to this implementation, and even less attached to the silly
name `manly' that I chose, btw.)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Allow-M-x-man-to-reuse-an-existing-window.patch --]
[-- Type: text/x-diff, Size: 2031 bytes --]
From 2b812b1c9f91af2cf6116f1d4e334154ae44c724 Mon Sep 17 00:00:00 2001
From: Nicolas Richard <youngfrog@members.fsf.org>
Date: Thu, 8 Oct 2015 10:50:07 +0200
Subject: [PATCH] Allow M-x man to reuse an existing window
* man.el (Man-notify-when-ready): add `manly' option.
(Man-notify-method): augment docstring accordingly.
---
lisp/man.el | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/lisp/man.el b/lisp/man.el
index c5dbcba..a02ee79 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -91,6 +91,8 @@
(require 'ansi-color)
(require 'cl-lib)
(require 'button)
+(require 'subr-x)
+(require 'seq)
(defgroup man nil
"Browse UNIX manual pages."
@@ -162,6 +164,8 @@ (defcustom Man-notify-method (if (boundp 'Man-notify) Man-notify 'friendly)
bully -- make the manpage the current buffer and only window (sf)
aggressive -- make the manpage the current buffer in the other window (sf)
friendly -- display manpage in the other window but don't make current (sf)
+manly -- like `friendly' but re-use a window displaying a man page if
+ possible (sf)
polite -- don't display manpage, but prints message and beep when ready
quiet -- like `polite', but don't beep
meek -- make no indication that the manpage is ready
@@ -1166,6 +1170,16 @@ (defun Man-notify-when-ready (man-buffer)
(and (frame-live-p saved-frame)
(select-frame saved-frame))
(display-buffer man-buffer 'not-this-window))
+ (`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)))
(`polite
(beep)
(message "Manual buffer %s is ready" (buffer-name man-buffer)))
--
2.4.6
next reply other threads:[~2015-10-08 15:54 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-08 15:54 Nicolas Richard [this message]
2015-10-09 14:37 ` bug#21649: 25.0.50; [PATCH] Allow M-x man to reuse an existing window Kaushal Modi
[not found] ` <86r3l09t3u.fsf@members.fsf.org>
2015-10-12 15:06 ` Kaushal Modi
2015-10-13 22:10 ` Nicolas Richard
2015-10-13 22:19 ` Kaushal Modi
2015-10-14 8:49 ` martin rudalics
[not found] ` <86wpufc8n8.fsf@members.fsf.org>
2015-10-22 15:34 ` martin rudalics
2015-10-22 19:21 ` Nicolas Richard
2015-10-23 8:01 ` martin rudalics
2016-03-01 15:49 ` Nicolas Richard
2016-03-01 17:04 ` martin rudalics
2016-03-10 9:55 ` Nicolas Richard
2016-03-10 10:32 ` martin rudalics
2016-03-10 13:49 ` Nicolas Richard
2015-10-27 11:30 ` Nicolas Richard
2015-10-28 9:55 ` martin rudalics
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877fmxz78l.fsf@members.fsf.org \
--to=youngfrog@members.fsf.org \
--cc=21649@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.