commit 1f83c3e52480d35b0970d5db95e565f31686d227 (HEAD, refs/remotes/origin/master) Author: Eli Zaretskii Date: Sat May 23 11:35:45 2015 +0300 Fix etags reading of compressed files * lib-src/etags.c (O_CLOEXEC) [WINDOWSNT]: Define. Include fcntl.h, for O_CLOEXEC. (process_file_name): Don't use 'popen', whose streams cannot be rewound. Instead, uncompress the file to a temporary file, created by 'etags_mktmp', and read from that as usual. (etags_mktmp): New function. * test/etags/ETAGS.good_1: * test/etags/ETAGS.good_2: * test/etags/ETAGS.good_3: * test/etags/ETAGS.good_4: * test/etags/ETAGS.good_5: Update to be consistent with latest changes in etags.c regarding reading compressed files. diff --git a/lib-src/etags.c b/lib-src/etags.c index 0a308c1..28729da 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -116,6 +116,7 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4"; # undef HAVE_NTGUI # undef DOS_NT # define DOS_NT +# define O_CLOEXEC O_NOINHERIT #endif /* WINDOWSNT */ #include @@ -125,6 +126,7 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4"; #include #include #include +#include #include #include #include @@ -336,6 +338,7 @@ static char *absolute_filename (char *, char *); static char *absolute_dirname (char *, char *); static bool filename_is_absolute (char *f); static void canonicalize_filename (char *); +static char *etags_mktmp (void); static void linebuffer_init (linebuffer *); static void linebuffer_setlen (linebuffer *, int); static void *xmalloc (size_t); @@ -1437,7 +1440,7 @@ process_file_name (char *file, language *lang) fdesc *fdp; compressor *compr; char *compressed_name, *uncompressed_name; - char *ext, *real_name; + char *ext, *real_name, *tmp_name; int retval; canonicalize_filename (file); @@ -1522,9 +1525,20 @@ process_file_name (char *file, language *lang) } if (real_name == compressed_name) { - char *cmd = concat (compr->command, " ", real_name); - inf = popen (cmd, "r" FOPEN_BINARY); - free (cmd); + tmp_name = etags_mktmp (); + if (!tmp_name) + inf = NULL; + else + { + char *cmd1 = concat (compr->command, " ", real_name); + char *cmd = concat (cmd1, " > ", tmp_name); + free (cmd1); + if (system (cmd) == -1) + inf = NULL; + else + inf = fopen (tmp_name, "r" FOPEN_BINARY); + free (cmd); + } } else inf = fopen (real_name, "r" FOPEN_BINARY); @@ -1536,10 +1550,12 @@ process_file_name (char *file, language *lang) process_file (inf, uncompressed_name, lang); + retval = fclose (inf); if (real_name == compressed_name) - retval = pclose (inf); - else - retval = fclose (inf); + { + remove (tmp_name); + free (tmp_name); + } if (retval < 0) pfatal (file); @@ -1707,9 +1723,6 @@ find_entries (FILE *inf) } } - /* We rewind here, even if inf may be a pipe. We fail if the - length of the first line is longer than the pipe block size, - which is unlikely. */ rewind (inf); /* Else try to guess the language given the case insensitive file name. */ @@ -1734,8 +1747,6 @@ find_entries (FILE *inf) if (old_last_node == last_node) /* No Fortran entries found. Try C. */ { - /* We do not tag if rewind fails. - Only the file name will be recorded in the tags file. */ rewind (inf); curfdp->lang = get_language_from_langname (cplusplus ? "c++" : "c"); find_entries (inf); @@ -5015,8 +5026,6 @@ TEX_mode (FILE *inf) TEX_opgrp = '<'; TEX_clgrp = '>'; } - /* If the input file is compressed, inf is a pipe, and rewind may fail. - No attempt is made to correct the situation. */ rewind (inf); } @@ -6344,6 +6353,51 @@ etags_getcwd (void) return path; } +/* Return a newly allocated string containing a name of a temporary file. */ +static char * +etags_mktmp (void) +{ + const char *tmpdir = getenv ("TMPDIR"); + const char *slash = "/"; + +#if MSDOS || defined (DOS_NT) + if (!tmpdir) + tmpdir = getenv ("TEMP"); + if (!tmpdir) + tmpdir = getenv ("TMP"); + if (!tmpdir) + tmpdir = "."; + if (tmpdir[strlen (tmpdir) - 1] == '/' + || tmpdir[strlen (tmpdir) - 1] == '\\') + slash = ""; +#else + if (!tmpdir) + tmpdir = "/tmp"; + if (tmpdir[strlen (tmpdir) - 1] == '/') + slash = ""; +#endif + + char *templt = concat (tmpdir, slash, "etXXXXXX"); + int fd = mkostemp (templt, O_CLOEXEC); + if (fd < 0) + { + free (templt); + templt = NULL; + } + else + close (fd); + +#if defined (DOS_NT) + /* The file name will be used in shell redirection, so it needs to have + DOS-style backslashes, or else the Windows shell will barf. */ + char *p; + for (p = templt; *p; p++) + if (*p == '/') + *p = '\\'; +#endif + return templt; +} + /* Return a newly allocated string containing the file name of FILE relative to the absolute directory DIR (which should end with a slash). */ static char * diff --git a/test/etags/ETAGS.good_1 b/test/etags/ETAGS.good_1 index 370d057..cabcd2c 100644 --- a/test/etags/ETAGS.good_1 +++ b/test/etags/ETAGS.good_1 @@ -2243,12 +2243,12 @@ f-src/entry.strange_suffix,172 & intensity1(577,12231 character*(*) function foo(579,12307 -f-src/entry.strange,171 - LOGICAL FUNCTION PRTPKG 2,2 - ENTRY SETPRT 193,3793 - ENTRY MSGSEL 394,8405 - & intensity1(576,12158 - character*(*) function foo(578,12234 +f-src/entry.strange,172 + LOGICAL FUNCTION PRTPKG 3,75 + ENTRY SETPRT 194,3866 + ENTRY MSGSEL 395,8478 + & intensity1(577,12231 + character*(*) function foo(579,12307 forth-src/test-forth.fth,408 : a-forth-word 20,301 diff --git a/test/etags/ETAGS.good_2 b/test/etags/ETAGS.good_2 index b09e61e..5d4f706 100644 --- a/test/etags/ETAGS.good_2 +++ b/test/etags/ETAGS.good_2 @@ -2810,12 +2810,12 @@ f-src/entry.strange_suffix,172 & intensity1(577,12231 character*(*) function foo(579,12307 -f-src/entry.strange,171 - LOGICAL FUNCTION PRTPKG 2,2 - ENTRY SETPRT 193,3793 - ENTRY MSGSEL 394,8405 - & intensity1(576,12158 - character*(*) function foo(578,12234 +f-src/entry.strange,172 + LOGICAL FUNCTION PRTPKG 3,75 + ENTRY SETPRT 194,3866 + ENTRY MSGSEL 395,8478 + & intensity1(577,12231 + character*(*) function foo(579,12307 forth-src/test-forth.fth,408 : a-forth-word 20,301 diff --git a/test/etags/ETAGS.good_3 b/test/etags/ETAGS.good_3 index 5a9a2bf..1d8e34a 100644 --- a/test/etags/ETAGS.good_3 +++ b/test/etags/ETAGS.good_3 @@ -2560,12 +2560,12 @@ f-src/entry.strange_suffix,172 & intensity1(577,12231 character*(*) function foo(579,12307 -f-src/entry.strange,171 - LOGICAL FUNCTION PRTPKG 2,2 - ENTRY SETPRT 193,3793 - ENTRY MSGSEL 394,8405 - & intensity1(576,12158 - character*(*) function foo(578,12234 +f-src/entry.strange,172 + LOGICAL FUNCTION PRTPKG 3,75 + ENTRY SETPRT 194,3866 + ENTRY MSGSEL 395,8478 + & intensity1(577,12231 + character*(*) function foo(579,12307 forth-src/test-forth.fth,408 : a-forth-word 20,301 diff --git a/test/etags/ETAGS.good_4 b/test/etags/ETAGS.good_4 index f6023ea..30ea7dc 100644 --- a/test/etags/ETAGS.good_4 +++ b/test/etags/ETAGS.good_4 @@ -2407,12 +2407,12 @@ f-src/entry.strange_suffix,172 & intensity1(577,12231 character*(*) function foo(579,12307 -f-src/entry.strange,171 - LOGICAL FUNCTION PRTPKG 2,2 - ENTRY SETPRT 193,3793 - ENTRY MSGSEL 394,8405 - & intensity1(576,12158 - character*(*) function foo(578,12234 +f-src/entry.strange,172 + LOGICAL FUNCTION PRTPKG 3,75 + ENTRY SETPRT 194,3866 + ENTRY MSGSEL 395,8478 + & intensity1(577,12231 + character*(*) function foo(579,12307 forth-src/test-forth.fth,408 : a-forth-word 20,301 diff --git a/test/etags/ETAGS.good_5 b/test/etags/ETAGS.good_5 index b6bb626..dfa261b 100644 --- a/test/etags/ETAGS.good_5 +++ b/test/etags/ETAGS.good_5 @@ -3291,12 +3291,12 @@ f-src/entry.strange_suffix,172 & intensity1(577,12231 character*(*) function foo(579,12307 -f-src/entry.strange,171 - LOGICAL FUNCTION PRTPKG 2,2 - ENTRY SETPRT 193,3793 - ENTRY MSGSEL 394,8405 - & intensity1(576,12158 - character*(*) function foo(578,12234 +f-src/entry.strange,172 + LOGICAL FUNCTION PRTPKG 3,75 + ENTRY SETPRT 194,3866 + ENTRY MSGSEL 395,8478 + & intensity1(577,12231 + character*(*) function foo(579,12307 forth-src/test-forth.fth,408 : a-forth-word 20,301 commit b8e18b63a3270090469b1092dea9520bb2c9a435 Author: Eli Zaretskii Date: Sat May 23 11:15:30 2015 +0300 Improve documentation of 'set-fontset-font' * doc/lispref/display.texi (Fontsets): Document the value of nil for the 3rd argument of 'set-fontset-font'. diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 05bcd9f..b12995b 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -3304,6 +3304,9 @@ fontset, whose short name is @samp{fontset-default}. @var{character} may be a script name. In that case, use @var{font-spec} for all character in the charsets. +@var{font-spec} may be a font-spec object created by the function +@code{font-spec} (@pxref{Low-Level Font}). + @var{font-spec} may be a cons; @code{(@var{family} . @var{registry})}, where @var{family} is a family name of a font (possibly including a foundry name at the head), @var{registry} is a registry name of a font @@ -3311,6 +3314,12 @@ foundry name at the head), @var{registry} is a registry name of a font @var{font-spec} may be a font name string. +@var{font-spec} may be @code{nil}, which explicitly specifies that +there's no font for the specified @var{character}. This is useful, +for example, to avoid expensive system-wide search for fonts for +characters that have no glyphs, like those from the Unicode Private +Use Area (PUA). + The optional argument @var{add}, if non-@code{nil}, specifies how to add @var{font-spec} to the font specifications previously set. If it is @code{prepend}, @var{font-spec} is prepended. If it is commit d6dfefe40528a6a9ab6d0cbc5f1a450075241141 Author: Eli Zaretskii Date: Sat May 23 11:03:30 2015 +0300 Fix documentation of forward-line * src/cmds.c (Fforward_line): Clarify the return value if the line at end of accessible portion of the buffer has no newline. * doc/lispref/positions.texi (Text Lines): Document what happens if the line at end of accessible portion of buffer has no newline. (Bug#20587) diff --git a/doc/lispref/positions.texi b/doc/lispref/positions.texi index e7c79d5..c972bbb 100644 --- a/doc/lispref/positions.texi +++ b/doc/lispref/positions.texi @@ -350,10 +350,11 @@ would move to. @deffn Command forward-line &optional count @cindex beginning of line This function moves point forward @var{count} lines, to the beginning of -the line. If @var{count} is negative, it moves point -@minus{}@var{count} lines backward, to the beginning of a line. If -@var{count} is zero, it moves point to the beginning of the current -line. If @var{count} is @code{nil}, that means 1. +the line following that. If @var{count} is negative, it moves point +@minus{}@var{count} lines backward, to the beginning of a line +preceding that. If @var{count} is zero, it moves point to the +beginning of the current line. If @var{count} is @code{nil}, that +means 1. If @code{forward-line} encounters the beginning or end of the buffer (or of the accessible portion) before finding that many lines, it sets point @@ -362,7 +363,11 @@ there. No error is signaled. @code{forward-line} returns the difference between @var{count} and the number of lines actually moved. If you attempt to move down five lines from the beginning of a buffer that has only three lines, point stops at -the end of the last line, and the value will be 2. +the end of the last line, and the value will be 2. As an explicit +exception, if the last accessible line is non-empty, but has no +newline (e.g., if the buffer ends without a newline), the function +sets point to the end of that line, and the value returned by the +function counts that line as one line successfully moved. In an interactive call, @var{count} is the numeric prefix argument. @end deffn diff --git a/src/cmds.c b/src/cmds.c index b590805..6f9982e 100644 --- a/src/cmds.c +++ b/src/cmds.c @@ -110,10 +110,17 @@ DEFUN ("forward-line", Fforward_line, Sforward_line, 0, 1, "^p", Precisely, if point is on line I, move to the start of line I + N \("start of line" in the logical order). If there isn't room, go as far as possible (no error). + Returns the count of lines left to move. If moving forward, -that is N - number of lines moved; if backward, N + number moved. -With positive N, a non-empty line at the end counts as one line -successfully moved (for the return value). */) +that is N minus number of lines moved; if backward, N plus number +moved. + +Exception: With positive N, a non-empty line at the end of the +buffer, or of its accessible portion, counts as one line +successfully moved (for the return value). This means that the +function will move point to the end of such a line and will count +it as a line moved across, even though there is no next line to +go to its beginning. */) (Lisp_Object n) { ptrdiff_t opoint = PT, pos, pos_byte, shortage, count; commit a89ea17be3b589274527bbee6d3c96ff66a226b7 Author: Glenn Morris Date: Fri May 22 19:17:51 2015 -0400 * admin/charsets/Makefile.in (TRANS_TABLE): Add short aliases. diff --git a/admin/charsets/Makefile.in b/admin/charsets/Makefile.in index 1709756..0b96cd1 100644 --- a/admin/charsets/Makefile.in +++ b/admin/charsets/Makefile.in @@ -141,7 +141,7 @@ define map_template $(notdir ${1}): ${1} endef -$(foreach mfile,${CHARSETS},$(eval $(call map_template,$(mfile)))) +$(foreach mfile,${CHARSETS} ${TRANS_TABLE},$(eval $(call map_template,$(mfile)))) ${charsetdir}/VSCII.map: ${GLIBC_CHARMAPS}/TCVN5712-1.gz ${mapconv} ${compact} ${AM_V_GEN}${run_mapconv} $< '/^<.*[ ]\/x[0-9a-f].[ ]/' GLIBC-1 ${compact} > $@ commit fa560755d533889bd95dc7475937f93dc58e9191 Author: Glenn Morris Date: Fri May 22 19:15:55 2015 -0400 * admin/charsets/mapconv (LC_ALL): Set to C. diff --git a/admin/charsets/mapconv b/admin/charsets/mapconv index 6fd13c6..245dce1 100755 --- a/admin/charsets/mapconv +++ b/admin/charsets/mapconv @@ -35,6 +35,11 @@ # GLIBC-1 GLIBC-2 GLIBC-2-7 CZYBORRA IANA UNICODE UNICODE2 YASUOKA # $4: awk script +## So that eg [A-F] as used by KANJI-DATABASE branch below works as expected. +## Otherwise with LANG=en_US.utf8, CNS-6.map was generated with a +## bogus entry. By experiment, LC_COLLATE=C was not enough. +export LC_ALL=C + BASE=`expr "$1" : '.*/\(.*\)' '|' "$1"` # basename FILE="admin/charsets/mapfiles/$BASE" BASE=`expr "$BASE" : '\(.*\)\.gz$' '|' "$BASE"` # remove any .gz suffix commit 50ecfcd6488f596035e8dc8203cfec3e40508c89 Author: Glenn Morris Date: Fri May 22 19:05:59 2015 -0400 * Makefile.in: Add admin/charsets into top-level clean rules. (clean): Add admin/charsets. (maybeclean_dirs): New variable. (distclean, bootstrap-clean, maintainer-clean): Use $maybeclean_dirs. diff --git a/Makefile.in b/Makefile.in index eec6d31..9790dbd 100644 --- a/Makefile.in +++ b/Makefile.in @@ -831,7 +831,7 @@ clean_dirs = $(mostlyclean_dirs) nextstep $(foreach dir,$(clean_dirs),$(eval $(call submake_template,$(dir),clean))) clean: $(clean_dirs:=_clean) - for dir in test/automated; do \ + for dir in test/automated admin/charsets; do \ [ ! -d $$dir ] || $(MAKE) -C $$dir clean; \ done -rm -f *.tmp etc/*.tmp* @@ -856,8 +856,10 @@ distclean_dirs = $(clean_dirs) leim lisp $(foreach dir,$(distclean_dirs),$(eval $(call submake_template,$(dir),distclean))) +maybeclean_dirs = test/automated admin/grammars admin/unidata admin/charsets + distclean: $(distclean_dirs:=_distclean) - for dir in test/automated admin/grammars admin/unidata; do \ + for dir in ${maybeclean_dirs}; do \ [ ! -d $$dir ] || $(MAKE) -C $$dir distclean; \ done ${top_distclean} @@ -868,7 +870,7 @@ distclean: $(distclean_dirs:=_distclean) $(foreach dir,$(distclean_dirs),$(eval $(call submake_template,$(dir),bootstrap-clean))) bootstrap-clean: $(distclean_dirs:=_bootstrap-clean) - for dir in test/automated admin/grammars admin/unidata; do \ + for dir in ${maybeclean_dirs}; do \ [ ! -d $$dir ] || $(MAKE) -C $$dir bootstrap-clean; \ done [ ! -f config.log ] || mv -f config.log config.log~ @@ -896,7 +898,7 @@ maintainer_clean_dirs = src leim lisp $(foreach dir,$(maintainer_clean_dirs),$(eval $(call submake_template,$(dir),maintainer-clean))) maintainer-clean: bootstrap-clean $(maintainer_clean_dirs:=_maintainer-clean) - for dir in test/automated admin/grammars admin/unidata; do \ + for dir in ${maybeclean_dirs}; do \ [ ! -d $$dir ] || $(MAKE) -C $$dir maintainer-clean; \ done ${top_maintainer_clean} @@ -910,6 +912,7 @@ maintainer-clean: bootstrap-clean $(maintainer_clean_dirs:=_maintainer-clean) $(foreach dir,$(SUBDIR),$(eval $(call submake_template,$(dir),extraclean))) ## FIXME this is busted because most of these do not have extraclean rules. +## Also it is missing things that do have such rules. extraclean: $(SUBDIR:=_extraclean) ${top_maintainer_clean} -rm -f config-tmp-* commit 2bf7996ad86dfb646f299e2270bb826c500d4dfe Author: Glenn Morris Date: Fri May 22 18:44:46 2015 -0400 * admin/charsets/Makefile.in (LOCAL, local): Fix members. diff --git a/admin/charsets/Makefile.in b/admin/charsets/Makefile.in index 13de84d..1709756 100644 --- a/admin/charsets/Makefile.in +++ b/admin/charsets/Makefile.in @@ -113,7 +113,6 @@ CHARSETS := $(addprefix ${charsetdir}/,${CHARSETS}) LOCAL = MIK.map PTCP154.map stdenc.map symbol.map CP720.map CP858.map \ JISX213A.map CP932-2BYTE.map JISC6226.map \ CNS-2.map CNS-3.map CNS-4.map CNS-5.map CNS-6.map CNS-7.map \ - ALTERNATIVNYJ.map GB180304.map \ ${MULE} LOCAL := $(addprefix ${charsetdir}/,${LOCAL}) @@ -121,7 +120,7 @@ LOCAL := $(addprefix ${charsetdir}/,${LOCAL}) .PHONY: all local all: ${CHARSETS} ${TRANS_TABLE} -local: ${LOCAL} ${TRANS_TABLE} +local: ${LOCAL} ${lispintdir}/cp51932.el ## Rules for each charset. commit c2ef2adff154e6403e243aee31d10e353386f55e Author: Artur Malabarba Date: Fri May 22 11:00:10 2015 +0100 * lisp/emacs-lisp/package.el (package-selected-packages): Fix doc diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index cf7ff9f..7e09b1f 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -341,7 +341,7 @@ This variable is fed automatically by Emacs when installing a new package. This variable is used by `package-autoremove' to decide which packages are no longer needed. You can use it to (re)install packages on other machines -by running `package-user-selected-packages-install'. +by running `package-install-selected-packages'. To check if a package is contained in this list here, use `package--user-selected-p', as it may populate the variable with