From: Juri Linkov <juri@linkov.net>
To: Robert Pluim <rpluim@gmail.com>
Cc: "martin rudalics" <rudalics@gmx.at>,
"Ture Pålsson" <ture@turepalsson.se>,
"Stefan Kangas" <stefankangas@gmail.com>,
74924@debbugs.gnu.org
Subject: bug#74924: 29.3; Buffer showing manpage jumps back to beginning
Date: Mon, 06 Jan 2025 21:18:10 +0200 [thread overview]
Message-ID: <87ed1fvjil.fsf@mail.linkov.net> (raw)
In-Reply-To: <87seqm302a.fsf@gmail.com> (Robert Pluim's message of "Tue, 17 Dec 2024 14:34:37 +0100")
> This code from man.el should be setq-localʼing Man-columns
> unconditionally, I think (itʼs nil by default):
>
> (when (or window-system
> (not (or (getenv "MANWIDTH") (getenv "COLUMNS"))))
> ;; Since the page buffer is displayed beforehand,
> ;; we can select its window and get the window/frame width.
> (setq-local Man-columns (Man-columns))
> (setenv "COLUMNS" (number-to-string Man-columns)))
The problem is that the number returned by '(Man-columns)'
is inapplicable in case of "MANWIDTH".
So I will add a check for 'Man-columns' like below.
However, before pushing the patch, let's solve another problem
that the manpage window jumps back to the beginning
even on a window system. Here is the reproducible test case:
1. emacs -Q
2. M-x man RET man RET
3. C-M-v (scroll-other-window)
4. Reduce the width of the frame
5. manpage window jumps back to the beginning
So unless Martin has objections, I will also change
'with-current-buffer' to 'with-selected-window':
diff --git a/lisp/man.el b/lisp/man.el
index 29c3dec501c..ba4f01122e2 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -1300,8 +1300,9 @@ Man--window-state-change
(defun Man-fit-to-window (window)
"Adjust width of the buffer to fit columns into WINDOW boundaries."
(when (window-live-p window)
- (with-current-buffer (window-buffer window)
+ (with-selected-window window
(when (and (derived-mode-p 'Man-mode)
+ Man-columns
(not (eq Man-columns (Man-columns))))
(let ((proc (get-buffer-process (current-buffer))))
(unless (and proc (not (eq (process-status proc) 'exit)))
next prev parent reply other threads:[~2025-01-06 19:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-17 9:07 bug#74924: 29.3; Buffer showing manpage jumps back to beginning Ture Pålsson
2024-12-17 13:19 ` Stefan Kangas
2024-12-17 13:34 ` Robert Pluim
2024-12-28 11:39 ` Eli Zaretskii
2025-01-06 19:18 ` Juri Linkov [this message]
2025-01-08 9:56 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-09 7:40 ` Juri Linkov
2025-01-09 8:53 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-09 9:04 ` Eli Zaretskii
2025-01-09 9:35 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-09 14:38 ` Eli Zaretskii
2024-12-17 13:36 ` Eli Zaretskii
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ed1fvjil.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=74924@debbugs.gnu.org \
--cc=rpluim@gmail.com \
--cc=rudalics@gmx.at \
--cc=stefankangas@gmail.com \
--cc=ture@turepalsson.se \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).