unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#73656: 30.0.91; icomplete-vertical has no matches for M-x man RET chdir
@ 2024-10-06 12:38 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 13:35 ` Eli Zaretskii
  0 siblings, 2 replies; 21+ messages in thread
From: Van Ly via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-06 12:38 UTC (permalink / raw)
  To: 73656

[-- Attachment #1: Type: text/plain, Size: 756 bytes --]




Hello,



The manpage auto-completions under icomplete-vertical mode won't list
chdir(2), fchdir(2) but will list acct(2).



To demonstrate,

 1. start, emacs -Q
 2. M-x icomplete-vertical
 3. M-x man RET

then very slowly type with 3 second delay a character, c h d i r, from
chd onwards the status feedback says [No matches], this is also the case
for fchdir.  At the end of the full sequence chdir or fchdir, despite
the status being [No matches] I depress RET and the manpage displays.

The manpage acct(2) will list in the auto-complete but if I type too
quick the *Messages* buffer shows: Waiting for process to die...done

Expected behavior, since acct(2) is listed by auto-complete in
icomplete-vertical mode, chdir(2) and fchdir(2) should.




[-- Attachment #2: bug-gnu-emacs report --]
[-- Type: application/octet-stream, Size: 4600 bytes --]

From: xxx@xxx.mail-host-address-is-not-set
To: bug-gnu-emacs@gnu.org
Subject: 30.0.91; x
X-Debbugs-Cc: 
--text follows this line--




In GNU Emacs 30.0.91 (build 2, x86_64--netbsd, X toolkit, cairo version
 1.18.0) of 2024-09-27 built on xxx
Windowing system distributor 'The X.Org Foundation', version 11.0.12101009
System Description: NetBSD xxx 10.0_STABLE NetBSD 10.0_STABLE (GENERIC) #0: Sat Sep 21 12:38:36 UTC 2024  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64

Configured using:
 'configure --srcdir=/u/xxx/src/emacs/30.0.91 --localstatedir=/var
 --disable-autodepend --with-native-compilation --without-ns --with-rsvg
 --without-imagemagick --without-xaw3d --without-toolkit-scroll-bars
 --x-includes=/usr/X11R7/include --x-libraries=/usr/X11R7/lib
 --with-x-toolkit=lu --prefix=/usr/local --build=x86_64--netbsd
 --host=x86_64--netbsd --infodir=/usr/pkg/info --mandir=/usr/pkg/man
 --enable-option-checking=yes 'CFLAGS=-O2 -I/usr/pkg/include/cairo
 -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/freetype2
 -I/usr/pkg/include/glib-2.0 -I/usr/pkg/include/gio-unix-2.0
 -I/usr/pkg/lib/glib-2.0/include -I/usr/X11R7/include
 -I/usr/pkg/include/harfbuzz -I/usr/X11R7/include/libdrm'
 'CPPFLAGS=-DTERMINFO -I/usr/pkg/include -I/usr/include
 -I/usr/pkg/include/freetype2 -I/usr/pkg/include/glib-2.0
 -I/usr/pkg/include/gio-unix-2.0 -I/usr/pkg/lib/glib-2.0/include
 -I/usr/X11R7/include -I/usr/pkg/include/harfbuzz
 -I/usr/X11R7/include/libdrm' 'LDFLAGS=-Wl,-R/usr/pkg/gcc13/lib
 -Wl,-zrelro -L/usr/pkg/lib -lcairo -L/usr/lib -Wl,-R/usr/lib
 -Wl,-R/usr/pkg/lib -L/usr/X11R7/lib -Wl,-R/usr/X11R7/lib
 -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lgnutls''

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GNUTLS GSETTINGS HARFBUZZ JPEG LCMS2
LIBOTF LIBXML2 MODULES NATIVE_COMP NOTIFY KQUEUE PDUMPER PNG RSVG SOUND
SQLITE3 THREADS TIFF TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM LUCID
ZLIB

Important settings:
  value of $LC_COLLATE: en_AU.UTF-8
  value of $LC_CTYPE: en_AU.UTF-8
  value of $LC_MESSAGES: en_AU.UTF-8
  value of $LC_MONETARY: en_AU.UTF-8
  value of $LC_NUMERIC: en_AU.UTF-8
  value of $LC_TIME: en_AU.UTF-8
  value of $LANG: en_AU.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  icomplete-vertical-mode: t
  icomplete-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util text-property-search time-date subr-x mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils tabify
imenu man ansi-color cus-start cus-load icomplete cl-loaddefs cl-lib rmc
iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd touch-screen tool-bar dnd fontset image regexp-opt
fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode
register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind kqueue lcms2 dynamic-setting system-font-setting
font-render-setting cairo x-toolkit xinput2 x multi-tty move-toolbar
make-network-process native-compile emacs)

Memory information:
((conses 16 62318 9310) (symbols 48 6714 0) (strings 32 17110 2606)
 (string-bytes 1 471596) (vectors 16 9719)
 (vector-slots 8 141188 8805) (floats 8 31 20) (intervals 56 651 0)
 (buffers 992 11))

[-- Attachment #3: Type: text/plain, Size: 10 bytes --]




-- 
vl

^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#73656: 30.0.91; icomplete-vertical has no matches for M-x man RET chdir
  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 13:35 ` Eli Zaretskii
  1 sibling, 1 reply; 21+ messages in thread
From: Eli Zaretskii @ 2024-10-06 13:33 UTC (permalink / raw)
  To: Van Ly; +Cc: 73656

> Date: Sun, 06 Oct 2024 12:38:04 +0000
> From:  Van Ly via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> The manpage auto-completions under icomplete-vertical mode won't list
> chdir(2), fchdir(2) but will list acct(2).
> 
> 
> 
> To demonstrate,
> 
>  1. start, emacs -Q
>  2. M-x icomplete-vertical
>  3. M-x man RET
> 
> then very slowly type with 3 second delay a character, c h d i r, from
> chd onwards the status feedback says [No matches], this is also the case
> for fchdir.  At the end of the full sequence chdir or fchdir, despite
> the status being [No matches] I depress RET and the manpage displays.
> 
> The manpage acct(2) will list in the auto-complete but if I type too
> quick the *Messages* buffer shows: Waiting for process to die...done

Most probably NetBSD-specific.





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#73656: 30.0.91; icomplete-vertical has no matches for M-x man RET chdir
  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 13:35 ` Eli Zaretskii
  2024-10-06 14:54   ` Van Ly via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 21+ messages in thread
From: Eli Zaretskii @ 2024-10-06 13:35 UTC (permalink / raw)
  To: Van Ly; +Cc: 73656

> Date: Sun, 06 Oct 2024 12:38:04 +0000
> From:  Van Ly via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> The manpage auto-completions under icomplete-vertical mode won't list
> chdir(2), fchdir(2) but will list acct(2).
> 
> 
> 
> To demonstrate,
> 
>  1. start, emacs -Q
>  2. M-x icomplete-vertical
>  3. M-x man RET
> 
> then very slowly type with 3 second delay a character, c h d i r, from
> chd onwards the status feedback says [No matches], this is also the case
> for fchdir.  At the end of the full sequence chdir or fchdir, despite
> the status being [No matches] I depress RET and the manpage displays.
> 
> The manpage acct(2) will list in the auto-complete but if I type too
> quick the *Messages* buffer shows: Waiting for process to die...done

Most probably NetBSD-specific.

What does "man -k chdir" say?





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#73656: 30.0.91; icomplete-vertical has no matches for M-x man RET chdir
  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
  0 siblings, 1 reply; 21+ messages in thread
From: Van Ly via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-06 14:33 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 73656


Eli Zaretskii <eliz@gnu.org> writes:



> Most probably NetBSD-specific.



At a guess, I thought the manpage sections are indexed somewhere.  That
chdir(2) and fchdir(2) won't list but acct(2) will dispels that theory.
All of section 2 wouldn't be listed.  Does emacs icomplete-vertical
manpage autocomplete lookup something like a locatedb for manpages and
that needs to update periodically? chdir(2) and fchdir(2) are
fundamental and would be indexed at the earliest run.  The status update
is incorrect where it says [No matches] at the full "chdir" manpage name
and RET displays the manpage.  I will ask the netbsd-users.



-- 
vl





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#73656: 30.0.91; icomplete-vertical has no matches for M-x man RET chdir
  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
  0 siblings, 0 replies; 21+ messages in thread
From: Eli Zaretskii @ 2024-10-06 14:48 UTC (permalink / raw)
  To: Van Ly; +Cc: 73656

> From: Van Ly <van.ly@sdf.org>
> Cc: 73656@debbugs.gnu.org
> Date: Sun, 06 Oct 2024 14:33:11 +0000
> 
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > Most probably NetBSD-specific.
> 
> At a guess, I thought the manpage sections are indexed somewhere.  That
> chdir(2) and fchdir(2) won't list but acct(2) will dispels that theory.
> All of section 2 wouldn't be listed.  Does emacs icomplete-vertical
> manpage autocomplete lookup something like a locatedb for manpages and
> that needs to update periodically? chdir(2) and fchdir(2) are
> fundamental and would be indexed at the earliest run.  The status update
> is incorrect where it says [No matches] at the full "chdir" manpage name
> and RET displays the manpage.  I will ask the netbsd-users.

We use "man -k", which is why I asked what does it say about chdir.





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#73656: 30.0.91; icomplete-vertical has no matches for M-x man RET chdir
  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
  0 siblings, 1 reply; 21+ messages in thread
From: Van Ly via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-06 14:54 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 73656

[-- Attachment #1: Type: text/plain, Size: 214 bytes --]


Eli Zaretskii <eliz@gnu.org> writes:

>
> What does "man -k chdir" say?
>

See attached output.

man -k chdir
  generates multiline context output

apropos -M chdir
 generates single line output for each manpage


[-- Attachment #2: man -k chdir output; apropos -M chdir --]
[-- Type: application/octet-stream, Size: 24373 bytes --]

  1 $ man -k chdir
  2 man -k chdir
  3 chdir (2)	change current working directory
  4 chdir
  5 
  6 posix_spawn_file_actions_addchdir (3)	add chdir or fchdir action to spawn file actions object
  7 The posix_spawn_file_actions_addchdir function adds a chdir action to the object referenced by file_actions that causes the working directory to be set to path (as if chdir(path) had been called) for a new process spawned...
  8 
  9 rexecd (8)	remote execution server
 10 ...No password file entry for the user name existed. Password incorrect. The wrong password was supplied. No remote directory. The chdir(2) to the home directory failed. Try again. A fork(2) by the server failed. <shellname>: ... The user's...
 11 
 12 rshd (8)	remote shell server
 13 ...list (as configured into the system). Login incorrect. No password file entry for the user name existed. Remote directory. The chdir(2) to the home directory failed. Permission denied. The authentication procedure described above failed. Can't make pipe. The...
 14 
 15 ftw (3)	traverse (walk) a file tree
 16 ...tree in pre-order. FTW_CHDIR Change to a directory before reading it. By default, nftw will change its starting directory. The current working directory will be restored to its original value before nftw returns. chdir(2) , close(2) , open...
 17 
 18 fts (3)	traverse a file hierarchy
 19 ...errors specified for the library functions chdir(2) and close(2) . The functions fts_read and fts_children may fail and set errno for any of the errors specified for the library functions chdir(2) , malloc(3) , opendir(3) , readdir...
 20 
 21 cd (1)	change working directory
 22 ...directory operand is an absolute or relative pathname which becomes the new working directory. The interpretation of a relative pathname by cd depends on the CDPATH environment variable (see below). csh(1) , ksh(1) , pwd(1) , sh(1) , chdir(2)
 23 
 24 chroot (8)	change root directory
 25 ...2) , getgrnam(3) , and getpwnam(3) . Note: command or the shell are run as your real-user-id. ldd(1) , chdir(2) , chroot(2) , environ(7) chroot should never be installed setuid root, as it would then be possible to...
 26 
 27 chroot (2)	change root directory
 28 ...other systems, chroot has no effect on the process's current directory. This call is restricted to the super-user. The fchroot function performs the same operation on an open directory file known by the file descriptor fd . chdir(2)
 29 
 30 bootpef (8)	BOOTP Extension File compiler
 31 ...tag 18). If any client-name arguments are specified, then bootpef compiles the extension files for only those clients. -c  chdir-path Sets the current directory used by bootpef while creating extension files.  This is useful when the extension file...
 32 
 33 pam_chroot (8)	Chroot PAM module
 34 ...derived from the user's home directory, and the dir option was not specified. cwd = directory Specify the directory to chdir(2) into after a successful chroot(2) call. dir = directory Specify the chroot directory to use if one could...
 35 
 36 bindtextdomain (3)	set directory containing message catalogs
 37 ...set to dirname. The function makes copies of the argument strings as needed. If the program wishes to call the chdir function, it is important that dirname be an absolute pathname; otherwise it cannot be guaranteed that the message catalogs...
 38 
 39 Tcl_GetCwd (3)	manipulate the current working directory
 40 ...must call Tcl_DStringFree() when the result is no longer needed. The format of the path is UTF-8. Tcl_Chdir changes the applications current working directory to the value specified in dirName.  The format of the passed in string...
 41 
 42 getcwd (3)	get working directory pathname
 43 ...error-prone method of accomplishing this is to open the current directory . and use the fchdir(2) function to return. chdir(2) , fchdir(2) , malloc(3) , strerror(3) As getwd does not know the length of the supplied buffer, it...
 44 
 45 ukfs (3)	user kernel file system library interface
 46 ...unmount the file system. This means that any busy nodes (due to e.g. ukfs_chdir ) will be ignored. Release always succeeds. int ukfs_chdir struct ukfs *ukfs const char *path int ukfs_getdents struct ukfs *ukfs const char *dirname...
 47 
 48 clone (2)	spawn new process with options
 49 ...used for new native NetBSD applications. It is provided as a means to port software originally written for the Linux operating system to NetBSD . chdir(2) , chroot(2) , fork(2) , sigaction(2) , sigprocmask(2) , umask(2) , vfork(2) , wait(2)
 50 
 51 git-sh-setup (1)	Common Git shell script setup code
 52 ...indicate if the repository is a bare repository (i.e. without an associated working tree). cd_to_toplevel 4 runs chdir to the toplevel of the working tree. require_work_tree 4 checks if the current directory is within the...
 53 
 54 perlstyle (1)	Perl style guide
 55 ...if $opt_c;     $IDX = $ST_SIZE        if $opt_s;      mkdir $tmpdir, 0700 or die "cant mkdir $tmpdir: $!";     chdir($tmpdir)      or die "cant chdir $tmpdir: $!";     mkdir tmp,   0777 or die "cant mkdir $tmpdir/tmp: $!"; R  4 Always check the return codes...
 56 
 57 setuid (7)	checklist for security of setuid programs
 58 ...induced to carelessly give away its special privileges. The directory the program is started in, or directories it may plausibly chdir(2) to, may contain programs with the same names as system programs, placed there in hopes that the program...
 59 
 60 perlfork (1)	Perl's fork() emulation
 61 ...or pseudo-processes) launched from it. chdir() and all other builtins that accept filenames 8 Each pseudo-process maintains its own virtual idea of the current directory. Modifications to the current directory using chdir() are only visible within that pseudo...
 62 
 63 execve (2)	execute a file
 64 ...parent process ID see getppid(2) process group ID see getpgrp(2) access groups see getgroups(2) working directory see chdir(2) root directory see chroot(2) control terminal see termios(4) resource usages see getrusage(2) interval timers see...
 65 
 66 vnsubr (9)	high-level convenience functions for vnode operations
 67 ...the vnode dvp . The argument l is the calling process. vn_isunder is intended to be used in chroot(2) , chdir(2) , fchdir(2) , etc., to ensure that chroot(2) actually means something. If the operation is successful zero is...
 68 
 69 bootpd (8)	Internet Boot Protocol server/gateway
 70 ...versions of bootpd , omitting the numeric parameter (i.e. just -d) will simply increment the debug level by one. -c  chdir-path Sets the current directory used by bootpd while checking the existence and size of client boot files.  This...
 71 
 72 named-checkzone (1)	zone file validity checking or converting tool
 73 ...also present. Possible modes are warn (the default) and ignore. 168u 0.0 -w directory This option instructs named to chdir to directory, so that relative filenames in master file $INCLUDE directives work. This is similar to the directory clause...
 74 
 75 perlop (1)	Perl operators and precedence
 76 ...CW     chdir $foo    || die;       # (chdir $foo) || die     chdir($foo)   || die;       # (chdir $foo) || die     chdir ($foo)  || die;       # (chdir $foo) || die     chdir +($foo) || die;       # (chdir $foo) || die R but, because "*" is higher precedence than named operators: CW     chdir $foo * 20;    # chdir ($foo...
 77 
 78 perl58delta (1)	what is new for perl v5.8.0
 79 ...allowed to escape the laboratory has been decommissioned.  4 Using chdir("") or chdir(undef) instead of explicit chdir() is doubtful.  A failure (think chdir(some_function()) can lead into unintended chdir() to the home directory, therefore this behaviour is deprecated...
 80 
 81 sigaction (2)	software signal facilities
 82 ...exit(2) , abort(3) , accept(2) , access(2) , alarm(3) , bind(2) , cfgetispeed(3) , cfgetospeed(3) , cfsetispeed(3) , cfsetospeed(3) , chdir(2) , chmod(2) , chown(2) , clock_gettime(2) , close(2) , connect(2) , creat(3) , dup(2) , dup2(2) , execle...
 83 
 84 Tcl_FSRegister (3)	procedures to interact with any filesystem
 85 ...to access this and related functions, while ensuring the results are always valid. Tcl_FSChdir replaces the library version of chdir. The path is normalized and then passed to the filesystem which claims it. If that filesystem does not implement...
 86 
 87 perltrap (1)	Perl traps for the unwary
 88 ...t ever get them confused.  4 You cannot discern from mere inspection which builtins are unary operators (like chop() and chdir()) and which are list operators (like print() and unlink()). (Unless prototyped, user-defined subroutines can only be list operators...
 89 
 90 perl5240delta (1)	what is new for perl v5.24.0
 91 ...on the string (or a copy) first. chdir() no longer chdirs home Using chdir() or chdir(undef) to chdir home has been deprecated since perl v5.8, and will now fail.  Use chdir() instead. ASCII characters in variable names must...
 92 
 93 bootptab (5)	Internet Bootstrap Protocol server database
 94 ...be used to inform bootpd of this special root directory used by tftpd . (One may alternatively use the bootpd "-c chdir" option.) The hd tag is actually relative to the root directory specified by the td tag. For example, if...
 95 
 96 Git (3)	Perl interface to the Git version control system
 97 ...copy (unless you work with a bare repository). You can also navigate inside of the working copy using the wc_chdir() method. (Note that the repository object is self-contained and will not change working directory of your process.) TODO...
 98 
 99 sftp (1)	OpenSSH secure file transfer
100 ...standard input. sftp will abort if any of the following commands fail: get , put , reget , reput , rename , ln , rm , mkdir , chdir , ls , lchdir , copy , cp , chmod , chown , chgrp , lpwd , df , symlink , and lmkdir . Termination on error can be suppressed on...
101 
102 perl5100delta (1)	what is new for perl 5.10.0
103 ...number to specify that you want to use a version of perl older than the specified one. "chdir", "chmod" and "chown" on filehandles "chdir", "chmod" and "chown" can now work on filehandles as well as filenames, if the system supports...
104 
105 emacs (1)	GNU project Emacs editor
106 ...and the number). This applies only to the next file specified. + line:column Go to the specified line and column . --chdir= directory Change to directory . -q ,  --no-init-file Do not load an init file. -nl ,  --no-shared-memory Do...
107 
108 perlunifaq (1)	Perl Unicode FAQ
109 ...that should not happen, Perl also throws a "wide character" warning in this case. Other output mechanisms (e.g., "exec", "chdir", ..) Your text string will be sent using the bytes in Perl's internal format. Because the internal format is...
110 
111 rc.subr (8)	functions used by system shell scripts
112 ...default start method. required_vars Perform checkyesno on each of the list variables before running the default start method. ${name}_chdir Directory to cd to before running command , if ${name}_chroot is not provided. ${name}_chroot Directory to chroot(8...
113 
114 perlthrtut (1)	Tutorial on threads in Perl
115 ...state, affecting all the threads. The most common example of this is changing the current working directory using chdir().  One thread calls chdir(), and the working directory of all the threads changes. Even more drastic example of a process-scope...
116 
117 csh (1)	a shell (command interpreter) with C-like syntax
118 ...switch , resuming after the endsw . case label : A label in a switch statement as discussed below. cd cd name chdir chdir name Change the shell's working directory to directory name . If no argument is given then change to the...
119 
120 ftpd (8)	Internet File Transfer Protocol server
121 ...the a anondir directory (if set), or to the home directory of the ftp user. The server then performs a chdir(2) to the directory specified in the ftpd.conf(5) homedir directive (if set), otherwise to / . If other restrictions...
122 
123 perlipc (1)	Perl interprocess communication (signals, fifos, pipes, safe subprocesses, sockets, and semaphores)
124 ...that random output doesn't wind up on the user's terminal. CW  use POSIX "setsid";   sub daemonize {      chdir("/")                     || die "cant chdir to /: $!";      open(STDIN,  "<", "/dev/null") || die "cant read /dev/null: $!";      open(STDOUT, ">", "/dev/null") || die "cant write /dev...
125 
126 perlsub (1)	Perl subroutines
127 ...via the import syntax, and these names may then override built-in ones: CW     use subs chdir, chroot, chmod, chown;     chdir $somewhere;     sub chdir { ... } R To unambiguously refer to the built-in form, precede the built-in name with the...
128 
129 perlrun (1)	how to execute the Perl interpreter
130 ...if specified, must appear immediately following the -x with no intervening whitespace. HOME 12 Used if "chdir" has no argument. LOGDIR 12 Used if "chdir" has no argument and "HOME" is not set. PATH 12 Used in executing subprocesses, and...
131 
132 make (1)	maintain program dependencies
133 ...so that the mode of make operation does not change their behavior. For example, any command which uses cd or chdir without the intention of changing the directory for subsequent commands should be put in parentheses so it executes in...
134 
135 perl588delta (1)	what is new for perl v5.8.8
136 ...are no changes intentionally incompatible with 5.8.7. If any exist, they are bugs and reports are welcome.  4 "chdir", "chmod" and "chown" can now work on filehandles as well as filenames, if the system supports respectively "fchdir", "fchmod...
137 
138 amd.conf (5)	Amd configuration file
139 ...mounts.  This has the advantage of mounting in place, and users get to the see the same pathname that they chdir'ed into.  If this option is set to "no," then Amd will use symlinks instead: that code is more...
140 
141 perlport (1)	Writing portable Perl
142 ...be affected after the call, and the filehandle may be flushed. chdir 8 (Win32) The current directory reported by the system may include any symbolic links specified to chdir(). chmod 8 (Win32) Only good for changing "owner" read-write access...
143 
144 perl5260delta (1)	what is new for perl v5.26.0
145 ...and modules), then add "." back into the path; e.g.: CW     BEGIN {         my $dir = "/some/trusted/directory";         chdir $dir or die "Cant chdir to $dir: $!n";         # safe now         push @INC, .;     }      use "Foo::Bar"; # may load /some/trusted/directory/Foo/Bar...
146 
147 perlfunc (1)	Perl builtin functions
148 ...args is actually a hybrid of the current state and initial state of @_.  Buyer beware. chdir EXPR 4 0 chdir FILEHANDLE 4 chdir DIRHANDLE 4 chdir 4 Changes the working directory to EXPR, if possible.  If EXPR is omitted, changes...
149 
150 perltoc (1)	perl documentation table of contents
151 ...package "main":, Bless the referred-to item into the current package (not inheritable):, break, caller EXPR    , caller, chdir EXPR   , chdir FILEHANDLE, chdir DIRHANDLE, chdir, chmod LIST   , chomp VARIABLE    , chomp( LIST ), chomp, chop VARIABLE , chop( LIST ), chop, chown LIST  , chr NUMBER...
152 
153 perltie (1)	how to hide an object class in a simple variable
154 ...the return values out of a readdir, you'd better prepend the directory in question.  Otherwise, because we didn't chdir() there, it would have been testing the wrong file. FETCH this, key 4 This method will be triggered every...
155 
156 perl561delta (1)	what's new for perl v5.6.1
157 ...name was not known.  It now correctly uses the supplied port number as is. File::Find 4 File::Find now chdir()s correctly when chasing symbolic links. xsubpp 4 xsubpp now tolerates embedded POD sections. "no Module;" 4 "no Module...
158 
159 perlfaq8 (1)	System Interaction
160 ...R The trick in this task is to find the directory. Before your script does anything else (such as a "chdir"), you can get the current working directory with the "Cwd" module, which comes with Perl: CW     BEGIN {         use Cwd...
161 
162 perl589delta (1)	what is new for perl v5.8.9
163 ...on VMS. Windows  4 "File::Find" used to fail when the target directory is a bare drive letter and "no_chdir" is 1 (the default is 0). [RT #41555]  4 A build problem with specifying "USE_MULTI" and "USE_ITHREADS...
164 
165 mail (1)	send and receive mail
166 ...the old To field minus the user's local address and any on the alternates list. (See the alternates command.) chdir c Changes the user's working directory to that specified, if given. If no directory is given, then changes...
167 
168 perlvms (1)	VMS-specific documentation for Perl
169 ...Perl (functions marked with * are discussed in more detail below): CW     file tests*, abs, alarm, atan, backticks*, binmode*, bless,     caller, chdir, chmod, chown, chomp, chop, chr,     close, closedir, cos, crypt*, defined, delete, die, do, dump*,      each, endgrent, endpwent, eof, eval...
170 
171 git (1)	the stupid content tracker
172 ...be a colon-separated list of absolute paths. If set, it is a list of directories that Git should not chdir up into while looking for a repository directory (useful for excluding slow-loading network directories). It will not exclude...
173 
174 perlmodlib (1)	constructing new Perl modules and finding existing ones
175 ...of single quotes). CW     % perl -MFile::Find=find -MFile::Spec::Functions -Tlwe        find { wanted => sub { print canonpath $_ if /.pmz/ },       no_chdir => 1 }, @INC R (The -T is here to prevent @INC from being populated by "PERL5LIB", "PERLLIB", and "PERL_USE...
176 
177 perlglossary (1)	Perl Glossary
178 ...youll ordinarily deny access to. See the "umask" function. unary operator 4 An operator with only one operand, like "!" or "chdir". Unary operators are usually prefix operators; that is, they precede their operand. The "++" and "" operators can be either prefix...
179 
180 rsyncd.conf (5)	configuration file for rsync in daemon mode
181 ...It is also possible to specify a dot-dir in the module's "path" to indicate that you want to chdir to the earlier part of the path and then serve files from inside the latter part of the path...
182 
183 perl5220delta (1)	what is new for perl v5.22.0
184 ...In deparsing feature bundles, "B::Deparse" was emitting "no feature;" first instead of "no feature :all;".  This has been fixed. "chdir FH" is now deparsed without quotation marks. "my @a" is now deparsed without parentheses.  (Parenthese would flatten the array...
185 
186 find (1)	search for files in a directory hierarchy
187 ...hard links, the leaf optimisation will often mean that find knows that it doesn't need to call stat() or chdir() on the symbolic link, so this diagnostic is frequently not necessary. The -d option is supported for compatibility with...
188 
189 perldiag (1)	various Perl diagnostics
190 ...was not attached to the symbol table. Can't chdir to %s 4 (F) You called "perl -x/foo/bar", but /foo/bar is not a directory that you can chdir to, possibly because it doesn't exist. Can't...
191 
192 perlunicode (1)	Unicode support in Perl
193 ...concept.  Similarly for "qx" and "system": how well will the "command-line interface" (and which of them?) handle Unicode?  4 "chdir", "chmod", "chown", "chroot", "exec", "link", "lstat", "mkdir", "rename", "rmdir", "stat", "symlink", "truncate", "unlink", "utime", "-X"  4 %ENV  4 "glob...
194 
195 perlos2 (1)	Perl under OS/2, DOS, Win0.3*, Win0.95 and WinNT.
196 ...File::Copy. "DynaLoader::mod2fname" 4 used by "DynaLoader" for DLL name mangling. Cwd::current_drive() 4 Self explanatory. Cwd::sys_chdir(name) 4 leaves drive as it is. Cwd::change_drive(name) 4 changes the "current" drive. Cwd::sys_is...
197 
198 perl56delta (1)	what's new for perl v5.6.0
199 ...other options to control its behavior.  It can follow symbolic links if the "follow" option is specified.  Enabling the "no_chdir" option will make File::Find skip changing the current directory when walking directories.  The "untaint" flag can be useful...
200 
201 sh (1)	command interpreter (shell)
202 ...print out the name of the directory that it actually switched to; that is, the pathname passed to the successful chdir(2) system call if this is different from the name that the user gave, or if the cdprint option...
203 
204 perl5160delta (1)	what is new for perl v5.16.0
205 ...resulting in a failure to call the method, due to memory corruption  4 Assignments like "*$tied = &{"..."}" and "*glob = $tied"  4 "chdir", "chmod", "chown", "utime", "truncate", "stat", "lstat" and the filetest ops ("-r", "-x", etc.) 4  4 "caller" sets @DB::args...
206 
207 rsync (1)	a fast, versatile, remote (and local) file-copying tool
208 ...followed by a slash, so "/foo/." would not be abbreviated.) For older rsync versions, you would need to use a chdir to limit the source path.  For example, when pushing files: 4 (cd /foo; rsync -avR bar/baz.c remote...


 1 $ apropos -M chdir
 2 apropos -M chdir
 3 chdir (2)	change current working directory
 4 posix_spawn_file_actions_addchdir (3)	add chdir or fchdir action to spawn file actions object
 5 rexecd (8)	remote execution server
 6 rshd (8)	remote shell server
 7 ftw (3)	traverse (walk) a file tree
 8 fts (3)	traverse a file hierarchy
 9 cd (1)	change working directory
10 chroot (8)	change root directory
11 chroot (2)	change root directory
12 bootpef (8)	BOOTP Extension File compiler
13 pam_chroot (8)	Chroot PAM module
14 bindtextdomain (3)	set directory containing message catalogs
15 Tcl_GetCwd (3)	manipulate the current working directory
16 getcwd (3)	get working directory pathname
17 ukfs (3)	user kernel file system library interface
18 clone (2)	spawn new process with options
19 git-sh-setup (1)	Common Git shell script setup code
20 perlstyle (1)	Perl style guide
21 setuid (7)	checklist for security of setuid programs
22 perlfork (1)	Perl's fork() emulation
23 execve (2)	execute a file
24 vnsubr (9)	high-level convenience functions for vnode operations
25 bootpd (8)	Internet Boot Protocol server/gateway
26 named-checkzone (1)	zone file validity checking or converting tool
27 perlop (1)	Perl operators and precedence
28 perl58delta (1)	what is new for perl v5.8.0
29 sigaction (2)	software signal facilities
30 Tcl_FSRegister (3)	procedures to interact with any filesystem
31 perltrap (1)	Perl traps for the unwary
32 perl5240delta (1)	what is new for perl v5.24.0
33 bootptab (5)	Internet Bootstrap Protocol server database
34 Git (3)	Perl interface to the Git version control system
35 sftp (1)	OpenSSH secure file transfer
36 perl5100delta (1)	what is new for perl 5.10.0
37 emacs (1)	GNU project Emacs editor
38 perlunifaq (1)	Perl Unicode FAQ
39 rc.subr (8)	functions used by system shell scripts
40 perlthrtut (1)	Tutorial on threads in Perl
41 csh (1)	a shell (command interpreter) with C-like syntax
42 ftpd (8)	Internet File Transfer Protocol server
43 perlipc (1)	Perl interprocess communication (signals, fifos, pipes, safe subprocesses, sockets, and semaphores)
44 perlsub (1)	Perl subroutines
45 perlrun (1)	how to execute the Perl interpreter
46 make (1)	maintain program dependencies
47 perl588delta (1)	what is new for perl v5.8.8
48 amd.conf (5)	Amd configuration file
49 perlport (1)	Writing portable Perl
50 perl5260delta (1)	what is new for perl v5.26.0
51 perlfunc (1)	Perl builtin functions
52 perltoc (1)	perl documentation table of contents
53 perltie (1)	how to hide an object class in a simple variable
54 perl561delta (1)	what's new for perl v5.6.1
55 perlfaq8 (1)	System Interaction
56 perl589delta (1)	what is new for perl v5.8.9
57 mail (1)	send and receive mail
58 perlvms (1)	VMS-specific documentation for Perl
59 git (1)	the stupid content tracker
60 perlmodlib (1)	constructing new Perl modules and finding existing ones
61 perlglossary (1)	Perl Glossary
62 rsyncd.conf (5)	configuration file for rsync in daemon mode
63 perl5220delta (1)	what is new for perl v5.22.0
64 find (1)	search for files in a directory hierarchy
65 perldiag (1)	various Perl diagnostics
66 perlunicode (1)	Unicode support in Perl
67 perlos2 (1)	Perl under OS/2, DOS, Win0.3*, Win0.95 and WinNT.
68 perl56delta (1)	what's new for perl v5.6.0
69 sh (1)	command interpreter (shell)
70 perl5160delta (1)	what is new for perl v5.16.0
71 rsync (1)	a fast, versatile, remote (and local) file-copying tool

[-- Attachment #3: Type: text/plain, Size: 9 bytes --]



-- 
vl

^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#73656: 30.0.91; icomplete-vertical has no matches for M-x man RET chdir
  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
  0 siblings, 1 reply; 21+ messages in thread
From: Eli Zaretskii @ 2024-10-06 16:10 UTC (permalink / raw)
  To: Van Ly, Stefan Monnier; +Cc: 73656

> From: Van Ly <van.ly@sdf.org>
> Cc: 73656@debbugs.gnu.org
> Date: Sun, 06 Oct 2024 14:54:58 +0000
> 
> > What does "man -k chdir" say?
> >
> 
> See attached output.

I think this points out the problem: man.el expects a different
format, as documented in the doc string of Man-parse-man-k.  But maybe
I'm missing something, so I'll let others chime in.

My suggestion is to step with Edebug through Man-parse-man-k and see
what's wrong there.





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#73656: 30.0.91; icomplete-vertical has no matches for M-x man RET chdir
  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
  0 siblings, 1 reply; 21+ messages in thread
From: Van Ly via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-09 12:43 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 73656, monnier


Eli Zaretskii <eliz@gnu.org> writes:

>
> I think this points out the problem: man.el expects a different
> format, as documented in the doc string of Man-parse-man-k.  But maybe
> I'm missing something, so I'll let others chime in.
>
> My suggestion is to step with Edebug through Man-parse-man-k and see
> what's wrong there.
>



The netbsd-users say legacy behavior for "man -k output" is obtained by



 $ man -k -l chdir
 $ apropos -l chdir
 $ env APROPOS="-l" emacs -Q



The Edebug session would cycle to line 16 below (line 953 in man.el)
foreach of the characters from chdir during icomplete-vertical
autocomplete to find no matches.



 1 (defun Man-parse-man-k ()
 2   "Parse \"man -k\" output and return the list of page names.
 3 
 4 The current buffer should contain the output of a command of the
 5 form \"man -k keyword\", which is traditionally also available with
 6 apropos(1).
 7 
 8 While POSIX man(1p) is a bit vague about what to expect here,
 9 this function tries to parse some commonly used formats, which
10 can be described in the following informal way, with square brackets
11 indicating optional parts and whitespace being interpreted
12 somewhat loosely.
13 
14 foo[, bar [, ...]] [other stuff] (sec) - description
15 foo(sec)[, bar(sec) [, ...]] [other stuff] - description"
16   (goto-char (point-min))
17   ;; See man-tests for data about which systems use which format (hopefully we
18   ;; will be able to simplify the code if/when some of those formats aren't
19   ;; used any more).
20   (let (table)
21     (while (search-forward-regexp "^\\([^ \t,\n]+\\)\\(.*?\\)\
22 \\(?:[ \t]\\(([^ \t,\n]+?)\\)\\)?\\(?:[ \t]+- ?\\(.*\\)\\)?$" nil t)
23       (let ((section (match-string 3))
24 	    (description (match-string 4))
25 	    (bound (match-end 2)))
26         (goto-char (match-end 1))
27 	(while
28             (progn
29               ;; The first regexp grouping may already match the section
30               ;; tacked on to the name, which is ok since for the formats we
31               ;; claim to support the third (non-shy) grouping does not
32               ;; match in this case, i.e., section is nil.
33               (push (propertize (concat (match-string 1) section)
34                                 'help-echo description)
35                     table)
36               (search-forward-regexp "\\=, *\\([^ \t,]+\\)" bound t)))))
37     (nreverse table)))


-- 
vl





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#73656: 30.0.91; icomplete-vertical has no matches for M-x man RET chdir
  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
  0 siblings, 1 reply; 21+ messages in thread
From: Eli Zaretskii @ 2024-10-13 12:09 UTC (permalink / raw)
  To: Van Ly; +Cc: 73656, monnier

> From: Van Ly <van.ly@sdf.org>
> Cc: monnier@iro.umontreal.ca, 73656@debbugs.gnu.org
> Date: Wed, 09 Oct 2024 23:43:12 +1100
> 
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >
> > I think this points out the problem: man.el expects a different
> > format, as documented in the doc string of Man-parse-man-k.  But maybe
> > I'm missing something, so I'll let others chime in.
> >
> > My suggestion is to step with Edebug through Man-parse-man-k and see
> > what's wrong there.
> >
> 
> 
> 
> The netbsd-users say legacy behavior for "man -k output" is obtained by
> 
> 
> 
>  $ man -k -l chdir
>  $ apropos -l chdir
>  $ env APROPOS="-l" emacs -Q
> 
> 
> 
> The Edebug session would cycle to line 16 below (line 953 in man.el)
> foreach of the characters from chdir during icomplete-vertical
> autocomplete to find no matches.
> 
> 
> 
>  1 (defun Man-parse-man-k ()
>  2   "Parse \"man -k\" output and return the list of page names.
>  3 
>  4 The current buffer should contain the output of a command of the
>  5 form \"man -k keyword\", which is traditionally also available with
>  6 apropos(1).
>  7 
>  8 While POSIX man(1p) is a bit vague about what to expect here,
>  9 this function tries to parse some commonly used formats, which
> 10 can be described in the following informal way, with square brackets
> 11 indicating optional parts and whitespace being interpreted
> 12 somewhat loosely.
> 13 
> 14 foo[, bar [, ...]] [other stuff] (sec) - description
> 15 foo(sec)[, bar(sec) [, ...]] [other stuff] - description"
> 16   (goto-char (point-min))
> 17   ;; See man-tests for data about which systems use which format (hopefully we
> 18   ;; will be able to simplify the code if/when some of those formats aren't
> 19   ;; used any more).
> 20   (let (table)
> 21     (while (search-forward-regexp "^\\([^ \t,\n]+\\)\\(.*?\\)\
> 22 \\(?:[ \t]\\(([^ \t,\n]+?)\\)\\)?\\(?:[ \t]+- ?\\(.*\\)\\)?$" nil t)
> 23       (let ((section (match-string 3))
> 24 	    (description (match-string 4))
> 25 	    (bound (match-end 2)))
> 26         (goto-char (match-end 1))
> 27 	(while
> 28             (progn
> 29               ;; The first regexp grouping may already match the section
> 30               ;; tacked on to the name, which is ok since for the formats we
> 31               ;; claim to support the third (non-shy) grouping does not
> 32               ;; match in this case, i.e., section is nil.
> 33               (push (propertize (concat (match-string 1) section)
> 34                                 'help-echo description)
> 35                     table)
> 36               (search-forward-regexp "\\=, *\\([^ \t,]+\\)" bound t)))))
> 37     (nreverse table)))

If you edit this part of Man-completion-table:

          (let ((process-environment (copy-sequence process-environment)))
            (setenv "COLUMNS" "999") ;; don't truncate long names
            ;; manual-program might not even exist.  And since it's
            ;; run differently in Man-getpage-in-background, an error
            ;; here may not necessarily mean that we'll also get an
            ;; error later.
            (when (eq 0
                      (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))))))
              (setq table (Man-parse-man-k)))))

to use "-k" "-l" instead of "-k" in the line I emphasized, does that
solve the problem?





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#73656: 30.0.91; icomplete-vertical has no matches for M-x man RET chdir
  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
  0 siblings, 1 reply; 21+ messages in thread
From: Van Ly via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-15  5:20 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 73656, monnier

[-- Attachment #1: Type: text/plain, Size: 1690 bytes --]


Eli Zaretskii <eliz@gnu.org> writes:

>
> If you edit this part of Man-completion-table:
>
>           (let ((process-environment (copy-sequence process-environment)))
>             (setenv "COLUMNS" "999") ;; don't truncate long names
>             ;; manual-program might not even exist.  And since it's
>             ;; run differently in Man-getpage-in-background, an error
>             ;; here may not necessarily mean that we'll also get an
>             ;; error later.
>             (when (eq 0
>                       (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))))))
>               (setq table (Man-parse-man-k)))))
>
> to use "-k" "-l" instead of "-k" in the line I emphasized, does that
> solve the problem?
>

Yes.  See diff patch on man.el .




[-- Attachment #2: diff patch on man.el --]
[-- Type: application/octet-stream, Size: 1239 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-10-15 16:10:59.851430686 +1100
@@ -977,7 +977,7 @@
   (cond
    ;; This ends up returning t for pretty much any string, and hence leads to
    ;; spurious "complete but not unique" messages.  And since `man' doesn't
-   ;; require-match anyway, there's not point being clever.
+   ;; require-match anyway, there's no point being clever.
    ;;((eq action 'lambda) (not (string-match "([^)]*\\'" string)))
    ((equal string "-k")
     ;; Let SPC (minibuffer-complete-word) insert the space.
@@ -1009,7 +1009,7 @@
                       (ignore-errors
                         (process-file
                          manual-program nil '(t nil) nil
-                         "-k" (concat (when (or Man-man-k-use-anchor
+                         "-k" "-l" (concat (when (or Man-man-k-use-anchor
                                                 (string-equal prefix ""))
                                         "^")
                                       (if (string-equal prefix "")

Diff finished.  Tue Oct 15 16:14:16 2024

[-- Attachment #3: Type: text/plain, Size: 10 bytes --]




-- 
vl

^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#73656: 30.0.91; icomplete-vertical has no matches for M-x man RET chdir
  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
  0 siblings, 1 reply; 21+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-17 17:48 UTC (permalink / raw)
  To: Van Ly; +Cc: Eli Zaretskii, 73656

>> to use "-k" "-l" instead of "-k" in the line I emphasized, does that
>> solve the problem?
> Yes.  See diff patch on man.el .

AFAICT, the `-l` meaning is different in your `man` than on Debian's, so
we'll need a more complex code which is system-dependent.


        Stefan






^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#73656: 30.0.91; icomplete-vertical has no matches for M-x man RET chdir
  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
  0 siblings, 1 reply; 21+ messages in thread
From: Van Ly via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-18  0:37 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: eliz, 73656


Stefan Monnier <monnier@iro.umontreal.ca> writes:

         See diff patch on man.el .
>
> AFAICT, the `-l` meaning is different in your `man` than on Debian's, so
> we'll need a more complex code which is system-dependent.

The Redhat Linux redistribution may behave a little bit different to Debian.

FreeBSD would be to NetBSD what Redhat is to Debian.

-- 
vl





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#73656: 30.0.91; icomplete-vertical has no matches for M-x man RET chdir
  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
  0 siblings, 1 reply; 21+ messages in thread
From: Eli Zaretskii @ 2024-10-19  9:42 UTC (permalink / raw)
  To: Van Ly; +Cc: 73656, monnier

> From: Van Ly <van.ly@sdf.org>
> Cc: eliz@gnu.org, 73656@debbugs.gnu.org
> Date: Fri, 18 Oct 2024 00:37:01 +0000
> 
> 
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
> 
>          See diff patch on man.el .
> >
> > AFAICT, the `-l` meaning is different in your `man` than on Debian's, so
> > we'll need a more complex code which is system-dependent.
> 
> The Redhat Linux redistribution may behave a little bit different to Debian.
> 
> FreeBSD would be to NetBSD what Redhat is to Debian.

I guess the change should affect systems whose system-type is
berkeley-unix?  Patches welcome.





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#73656: 30.0.91; icomplete-vertical has no matches for M-x man RET chdir
  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
  0 siblings, 2 replies; 21+ messages in thread
From: Van Ly via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-20 15:06 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 73656, monnier

[-- Attachment #1: Type: text/plain, Size: 188 bytes --]


Eli Zaretskii <eliz@gnu.org> writes:

>
> I guess the change should affect systems whose system-type is
> berkeley-unix?  Patches welcome.
>

The attached works for berkeley-unix opsys.


[-- Attachment #2: diff on man.el --]
[-- Type: application/octet-stream, Size: 1328 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-10-21 01:54:25.569198783 +1100
@@ -977,7 +977,7 @@
   (cond
    ;; This ends up returning t for pretty much any string, and hence leads to
    ;; spurious "complete but not unique" messages.  And since `man' doesn't
-   ;; require-match anyway, there's not point being clever.
+   ;; require-match anyway, there's no point being clever.
    ;;((eq action 'lambda) (not (string-match "([^)]*\\'" string)))
    ((equal string "-k")
     ;; Let SPC (minibuffer-complete-word) insert the space.
@@ -1009,7 +1009,9 @@
                       (ignore-errors
                         (process-file
                          manual-program nil '(t nil) nil
-                         "-k" (concat (when (or Man-man-k-use-anchor
+                         "-k"
+                         (if (eq system-type 'berkeley-unix) "-l")
+                         (concat (when (or Man-man-k-use-anchor
                                                 (string-equal prefix ""))
                                         "^")
                                       (if (string-equal prefix "")

Diff finished.  Mon Oct 21 01:58:56 2024

[-- Attachment #3: Type: text/plain, Size: 9 bytes --]



-- 
vl

^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#73656: 30.0.91; icomplete-vertical has no matches for M-x man RET chdir
  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
  1 sibling, 0 replies; 21+ messages in thread
From: Eli Zaretskii @ 2024-10-20 15:50 UTC (permalink / raw)
  To: Van Ly; +Cc: 73656, monnier

> From: Van Ly <van.ly@sdf.org>
> Cc: monnier@iro.umontreal.ca, 73656@debbugs.gnu.org
> Date: Sun, 20 Oct 2024 15:06:30 +0000
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >
> > I guess the change should affect systems whose system-type is
> > berkeley-unix?  Patches welcome.
> >
> 
> The attached works for berkeley-unix opsys.

This puts a nil into the arguments of process-file (on systems other
than *BSD).





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#73656: 30.0.91; icomplete-vertical has no matches for M-x man RET chdir
  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
  1 sibling, 2 replies; 21+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-21  2:26 UTC (permalink / raw)
  To: Van Ly; +Cc: Eli Zaretskii, 73656

> +                         (if (eq system-type 'berkeley-unix) "-l")

Maybe a more robust approach would be something like

    (defvar man--apropos-args (...))

where (...) is a piece of code which actually runs `man` with `-k` and
with or without `-l` to try and determine which kind of `man` we're
dealing with, but without making assumptions about which kind of `man`
is installed on which kind of OS.

Then we can use this new `man--apropos-args` var when running
`process-file`.

Oh, and `process-file` makes this worse because it may end up spawning
a process on a remote systems, so the local OS and local `man` may not
have anything to do with the remote OS and remote `man`.


        Stefan






^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#73656: 30.0.91; icomplete-vertical has no matches for M-x man RET chdir
  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
  1 sibling, 0 replies; 21+ messages in thread
From: Van Ly via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-22  9:31 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: eliz, 73656


Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> +                         (if (eq system-type 'berkeley-unix) "-l")
>
> Maybe a more robust approach would be something like
>
>     (defvar man--apropos-args (...))
>
> where (...) is a piece of code which actually runs `man` with `-k` and
> with or without `-l` to try and determine which kind of `man` we're
> dealing with, but without making assumptions about which kind of `man`
> is installed on which kind of OS.

The following *shell* buffer logs show "man -k -l chd" then "man -k chd"
run on debian/aarch64 and netbsd/amd64


on debian/aarch64


 . deb$ man -k -l chd
 . chdir (2)            - change working directory
 . fchdir (2)           - change working directory
 . wdctl (8)            - show hardware watchdog status

 . deb$ man -k chd
 . chdir (2)            - change working directory
 . fchdir (2)           - change working directory
 . wdctl (8)            - show hardware watchdog status

 . deb$ echo $APROPOS
 . 
 . deb$ 


on netbsd/amd64


 . net$ man -k -l chd
 . man -k -l chd
 . swwdog(4) - software watchdog timer
 . pwdog(4) - Quancom PWDOG1 watchdog timer device
 . acpiwdrt(4) - ACPI Watchdog Timer WDRT
 . rdcpcib(4) - RDC PCI/ISA bridge and watchdog timer driver
 . i386/geodewdog(4) - AMD Geode SC1100 Watchdog Timer driver
 . gcscpcib(4) - AMD CS553[56] PCI-ISA bridge with timecounter, watchdog timer, and GPIO
 . evbarm/iopwdog(4) - Intel I/O Processor Watchdog Timer
 . x86/tco(4) - Intel Controller Hub TCO watchdog timer device
 . posix_spawn_file_actions_addchdir(3) - add chdir or fchdir action to spawn file actions object
 . chdir(2) - change current working directory
 . wdogctl(8) - Watchdog timer control utility
 . ifwatchd(8) - watch for addresses added to or deleted from interfaces and call up/down-scripts for them

 . net$ man -k chd
 . man -k chd
 . apropos: No relevant results obtained.
 . Please make sure that you spelled all the terms correctly or try using different keywords.

 . net$ echo $APROPOS
 . echo $APROPOS
 . 
 . net$ 


-- 
vl





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#73656: 30.0.91; icomplete-vertical has no matches for M-x man RET chdir
  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
  1 sibling, 1 reply; 21+ messages in thread
From: Van Ly via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-25  5:34 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: eliz, 73656


Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> +                         (if (eq system-type 'berkeley-unix) "-l")
>

As gap filler, the following change does not misbehave on deb or netbsd.

+                         (if (eq system-type 'berkeley-unix) "-l" "")

> Maybe a more robust approach would be something like
>
>     (defvar man--apropos-args (...))
>
> where (...) is a piece of code which actually runs `man` with `-k` and
> with or without `-l` to try and determine which kind of `man` we're
> dealing with, but without making assumptions about which kind of `man`
> is installed on which kind of OS.
>

As probe to reveal switches available to "man", try "man -h" and
"man -?" but the output doesn't look helpful, perhaps a complete
solution has to probe the manpage for "man".

 . net$ man -h
 . man -h
 . Usage: man [-acw|-h] [-C cfg] [-M path] [-m path] [-S srch] [[-s] sect] name ...
 . Usage: man [-C file] -f command ...
 . Usage: man [-C file] -k keyword ...
 . Usage: man -p

 . net$ man -?
 . man -?
 . man: unknown option -- ?
 . Usage: man [-acw|-h] [-C cfg] [-M path] [-m path] [-S srch] [[-s] sect] name ...
 . Usage: man [-C file] -f command ...
 . Usage: man [-C file] -k keyword ...
 . Usage: man -p

 . deb$ man -h
 . Usage: man [OPTION...] [SECTION] PAGE...
 .
 .   -C, --config-file=FILE     use this user configuration file
 .   -d, --debug                emit debugging messages
 .   -D, --default              reset all options to their default values
 .       --warnings[=WARNINGS]  enable warnings from groff
 .
 .  Main modes of operation:
 .   -f, --whatis               equivalent to whatis
 .   -k, --apropos              equivalent to apropos
 .   -K, --global-apropos       search for text in all pages
 .   -l, --local-file           interpret PAGE argument(s) as local filename(s)
 .   -w, --where, --path, --location
 .                              print physical location of man page(s)
 .   -W, --where-cat, --location-cat
 .                              print physical location of cat file(s)
 .
 .   -c, --catman               used by catman to reformat out of date cat pages
 .   -R, --recode=ENCODING      output source page encoded in ENCODING
 .
 .  Finding manual pages:
 .   -L, --locale=LOCALE        define the locale for this particular man search
 .   -m, --systems=SYSTEM       use manual pages from other systems
 .   -M, --manpath=PATH         set search path for manual pages to PATH
 .
 .   -S, -s, --sections=LIST    use colon separated section list
 .
 .   -e, --extension=EXTENSION  limit search to extension type EXTENSION
 .
 .   -i, --ignore-case          look for pages case-insensitively (default)
 .   -I, --match-case           look for pages case-sensitively
 .
 .       --regex                show all pages matching regex
 .       --wildcard             show all pages matching wildcard
 .
 .       --names-only           make --regex and --wildcard match page names only,
 .                              not descriptions
 .
 .   -a, --all                  find all matching manual pages
 .   -u, --update               force a cache consistency check
 .
 .       --no-subpages          don't try subpages, e.g. 'man foo bar' => 'man
 .                              foo-bar'
 .
 .  Controlling formatted output:
 .   -P, --pager=PAGER          use program PAGER to display output
 .   -r, --prompt=STRING        provide the `less' pager with a prompt
 .
 .   -7, --ascii                display ASCII translation of certain latin1 chars
 .   -E, --encoding=ENCODING    use selected output encoding
 .       --no-hyphenation, --nh turn off hyphenation
 .       --no-justification,                              --nj   turn off justification
 .   -p, --preprocessor=STRING  STRING indicates which preprocessors to run:
 .                              e - [n]eqn, p - pic, t - tbl,
 . g - grap, r - refer, v - vgrind
 .
 .   -t, --troff                use groff to format pages
 .   -T, --troff-device[=DEVICE]   use groff with selected device
 .
 .   -H, --html[=BROWSER]       use www-browser or BROWSER to display HTML output
 .   -X, --gxditview[=RESOLUTION]   use groff and display through gxditview
 .                              (X11):
 .                              -X = -TX75, -X100 = -TX100, -X100-12 = -TX100-12
 .   -Z, --ditroff              use groff and force it to produce ditroff
 .
 .   -?, --help                 give this help list
 .       --usage                give a short usage message
 .   -V, --version              print program version
 .
 . Mandatory or optional arguments to long options are also mandatory or optional
 . for any corresponding short options.
 .
 . Report bugs to cjwatson@debian.org.


-- 
vl





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#73656: 30.0.91; icomplete-vertical has no matches for M-x man RET chdir
  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
  0 siblings, 1 reply; 21+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-31 18:15 UTC (permalink / raw)
  To: Van Ly; +Cc: eliz, 73656

[-- Attachment #1: Type: text/plain, Size: 228 bytes --]

>>> +                         (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?


        Stefan

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: man.patch --]
[-- Type: text/x-diff, Size: 2605 bytes --]

diff --git a/lisp/man.el b/lisp/man.el
index 816c75d749c..ebf4646d133 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -973,6 +973,27 @@ Man-parse-man-k
               (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,7 +1009,10 @@
                       (ignore-errors
                         (process-file
                          manual-program nil '(t nil) nil
-                         "-k" (concat (when (or Man-man-k-use-anchor
+                         ;; 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 "")
@@ -1021,7 +1024,7 @@
                                         ;; But we don't have that, and
                                         ;; shell-quote-argument does
                                         ;; the job...
-                                        (shell-quote-argument prefix))))))
+                                      (shell-quote-argument prefix)))))))
               (setq table (Man-parse-man-k)))))
 	;; Cache the table for later reuse.
         (when table

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* bug#73656: 30.0.91; icomplete-vertical has no matches for M-x man RET chdir
  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
  2024-11-01 17:52                             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 21+ messages in thread
From: Van Ly via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-11-01 16:04 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: eliz, 73656

[-- 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

^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#73656: 30.0.91; icomplete-vertical has no matches for M-x man RET chdir
  2024-11-01 16:04                           ` Van Ly via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-11-01 17:52                             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 21+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-11-01 17:52 UTC (permalink / raw)
  To: Van Ly; +Cc: eliz, 73656

> 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.

I meant for the patch to be read rather than applied.
Also, what value do you get for `Man-man-k-flags`?

> On debian the patch also fails.

Yes, there was a trivial error.  Fixed in the patch below.


        Stefan


diff --git a/lisp/man.el b/lisp/man.el
index 816c75d749c..d5ac8b93d99 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -973,6 +973,27 @@ Man-parse-man-k
               (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 (and (> lines 0) (>= (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
@@ -1007,9 +1028,13 @@ Man-completion-table
             ;; error later.
             (when (eq 0
                       (ignore-errors
-                        (process-file
+                        (apply
+                         #'process-file
                          manual-program nil '(t nil) nil
-                         "-k" (concat (when (or Man-man-k-use-anchor
+                         ;; 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 "")
@@ -1021,7 +1046,7 @@ Man-completion-table
                                         ;; But we don't have that, and
                                         ;; shell-quote-argument does
                                         ;; the job...
-                                        (shell-quote-argument prefix))))))
+                                      (shell-quote-argument prefix)))))))
               (setq table (Man-parse-man-k)))))
 	;; Cache the table for later reuse.
         (when table






^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2024-11-01 17:52 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2024-11-01 17:52                             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

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).