From: Van Ly via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: eliz@gnu.org, 73656@debbugs.gnu.org
Subject: bug#73656: 30.0.91; icomplete-vertical has no matches for M-x man RET chdir
Date: Sat, 02 Nov 2024 03:04:30 +1100 [thread overview]
Message-ID: <dcs5xp7djox.fsf@SDF.ORG> (raw)
In-Reply-To: <jwved3wi1h0.fsf-monnier+emacs@gnu.org> (message from Stefan Monnier on Thu, 31 Oct 2024 14:15:55 -0400)
[-- Attachment #1: Type: text/plain, Size: 1149 bytes --]
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> [1:text/plain Hide]
>
>>>> + (if (eq system-type 'berkeley-unix) "-l")
>> As gap filler, the following change does not misbehave on deb or netbsd.
>
> I don't think we need a gap filler.
> How 'bout the patch below?
>
>
On NetBSD the patch fails to generate the icomplete-vertical-mode
autocomplete for "chd" when invoked in "emacs -Q" session. The man.elc
file was byte recompiled.
On debian the patch also fails. Emacs was configured --without-x and
has *Messages* buffer content referring to unbound image-scaling-factor
. Byte-Compile man.el? (y or n) y
. Compiling /u/van/src/emacs/30.0.91/lisp/man.el...done
. Wrote /u/van/src/emacs/30.0.91/lisp/man.elc
. Byte-Compile: 1 file.
. Quit
. Note, built-in variable ‘image-scaling-factor’ not bound
. You can run the command ‘icomplete-vertical-mode’ with M-x ic--m
. Note, built-in variable ‘image-scaling-factor’ not bound
Note, also, on debian the -l switch means as follows
-l, --local-file interpret PAGE argument(s) as local filename(s)
[-- Attachment #2: result from applied diff --]
[-- Type: application/octet-stream, Size: 3747 bytes --]
diff -u /u/van/src/emacs/30.0.91/lisp/man_orig_el /u/van/src/emacs/30.0.91/lisp/man.el
--- /u/van/src/emacs/30.0.91/lisp/man_orig_el 2024-09-12 07:10:33.000000000 +1000
+++ /u/van/src/emacs/30.0.91/lisp/man.el 2024-11-02 02:17:18.997424504 +1100
@@ -973,6 +973,27 @@
(search-forward-regexp "\\=, *\\([^ \t,]+\\)" bound t)))))
(nreverse table)))
+(defvar Man-man-k-flags
+ ;; It's not clear which man page will "always" be available, `man -k man'
+ ;; seems like the safest choice, but `man -k apropos' seems almost as safe
+ ;; and usually returns a much shorter output.
+ (with-temp-buffer
+ (with-demoted-errors "%S" (call-process "man" nil t nil "-k" "apropos"))
+ (let ((lines (count-lines (point-min) (point-max)))
+ (completions (Man-parse-man-k)))
+ (if (>= (length completions) lines)
+ '("-k") ;; "-k" seems to return sane results: look no further!
+ (erase-buffer)
+ ;; Try "-k -l" (bug#73656).
+ (with-demoted-errors "%S" (call-process "man" nil t nil
+ "-k" "-l" "apropos"))
+ (let ((lines (count-lines (point-min) (point-max)))
+ (completions (Man-parse-man-k)))
+ (if (>= (length completions) lines)
+ '("-k" "-l") ;; "-k -l" seems to return sane results.
+ '("-k"))))))
+ "List of arguments to pass to get the expected \"man -k\" output.")
+
(defun Man-completion-table (string pred action)
(cond
;; This ends up returning t for pretty much any string, and hence leads to
@@ -1009,19 +1030,23 @@
(ignore-errors
(process-file
manual-program nil '(t nil) nil
- "-k" (concat (when (or Man-man-k-use-anchor
- (string-equal prefix ""))
- "^")
- (if (string-equal prefix "")
- prefix
- ;; FIXME: shell-quote-argument
- ;; is not entirely
- ;; appropriate: we actually
- ;; need to quote ERE here.
- ;; But we don't have that, and
- ;; shell-quote-argument does
- ;; the job...
- (shell-quote-argument prefix))))))
+ ;; FIXME: When `process-file' runs on a remote hosts,
+ ;; `Man-man-k-flags' may be wrong.
+ `(,@Man-man-k-flags
+ ,(concat (when (or Man-man-k-use-anchor
+ (string-equal prefix ""))
+ "^")
+ (if (string-equal prefix "")
+ prefix
+ ;; FIXME: shell-quote-argument
+ ;; is not entirely
+ ;; appropriate: we actually
+ ;; need to quote ERE here.
+ ;; But we don't have that, and
+ ;; shell-quote-argument does
+ ;; the job...
+ (shell-quote-argument prefix)))))))
+
(setq table (Man-parse-man-k)))))
;; Cache the table for later reuse.
(when table
Diff finished. Sat Nov 2 02:29:09 2024
[-- Attachment #3: Type: text/plain, Size: 10 bytes --]
--
vl
next prev parent reply other threads:[~2024-11-01 16:04 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-06 12:38 bug#73656: 30.0.91; icomplete-vertical has no matches for M-x man RET chdir Van Ly via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-06 13:33 ` Eli Zaretskii
2024-10-06 14:33 ` Van Ly via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-06 14:48 ` Eli Zaretskii
2024-10-06 13:35 ` Eli Zaretskii
2024-10-06 14:54 ` Van Ly via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-06 16:10 ` Eli Zaretskii
2024-10-09 12:43 ` Van Ly via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-13 12:09 ` Eli Zaretskii
2024-10-15 5:20 ` Van Ly via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-17 17:48 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-18 0:37 ` Van Ly via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-19 9:42 ` Eli Zaretskii
2024-10-20 15:06 ` Van Ly via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-20 15:50 ` Eli Zaretskii
2024-10-21 2:26 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-22 9:31 ` Van Ly via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-25 5:34 ` Van Ly via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-31 18:15 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-01 16:04 ` Van Ly via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-11-01 17:52 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-16 13:43 ` Eli Zaretskii
2024-11-17 5:34 ` Van Ly via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-17 7:08 ` Eli Zaretskii
2024-11-17 21:56 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
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=dcs5xp7djox.fsf@SDF.ORG \
--to=bug-gnu-emacs@gnu.org \
--cc=73656@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=van.ly@SDF.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.