[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#36927: 26.2.90; include stdarg.h is without hyperlinking on vfprintf
bug#36927: 26.2.90; include stdarg.h is without hyperlinking on vfprintf's manpage
Sat, 10 Aug 2019 15:05:16 +1000
> On 9 Aug 2019, at 23:58, Eli Zaretskii <address@hidden> wrote:
>> Date: Mon, 05 Aug 2019 19:10:28 +0300
>> From: Eli Zaretskii <address@hidden>
>> Cc: address@hidden
>>> From: VanL <email@example.com>
>>> 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.)
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
@@ -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.
+ (let ((orig-pos (point)))
+ (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.
+ (forward-line 1)
+ (or (null (re-search-forward Man-heading-regexp nil t))
+ (> (point) orig-pos))))))))
(let ((end (if start-section
> 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 
8.4 Computing with Lists
bug#36927: 26.2.90; include stdarg.h is without hyperlinking on vfprintf's manpage, Eli Zaretskii, 2019/08/09
bug#36927: 26.2.90; include stdarg.h is without hyperlinking on vfprintf's manpage, Noam Postavsky, 2019/08/18