From: VanL <van@scratch.space>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 36927@debbugs.gnu.org
Subject: bug#36927: 26.2.90; include stdarg.h is without hyperlinking on vfprintf's manpage
Date: Sat, 10 Aug 2019 15:05:16 +1000 [thread overview]
Message-ID: <C1D9C6C8-5857-445E-9251-69DFBDFDEF7E@scratch.space> (raw)
In-Reply-To: <83ftmaa1av.fsf@gnu.org>
> On 9 Aug 2019, at 23:58, Eli Zaretskii <eliz@gnu.org> wrote:
>
>> Date: Mon, 05 Aug 2019 19:10:28 +0300
>> From: Eli Zaretskii <eliz@gnu.org>
>> Cc: 36927@debbugs.gnu.org
>>
>>> From: VanL <van@scratch.space>
>>> Date: Mon, 5 Aug 2019 11:51:56 +1000
>>>
>>> See manpage for vfprintf().
>>>
>>> Unlike the first instance of the #include preprocessing directive
>>>
>>> #include <stdio.h>
>>>
>>> at approximately line 12 of printf(3), which is underlined and
>>> hyperlinked, the second instance at approximately line 32, is not
>>> underlined and not hyperlinked.
>>>
>>> 1. M-x man RET vfprintf
>>> 2. on line 32 see #include <stdarg.h> which is without hyperlinking
>>
>> For some reason, we don't put a button on the second #include.
>
> The logic in Man-highlight-references0 was flawed: it assumed that a
> section ("SYNOPSIS", "FILES", "SEE ALSO", etc.) is always received
> entirely in a single chunk of text that is read from the subprocess,
> which is, of course, not guaranteed, and depends on factors such as
> the size of each section, buffering, how busy is the system, etc.
> (Those reasons also made this a bitch to debug, because a bug comes
> and goes unpredictably, and never shows when one steps with Edebug.)
Thanks.
That sounds really convoluted and this is what I can see
diff --git a/lisp/man.el b/lisp/man.el
index d52ca2156d..8858451b38 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -1288,8 +1288,23 @@ Man-highlight-references
(defun Man-highlight-references0 (start-section regexp button-pos target type)
;; Based on `Man-build-references-alist'
- (when (or (null start-section)
- (Man-find-section start-section))
+ (when (or (null start-section) ;; Search regardless of sections.
+ ;; Section header is in this chunk.
+ (Man-find-section start-section)
+ ;; Section header was in one of the previous chunks.
+ (save-excursion
+ (save-restriction
+ (let ((orig-pos (point)))
+ (widen)
+ (if (Man-find-section start-section)
+ ;; We are in the right section of the next
+ ;; section is either not yet in the buffer, or
+ ;; it starts after the position where we should
+ ;; start highlighting.
+ (progn
+ (forward-line 1)
+ (or (null (re-search-forward Man-heading-regexp nil t))
+ (> (point) orig-pos))))))))
(let ((end (if start-section
(progn
(forward-line 1)
> I think I made it much better on master, although I still see a rare
> case where one or the other "include" is not buttonized. But I've run
> out of time, so someone else will have to find and fix what I missed.
>
> I'm leaving this bug open because I don't think it's 100% fixed.
A possible way is to wait for all the subprocess sections to be done and to post-process on the fully collected buffer having lines like
line 11: .In stdio.h
line 24: .In stdarg.h
with buttonization transformation in theory like [1]
--
[1]
8.4 Computing with Lists
https://htdp.org/2019-02-24/part_two.html#%28part._sec~3aeval-list%29
next prev parent reply other threads:[~2019-08-10 5:05 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-05 1:51 bug#36927: 26.2.90; include stdarg.h is without hyperlinking on vfprintf's manpage VanL
2019-08-05 16:10 ` Eli Zaretskii
2019-08-06 2:36 ` VanL
2019-08-06 3:56 ` Eli Zaretskii
2019-08-06 7:22 ` VanL
2019-08-06 14:36 ` Eli Zaretskii
2019-08-07 8:57 ` VanL
2019-08-09 13:58 ` Eli Zaretskii
2019-08-10 5:05 ` VanL [this message]
2019-08-10 7:48 ` Eli Zaretskii
2019-08-11 5:26 ` VanL
2019-08-11 14:09 ` Eli Zaretskii
2019-08-18 22:37 ` Noam Postavsky
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=C1D9C6C8-5857-445E-9251-69DFBDFDEF7E@scratch.space \
--to=van@scratch.space \
--cc=36927@debbugs.gnu.org \
--cc=eliz@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.