[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] ol-man.el (org-man-open): Set window point not buffer point
From: |
Ihor Radchenko |
Subject: |
Re: [PATCH] ol-man.el (org-man-open): Set window point not buffer point |
Date: |
Tue, 09 Aug 2022 20:13:35 +0800 |
Tom Gillespie <tgbugs@gmail.com> writes:
> Hi Ihor,
> Here is an updated patch. We can't use accept-process-output
> because it doesn't seem to block in the way we need, or it blocks
> exactly long enough for the process to finish but then continues
> immediately to search instead of allowing the function that fills
> the buffer to complete. Instead I use sleep-for a shorter time and
> process-live-p which gives better results. I think I got the commit
> message formats right this time. Best!
Why not
(while (process-live-p process)
(accept-process-output process)))
then?
sleep-for is using similar machinery under the hood, but
accept-process-output does not require magic constants and in addition
handles various edge cases.
Also, compiling the patch yields
In org-man-open:
ol-man.el:54:16: Warning: ‘previous-line’ is for interactive use only; use
‘forward-line’ with negative argument instead.
> * lisp/ol-man.el (org-man-open): Set window point not buffer point
> When passed man:path::SEARCH org-man-open tries to use search-forward
> to jump to the location of e.g. a heading. Prior to this fix it only
> used search-forward, which will not change the point of the cursor in
> the window, meaning that even if there is a match it will not appear.
> Uses process-live-p and sleep-for to wait until the manpage finishes
> rendering before searching the buffer so that there will be something
> to find.
Please use double space " " between sentences and quote `org-man-open'
and similar Elisp symbols.
--
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92