[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Support print0 with completions
From: |
Shigio YAMAGUCHI |
Subject: |
Re: Support print0 with completions |
Date: |
Thu, 8 Jul 2021 10:54:22 +0900 |
Hello,
> My request is simply to consistently add the same
> behavior for print0 with completions.
OK. Below is a patch that fixes the bug.
It will be included in the next release.
Thank you!
Regards,
Shigio
Index: global/global.c
===================================================================
RCS file: /sources/global/global/global/global.c,v
retrieving revision 1.319
diff -c -r1.319 global.c
*** global/global.c 1 Mar 2021 22:23:56 -0000 1.319
--- global/global.c 8 Jul 2021 01:44:17 -0000
***************
*** 148,153 ****
--- 148,154 ----
char *single_update;
char *path_style;
char *print_target;
+ int newline = '\n';
/*
* Path filter
***************
*** 791,798 ****
xflag = 0;
if (nflag > 1)
nosource = 1; /* to keep compatibility */
! if (print0)
set_print0();
if (cflag && match_part == 0)
match_part = MATCH_PART_ALL;
/*
--- 792,801 ----
xflag = 0;
if (nflag > 1)
nosource = 1; /* to keep compatibility */
! if (print0) {
! newline = '\0';
set_print0();
+ }
if (cflag && match_part == 0)
match_part = MATCH_PART_ALL;
/*
***************
*** 1025,1031 ****
flags |= GTOP_IGNORECASE;
for (gtp = gtags_first(gtop, prefix, flags); gtp; gtp = gtags_next(gtop)) {
fputs(gtp->tag, stdout);
! fputc('\n', stdout);
count++;
}
if (debug)
--- 1028,1034 ----
flags |= GTOP_IGNORECASE;
for (gtp = gtags_first(gtop, prefix, flags); gtp; gtp = gtags_next(gtop)) {
fputs(gtp->tag, stdout);
! fputc(newline, stdout);
count++;
}
if (debug)
***************
*** 1171,1177 ****
continue;
}
*p = '\0';
! puts(line);
}
#if (defined(_WIN32) && !defined(__CYGWIN__)) || defined(__DJGPP__)
if (pclose(ip) != 0)
--- 1174,1181 ----
continue;
}
*p = '\0';
! fputs(line, stdout);
! fputc(newline, stdout);
}
#if (defined(_WIN32) && !defined(__CYGWIN__)) || defined(__DJGPP__)
if (pclose(ip) != 0)
***************
*** 1236,1242 ****
gfind_close(gp);
for (path = dbop_first(dbop, NULL, NULL, DBOP_KEY); path != NULL;
path = dbop_next(dbop)) {
fputs(path, stdout);
! fputc('\n', stdout);
}
dbop_close(dbop);
}
--- 1240,1246 ----
gfind_close(gp);
for (path = dbop_first(dbop, NULL, NULL, DBOP_KEY); path != NULL;
path = dbop_next(dbop)) {
fputs(path, stdout);
! fputc(newline, stdout);
}
dbop_close(dbop);
}
}
On Wed, Jul 7, 2021 at 10:25 PM Ergus <spacibba@aol.com> wrote:
>
> Hi:
>
> Recently we are using global from emacs and it works pretty fine in most
> of the case. We always use in the package consistently --print0 to
> simplify the parsing code, BUT we found that --completion option does
> not support --print0. It just ignores it and prints one
> candidate/line. My request is simply to consistently add the same
> behavior for print0 with completions.
>
> Thanks in advance,
> Ergus.
>
> PD: BTW, I don't know if it is too complex, but if you have some shared
> object where you expose some C bindings it may be very useful to provide
> an emacs module, and inter-language support for global throw python for
> example.
>
--
Shigio YAMAGUCHI <shigio@gnu.org>
PGP fingerprint:
26F6 31B4 3D62 4A92 7E6F 1C33 969C 3BE3 89DD A6EB