commit 933c0bb96e7b157b551665dfd02141d1cd860771 (HEAD, refs/remotes/origin/master) Author: Eli Zaretskii Date: Sat Oct 12 09:52:03 2019 +0300 ; * lisp/progmodes/grep.el (lgrep, rgrep, zrgrep): Fix doc wording. diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index cc1d44ee9e..6675e7f554 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -1072,7 +1072,7 @@ to go to the lines where grep found matches. This command shares argument histories with \\[rgrep] and \\[grep]. -If CONFIRM, the user will be given an opportunity to edit the +If CONFIRM is non-nil, the user will be given an opportunity to edit the command before it's run." (interactive (progn @@ -1160,7 +1160,7 @@ This command shares argument histories with \\[lgrep] and \\[grep-find]. When called programmatically and FILES is nil, REGEXP is expected to specify a command to run. -If CONFIRM, the user will be given an opportunity to edit the +If CONFIRM is non-nil, the user will be given an opportunity to edit the command before it's run." (interactive (progn @@ -1275,7 +1275,7 @@ command before it's run." Like `rgrep' but uses `zgrep' for `grep-program', sets the default file name to `*.gz', and sets `grep-highlight-matches' to `always'. -If CONFIRM, the user will be given an opportunity to edit the +If CONFIRM is non-nil, the user will be given an opportunity to edit the command before it's run." (interactive (progn commit 32c500df99deb88cace9be53dde0dfa0f50304f3 Author: Lars Ingebrigtsen Date: Sat Oct 12 07:30:36 2019 +0200 tool-bar-map doc string clarification * lisp/tool-bar.el (tool-bar-map): Try to clarify how this variable is used (bug#17709). diff --git a/lisp/tool-bar.el b/lisp/tool-bar.el index 4be16b21fb..01bd8f7526 100644 --- a/lisp/tool-bar.el +++ b/lisp/tool-bar.el @@ -77,7 +77,11 @@ See `tool-bar-mode' for more information." (defvar tool-bar-map (make-sparse-keymap) "Keymap for the tool bar. -Define this locally to override the global tool bar.") + +To override the global tool bar, define this variable +buffer-locally and add the items you want to it with +`tool-bar-add-item', `tool-bar-add-item-from-menu' and related +functions.") (global-set-key [tool-bar] `(menu-item ,(purecopy "tool bar") ignore commit f2c5ba71e4e91969808f0641a129a57701689b1b Author: David Röthlisberger Date: Sat Oct 12 07:10:27 2019 +0200 Fix `shell' doc keymap expansions * lisp/shell.el (shell): Make the commands be expanded in the correct keymap (bug#11202). Copyright-paperwork-exempt: yes diff --git a/lisp/shell.el b/lisp/shell.el index 556330c8d5..38b0ef85b9 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -696,7 +696,7 @@ The buffer is put in Shell mode, giving commands for sending input and controlling the subjobs of the shell. See `shell-mode'. See also the variable `shell-prompt-pattern'. -To specify a coding system for converting non-ASCII characters +\\To specify a coding system for converting non-ASCII characters in the input and output to the shell, use \\[universal-coding-system-argument] before \\[shell]. You can also specify this with \\[set-buffer-process-coding-system] in the shell buffer, after you start the shell. commit e03afa50ee6bdf0316e5eff58df3b5bfd3bd8338 Author: Lars Ingebrigtsen Date: Sat Oct 12 07:06:54 2019 +0200 diary-mark-entries-hook doc string clarification * lisp/calendar/diary-lib.el (diary-mark-entries-hook): Mention dynamically bound variables (bug#9287). diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el index d783f11e35..25849627cd 100644 --- a/lisp/calendar/diary-lib.el +++ b/lisp/calendar/diary-lib.el @@ -214,7 +214,10 @@ you will probably also want to add `diary-include-other-diary-files' to This hook runs after `diary-nongregorian-marking-hook'. These two hooks differ only if you are using included diary files. In that case, `diary-nongregorian-marking-hook' runs for each file, whereas -`diary-mark-entries-hook' only runs once, for the main diary file." +`diary-mark-entries-hook' only runs once, for the main diary file. + +`displayed-year' and `displayed-month' are dynamically bound when +this hook is called." :type 'hook :options '(diary-mark-included-diary-files) :group 'diary) commit adb9dc4bff72c390175ddb97f8cc72afee9ee589 Author: Lars Ingebrigtsen Date: Sat Oct 12 06:40:49 2019 +0200 Document :match-inline widget elements * doc/lispref/customize.texi (Type Keywords): Document :match-inline (bug#8716). (Splicing into Lists): Mention :match-inline. diff --git a/doc/lispref/customize.texi b/doc/lispref/customize.texi index 822066f3c5..64c06c2386 100644 --- a/doc/lispref/customize.texi +++ b/doc/lispref/customize.texi @@ -1047,6 +1047,9 @@ overall list has two elements and the second element is @code{t}. If the user chooses the second alternative, then the overall list has three elements and the second and third must be strings. + The widgets can specify predicates to say whether an inline value +matches the widget with the @code{:match-inline} element. + @node Type Keywords @subsection Type Keywords @@ -1165,6 +1168,14 @@ corresponding value, @var{function}, should be a function that accepts two arguments, a widget and a value; it should return non-@code{nil} if the value is acceptable. +@item :match-inline @var{function} +@kindex match-inline@r{, customization keyword} +Specify how to decide whether an inline value matches the type. The +corresponding value, @var{function}, should be a function that accepts +two arguments, a widget and an inline value; it should return +non-@code{nil} if the value is acceptable. See @ref{Splicing into +Lists} for more information about inline values. + @item :validate @var{function} Specify a validation function for input. @var{function} takes a widget as an argument, and should return @code{nil} if the widget's commit 4b60e0722d0a79751f345bd470d07db0d635aa28 Author: Paul Eggert Date: Fri Oct 11 18:23:47 2019 -0700 Update from Gnulib This incorporates: 2019-10-11 Simplify and regularize regex use of ‘assert’ 2019-10-09 regex: omit debug assignment when not debugging 2019-10-09 regex: tell compiler there’s at most 256 arcs out 2019-10-09 regex: simplify by assuming C99 2019-10-09 regex: avoid copying of uninitialized storage 2019-09-29 fbufmode: Fix compilation error on glibc >= 2.28 systems 2019-09-28 Update comments that refer to POSIX 2019-09-23 Update URLs and associated text * doc/misc/texinfo.tex, lib/open.c, lib/regcomp.c: * lib/regex_internal.c, lib/regex_internal.h, lib/regexec.c: * lib/stdio-impl.h: Copy from Gnulib. diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex index df43c1e26e..1ea515b2ae 100644 --- a/doc/misc/texinfo.tex +++ b/doc/misc/texinfo.tex @@ -3,7 +3,7 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2019-09-20.22} +\def\texinfoversion{2019-09-24.13} % % Copyright 1985, 1986, 1988, 1990-2019 Free Software Foundation, Inc. % @@ -3099,11 +3099,16 @@ \def\wordbefore{before} \def\wordnone{none} -% Allow a ragged right output to aid breaking long URL's. Putting stretch in -% between characters of the URL doesn't look good. +% Allow a ragged right output to aid breaking long URL's. There can +% be a break at the \allowbreak with no extra glue (if the existing stretch in +% the line is sufficent), a break at the \penalty100 with extra glue added +% at the end of the line, or no break at all here. +% Changing the value of the penalty and/or the amount of stretch affects how +% preferrable one choice is over the other. \def\urefallowbreak{% - \hskip 0pt plus 4 em\relax \allowbreak + \hskip 0pt plus 4 em\relax + \penalty100 \hskip 0pt plus -4 em\relax } diff --git a/lib/open.c b/lib/open.c index 4572ebf6cd..0c2742bbda 100644 --- a/lib/open.c +++ b/lib/open.c @@ -92,9 +92,13 @@ open (const char *filename, int flags, ...) #endif #if OPEN_TRAILING_SLASH_BUG - /* If the filename ends in a slash and one of O_CREAT, O_WRONLY, O_RDWR - is specified, then fail. - Rationale: POSIX + /* Fail if one of O_CREAT, O_WRONLY, O_RDWR is specified and the filename + ends in a slash, as POSIX says such a filename must name a directory + : + "A pathname that contains at least one non- character and that + ends with one or more trailing characters shall not be resolved + successfully unless the last pathname component before the trailing + characters names an existing directory" If the named file already exists as a directory, then - if O_CREAT is specified, open() must fail because of the semantics of O_CREAT, @@ -164,6 +168,12 @@ open (const char *filename, int flags, ...) #if OPEN_TRAILING_SLASH_BUG /* If the filename ends in a slash and fd does not refer to a directory, then fail. + Rationale: POSIX says such a filename must name a directory + : + "A pathname that contains at least one non- character and that + ends with one or more trailing characters shall not be resolved + successfully unless the last pathname component before the trailing + characters names an existing directory" If the named file without the slash is not a directory, open() must fail with ENOTDIR. */ if (fd >= 0) diff --git a/lib/regcomp.c b/lib/regcomp.c index 892139a02a..ad6f931a5c 100644 --- a/lib/regcomp.c +++ b/lib/regcomp.c @@ -1436,7 +1436,7 @@ link_nfa_nodes (void *extra, bin_tree_t *node) break; case END_OF_RE: - assert (node->next == NULL); + DEBUG_ASSERT (node->next == NULL); break; case OP_DUP_ASTERISK: @@ -1452,8 +1452,8 @@ link_nfa_nodes (void *extra, bin_tree_t *node) right = node->right->first->node_idx; else right = node->next->node_idx; - assert (left > -1); - assert (right > -1); + DEBUG_ASSERT (left > -1); + DEBUG_ASSERT (right > -1); err = re_node_set_init_2 (dfa->edests + idx, left, right); } break; @@ -1471,7 +1471,7 @@ link_nfa_nodes (void *extra, bin_tree_t *node) break; default: - assert (!IS_EPSILON_NODE (node->token.type)); + DEBUG_ASSERT (!IS_EPSILON_NODE (node->token.type)); dfa->nexts[idx] = node->next->node_idx; break; } @@ -1653,9 +1653,7 @@ calc_eclosure (re_dfa_t *dfa) { Idx node_idx; bool incomplete; -#ifdef DEBUG - assert (dfa->nodes_len > 0); -#endif + DEBUG_ASSERT (dfa->nodes_len > 0); incomplete = false; /* For each nodes, calculate epsilon closure. */ for (node_idx = 0; ; ++node_idx) @@ -1670,9 +1668,7 @@ calc_eclosure (re_dfa_t *dfa) node_idx = 0; } -#ifdef DEBUG - assert (dfa->eclosures[node_idx].nelem != -1); -#endif + DEBUG_ASSERT (dfa->eclosures[node_idx].nelem != -1); /* If we have already calculated, skip it. */ if (dfa->eclosures[node_idx].nelem != 0) @@ -2442,9 +2438,7 @@ parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token, default: /* Must not happen? */ -#ifdef DEBUG - assert (0); -#endif + DEBUG_ASSERT (false); return NULL; } fetch_token (token, regexp, syntax); @@ -3306,7 +3300,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token, goto parse_bracket_exp_free_return; break; default: - assert (0); + DEBUG_ASSERT (false); break; } } @@ -3662,7 +3656,6 @@ build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans, Idx alloc = 0; #endif /* not RE_ENABLE_I18N */ reg_errcode_t ret; - re_token_t br_token; bin_tree_t *tree; sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1); @@ -3713,11 +3706,7 @@ build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans, #endif /* Build a tree for simple bracket. */ -#if defined GCC_LINT || defined lint - memset (&br_token, 0, sizeof br_token); -#endif - br_token.type = SIMPLE_BRACKET; - br_token.opr.sbcset = sbcset; + re_token_t br_token = { .type = SIMPLE_BRACKET, .opr.sbcset = sbcset }; tree = create_token_tree (dfa, NULL, NULL, &br_token); if (__glibc_unlikely (tree == NULL)) goto build_word_op_espace; @@ -3808,11 +3797,7 @@ static bin_tree_t * create_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right, re_token_type_t type) { - re_token_t t; -#if defined GCC_LINT || defined lint - memset (&t, 0, sizeof t); -#endif - t.type = type; + re_token_t t = { .type = type }; return create_token_tree (dfa, left, right, &t); } diff --git a/lib/regex_internal.c b/lib/regex_internal.c index 0092cc2a46..4ade0df0b4 100644 --- a/lib/regex_internal.c +++ b/lib/regex_internal.c @@ -212,7 +212,7 @@ build_wcs_buffer (re_string_t *pstr) { #ifdef _LIBC unsigned char buf[MB_LEN_MAX]; - assert (MB_LEN_MAX >= pstr->mb_cur_max); + DEBUG_ASSERT (MB_LEN_MAX >= pstr->mb_cur_max); #else unsigned char buf[64]; #endif @@ -285,7 +285,7 @@ build_wcs_upper_buffer (re_string_t *pstr) size_t mbclen; #ifdef _LIBC char buf[MB_LEN_MAX]; - assert (MB_LEN_MAX >= pstr->mb_cur_max); + DEBUG_ASSERT (pstr->mb_cur_max <= MB_LEN_MAX); #else char buf[64]; #endif @@ -685,9 +685,7 @@ re_string_reconstruct (re_string_t *pstr, Idx idx, int eflags) pstr->valid_len - offset); pstr->valid_len -= offset; pstr->valid_raw_len -= offset; -#if defined DEBUG && DEBUG - assert (pstr->valid_len > 0); -#endif + DEBUG_ASSERT (pstr->valid_len > 0); } } else @@ -941,10 +939,7 @@ re_string_context_at (const re_string_t *input, Idx idx, int eflags) Idx wc_idx = idx; while(input->wcs[wc_idx] == WEOF) { -#if defined DEBUG && DEBUG - /* It must not happen. */ - assert (wc_idx >= 0); -#endif + DEBUG_ASSERT (wc_idx >= 0); --wc_idx; if (wc_idx < 0) return input->tip_context; diff --git a/lib/regex_internal.h b/lib/regex_internal.h index a3aedda891..ccac8f1313 100644 --- a/lib/regex_internal.h +++ b/lib/regex_internal.h @@ -20,7 +20,6 @@ #ifndef _REGEX_INTERNAL_H #define _REGEX_INTERNAL_H 1 -#include #include #include #include @@ -34,6 +33,14 @@ #include #include +#include + +#if defined DEBUG && DEBUG != 0 +# include +# define DEBUG_ASSERT(x) assert (x) +#else +# define DEBUG_ASSERT(x) assume (x) +#endif #ifdef _LIBC # include @@ -44,22 +51,7 @@ # define lock_unlock(lock) __libc_lock_unlock (lock) #elif defined GNULIB_LOCK && !defined USE_UNLOCKED_IO # include "glthread/lock.h" - /* Use gl_lock_define if empty macro arguments are known to work. - Otherwise, fall back on less-portable substitutes. */ -# if ((defined __GNUC__ && !defined __STRICT_ANSI__) \ - || (defined __STDC_VERSION__ && 199901L <= __STDC_VERSION__)) -# define lock_define(name) gl_lock_define (, name) -# elif USE_POSIX_THREADS -# define lock_define(name) pthread_mutex_t name; -# elif USE_PTH_THREADS -# define lock_define(name) pth_mutex_t name; -# elif USE_SOLARIS_THREADS -# define lock_define(name) mutex_t name; -# elif USE_WINDOWS_THREADS -# define lock_define(name) gl_lock_t name; -# else -# define lock_define(name) -# endif +# define lock_define(name) gl_lock_define (, name) # define lock_init(lock) glthread_lock_init (&(lock)) # define lock_fini(lock) glthread_lock_destroy (&(lock)) # define lock_lock(lock) glthread_lock_lock (&(lock)) @@ -618,11 +610,7 @@ typedef struct { /* The string object corresponding to the input string. */ re_string_t input; -#if defined _LIBC || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) const re_dfa_t *const dfa; -#else - const re_dfa_t *dfa; -#endif /* EFLAGS of the argument of regexec. */ int eflags; /* Where the matching ends. */ diff --git a/lib/regexec.c b/lib/regexec.c index f464869fb0..c5dc6220b2 100644 --- a/lib/regexec.c +++ b/lib/regexec.c @@ -443,7 +443,7 @@ re_search_stub (struct re_pattern_buffer *bufp, const char *string, Idx length, { if (ret_len) { - assert (pmatch[0].rm_so == start); + DEBUG_ASSERT (pmatch[0].rm_so == start); rval = pmatch[0].rm_eo - start; } else @@ -502,9 +502,9 @@ re_copy_regs (struct re_registers *regs, regmatch_t *pmatch, Idx nregs, } else { - assert (regs_allocated == REGS_FIXED); + DEBUG_ASSERT (regs_allocated == REGS_FIXED); /* This function may not be called with REGS_FIXED and nregs too big. */ - assert (regs->num_regs >= nregs); + DEBUG_ASSERT (nregs <= regs->num_regs); rval = REGS_FIXED; } @@ -597,21 +597,12 @@ re_search_internal (const regex_t *preg, const char *string, Idx length, Idx extra_nmatch; bool sb; int ch; -#if defined _LIBC || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) re_match_context_t mctx = { .dfa = dfa }; -#else - re_match_context_t mctx; -#endif char *fastmap = ((preg->fastmap != NULL && preg->fastmap_accurate && start != last_start && !preg->can_be_null) ? preg->fastmap : NULL); RE_TRANSLATE_TYPE t = preg->translate; -#if !(defined _LIBC || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)) - memset (&mctx, '\0', sizeof (re_match_context_t)); - mctx.dfa = dfa; -#endif - extra_nmatch = (nmatch > preg->re_nsub) ? nmatch - (preg->re_nsub + 1) : 0; nmatch -= extra_nmatch; @@ -622,10 +613,8 @@ re_search_internal (const regex_t *preg, const char *string, Idx length, || dfa->init_state_begbuf == NULL)) return REG_NOMATCH; -#ifdef DEBUG /* We assume front-end functions already check them. */ - assert (0 <= last_start && last_start <= length); -#endif + DEBUG_ASSERT (0 <= last_start && last_start <= length); /* If initial states with non-begbuf contexts have no elements, the regex must be anchored. If preg->newline_anchor is set, @@ -677,8 +666,6 @@ re_search_internal (const regex_t *preg, const char *string, Idx length, goto free_return; } } - else - mctx.state_log = NULL; match_first = start; mctx.input.tip_context = (eflags & REG_NOTBOL) ? CONTEXT_BEGBUF @@ -838,10 +825,8 @@ re_search_internal (const regex_t *preg, const char *string, Idx length, match_ctx_clean (&mctx); } -#ifdef DEBUG - assert (match_last != -1); - assert (err == REG_NOERROR); -#endif + DEBUG_ASSERT (match_last != -1); + DEBUG_ASSERT (err == REG_NOERROR); /* Set pmatch[] if we need. */ if (nmatch > 0) @@ -886,7 +871,7 @@ re_search_internal (const regex_t *preg, const char *string, Idx length, : mctx.input.offsets[pmatch[reg_idx].rm_eo]); } #else - assert (mctx.input.offsets_needed == 0); + DEBUG_ASSERT (mctx.input.offsets_needed == 0); #endif pmatch[reg_idx].rm_so += match_first; pmatch[reg_idx].rm_eo += match_first; @@ -926,9 +911,7 @@ prune_impossible_nodes (re_match_context_t *mctx) re_dfastate_t **sifted_states; re_dfastate_t **lim_states = NULL; re_sift_context_t sctx; -#ifdef DEBUG - assert (mctx->state_log != NULL); -#endif + DEBUG_ASSERT (mctx->state_log != NULL); match_last = mctx->match_last; halt_node = mctx->last_node; @@ -1074,7 +1057,7 @@ check_matching (re_match_context_t *mctx, bool fl_longest_match, /* An initial state must not be NULL (invalid). */ if (__glibc_unlikely (cur_state == NULL)) { - assert (err == REG_ESPACE); + DEBUG_ASSERT (err == REG_ESPACE); return -2; } @@ -1129,7 +1112,7 @@ check_matching (re_match_context_t *mctx, bool fl_longest_match, err = extend_buffers (mctx, next_char_idx + 1); if (__glibc_unlikely (err != REG_NOERROR)) { - assert (err == REG_ESPACE); + DEBUG_ASSERT (err == REG_ESPACE); return -2; } } @@ -1212,9 +1195,7 @@ check_halt_state_context (const re_match_context_t *mctx, { Idx i; unsigned int context; -#ifdef DEBUG - assert (state->halt); -#endif + DEBUG_ASSERT (state->halt); context = re_string_context_at (&mctx->input, idx, mctx->eflags); for (i = 0; i < state->nodes.nelem; ++i) if (check_halt_node_context (mctx->dfa, state->nodes.elems[i], context)) @@ -1362,7 +1343,7 @@ pop_fail_stack (struct re_fail_stack_t *fs, Idx *pidx, Idx nregs, regmatch_t *regs, re_node_set *eps_via_nodes) { Idx num = --fs->num; - assert (num >= 0); + DEBUG_ASSERT (num >= 0); *pidx = fs->stack[num].idx; memcpy (regs, fs->stack[num].regs, sizeof (regmatch_t) * nregs); re_node_set_free (eps_via_nodes); @@ -1389,10 +1370,8 @@ set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch, regmatch_t *prev_idx_match; bool prev_idx_match_malloced = false; -#ifdef DEBUG - assert (nmatch > 1); - assert (mctx->state_log != NULL); -#endif + DEBUG_ASSERT (nmatch > 1); + DEBUG_ASSERT (mctx->state_log != NULL); if (fl_backtrack) { fs = &fs_body; @@ -1578,9 +1557,7 @@ sift_states_backward (const re_match_context_t *mctx, re_sift_context_t *sctx) Idx str_idx = sctx->last_str_idx; re_node_set cur_dest; -#ifdef DEBUG - assert (mctx->state_log != NULL && mctx->state_log[str_idx] != NULL); -#endif + DEBUG_ASSERT (mctx->state_log != NULL && mctx->state_log[str_idx] != NULL); /* Build sifted state_log[str_idx]. It has the nodes which can epsilon transit to the last_node and the last_node itself. */ @@ -1648,11 +1625,8 @@ build_sifted_states (const re_match_context_t *mctx, re_sift_context_t *sctx, Idx prev_node = cur_src->elems[i]; int naccepted = 0; bool ok; + DEBUG_ASSERT (!IS_EPSILON_NODE (dfa->nodes[prev_node].type)); -#ifdef DEBUG - re_token_type_t type = dfa->nodes[prev_node].type; - assert (!IS_EPSILON_NODE (type)); -#endif #ifdef RE_ENABLE_I18N /* If the node may accept "multi byte". */ if (dfa->nodes[prev_node].accept_mb) @@ -2505,9 +2479,7 @@ transit_state_mb (re_match_context_t *mctx, re_dfastate_t *pstate) err = clean_state_log_if_needed (mctx, dest_idx); if (__glibc_unlikely (err != REG_NOERROR)) return err; -#ifdef DEBUG - assert (dfa->nexts[cur_node_idx] != -1); -#endif + DEBUG_ASSERT (dfa->nexts[cur_node_idx] != -1); new_nodes = dfa->eclosures + dfa->nexts[cur_node_idx]; dest_state = mctx->state_log[dest_idx]; @@ -2571,9 +2543,7 @@ transit_state_bkref (re_match_context_t *mctx, const re_node_set *nodes) /* And add the epsilon closures (which is 'new_dest_nodes') of the backreference to appropriate state_log. */ -#ifdef DEBUG - assert (dfa->nexts[node_idx] != -1); -#endif + DEBUG_ASSERT (dfa->nexts[node_idx] != -1); for (; bkc_idx < mctx->nbkref_ents; ++bkc_idx) { Idx subexp_len; @@ -3032,10 +3002,8 @@ check_arrival_add_next_nodes (re_match_context_t *mctx, Idx str_idx, { int naccepted = 0; Idx cur_node = cur_nodes->elems[cur_idx]; -#ifdef DEBUG - re_token_type_t type = dfa->nodes[cur_node].type; - assert (!IS_EPSILON_NODE (type)); -#endif + DEBUG_ASSERT (!IS_EPSILON_NODE (dfa->nodes[cur_node].type)); + #ifdef RE_ENABLE_I18N /* If the node may accept "multi byte". */ if (dfa->nodes[cur_node].accept_mb) @@ -3103,9 +3071,7 @@ check_arrival_expand_ecl (const re_dfa_t *dfa, re_node_set *cur_nodes, reg_errcode_t err; Idx idx, outside_node; re_node_set new_nodes; -#ifdef DEBUG - assert (cur_nodes->nelem); -#endif + DEBUG_ASSERT (cur_nodes->nelem); err = re_node_set_alloc (&new_nodes, cur_nodes->nelem); if (__glibc_unlikely (err != REG_NOERROR)) return err; @@ -3695,6 +3661,7 @@ group_nodes_into_DFAstates (const re_dfa_t *dfa, const re_dfastate_t *state, bitset_empty (accepts); } } + assume (ndests <= SBC_MAX); return ndests; error_return: for (j = 0; j < ndests; ++j) @@ -4272,10 +4239,8 @@ static reg_errcode_t __attribute_warn_unused_result__ match_ctx_add_subtop (re_match_context_t *mctx, Idx node, Idx str_idx) { -#ifdef DEBUG - assert (mctx->sub_tops != NULL); - assert (mctx->asub_tops > 0); -#endif + DEBUG_ASSERT (mctx->sub_tops != NULL); + DEBUG_ASSERT (mctx->asub_tops > 0); if (__glibc_unlikely (mctx->nsub_tops == mctx->asub_tops)) { Idx new_asub_tops = mctx->asub_tops * 2; diff --git a/lib/stdio-impl.h b/lib/stdio-impl.h index 4260468b61..d49625780b 100644 --- a/lib/stdio-impl.h +++ b/lib/stdio-impl.h @@ -18,11 +18,16 @@ the same implementation of stdio extension API, except that some fields have different naming conventions, or their access requires some casts. */ -/* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this - problem by defining it ourselves. FIXME: Do not rely on glibc +/* Glibc 2.28 made _IO_UNBUFFERED and _IO_IN_BACKUP private. For now, work + around this problem by defining them ourselves. FIXME: Do not rely on glibc internals. */ -#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN -# define _IO_IN_BACKUP 0x100 +#if defined _IO_EOF_SEEN +# if !defined _IO_UNBUFFERED +# define _IO_UNBUFFERED 0x2 +# endif +# if !defined _IO_IN_BACKUP +# define _IO_IN_BACKUP 0x100 +# endif #endif /* BSD stdio derived implementations. */ commit f9d8babe6a28b19c781778c361e45b93f7a01f17 Author: Lars Ingebrigtsen Date: Fri Oct 11 22:28:27 2019 +0200 Document REAL-BINDING more extensively in Extended Menu Items * doc/lispref/keymaps.texi (Extended Menu Items): Document that REAL-BINDING can be other things than a real command (bug#7755). diff --git a/doc/lispref/keymaps.texi b/doc/lispref/keymaps.texi index 58f4a6687d..532e537026 100644 --- a/doc/lispref/keymaps.texi +++ b/doc/lispref/keymaps.texi @@ -2152,10 +2152,16 @@ binding looks like this: @noindent Here, @var{item-name} is an expression which evaluates to the menu item -string. Thus, the string need not be a constant. The third element, -@var{real-binding}, is the command to execute. The tail of the list, -@var{item-property-list}, has the form of a property list which contains -other information. +string. Thus, the string need not be a constant. + +The third element, @var{real-binding}, can be the command to execute +(in which case you get a normal menu item). It can also be a keymap, +which will result in a submenu. Finally, it can be @code{nil}, in +which case you will get a non-selectable menu item. This is mostly +useful when creating separator lines and the like. + +The tail of the list, @var{item-property-list}, has the form of a +property list which contains other information. Here is a table of the properties that are supported: commit 6f66d813ba657a73c4d02c179f080dbeb3650075 Author: Lars Ingebrigtsen Date: Fri Oct 11 22:13:43 2019 +0200 Minor grep.el doc string clarifications * lisp/progmodes/grep.el (grep-find-ignored-directories) (grep-compute-defaults, grep, grep-expand-template) (grep-highlight-matches, grep-use-null-device) (grep-find-command, grep-find-template, grep-expand-template) (rgrep): Minor doc string clarifications. diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index fec87bbd1c..cc1d44ee9e 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -91,7 +91,7 @@ output escape sequences. In interactive usage, the actual value of this variable is set up by `grep-compute-defaults' when the default value is `auto-detect'. -To change the default value, use Customize or call the function +To change the default value, use \\[customize] or call the function `grep-apply-setting'." :type '(choice (const :tag "Do not highlight matches with grep markers" nil) (const :tag "Highlight matches with grep markers" t) @@ -121,7 +121,7 @@ include it when specifying `grep-command'. In interactive usage, the actual value of this variable is set up by `grep-compute-defaults'; to change the default value, use -Customize or call the function `grep-apply-setting'." +\\[customize] or call the function `grep-apply-setting'." :type '(choice string (const :tag "Not Set" nil)) :set 'grep-apply-setting @@ -138,7 +138,7 @@ The following place holders should be present in the string: In interactive usage, the actual value of this variable is set up by `grep-compute-defaults'; to change the default value, use -Customize or call the function `grep-apply-setting'." +\\[customize] or call the function `grep-apply-setting'." :type '(choice string (const :tag "Not Set" nil)) :set 'grep-apply-setting @@ -153,7 +153,7 @@ necessary if the grep program used supports the `-H' option. In interactive usage, the actual value of this variable is set up by `grep-compute-defaults'; to change the default value, use -Customize or call the function `grep-apply-setting'." +\\[customize] or call the function `grep-apply-setting'." :type '(choice (const :tag "Do Not Append Null Device" nil) (const :tag "Append Null Device" t) (other :tag "Not Set" auto-detect)) @@ -175,7 +175,7 @@ This is done to disambiguate file names in `grep's output." "The default find command for \\[grep-find]. In interactive usage, the actual value of this variable is set up by `grep-compute-defaults'; to change the default value, use -Customize or call the function `grep-apply-setting'." +\\[customize] or call the function `grep-apply-setting'." :type '(choice string (const :tag "Not Set" nil)) :set 'grep-apply-setting @@ -191,7 +191,7 @@ The following place holders should be present in the string: - the regular expression searched for. In interactive usage, the actual value of this variable is set up by `grep-compute-defaults'; to change the default value, use -Customize or call the function `grep-apply-setting'." +\\[customize] or call the function `grep-apply-setting'." :type '(choice string (const :tag "Not Set" nil)) :set 'grep-apply-setting @@ -216,11 +216,12 @@ Customize or call the function `grep-apply-setting'." :type 'alist :group 'grep) -(defcustom grep-find-ignored-directories - vc-directory-exclusion-list +(defcustom grep-find-ignored-directories vc-directory-exclusion-list "List of names of sub-directories which `rgrep' shall not recurse into. If an element is a cons cell, the car is called on the search directory -to determine whether cdr should not be recursed into." +to determine whether cdr should not be recursed into. + +The default value is inherited from `vc-directory-exclusion-list'." :type '(choice (repeat :tag "Ignored directories" string) (const :tag "No ignored directories" nil)) :group 'grep) @@ -617,6 +618,11 @@ This function is called from `compilation-filter-hook'." ;;;###autoload (defun grep-compute-defaults () + "Compute the defaults for the `grep' command. +The value depends on `grep-command', `grep-template', +`grep-use-null-device', `grep-find-command', `grep-find-template', +`grep-use-null-filename-separator', `grep-find-use-xargs' and +`grep-highlight-matches'." ;; Keep default values. (unless grep-host-defaults-alist (add-to-list @@ -872,7 +878,9 @@ This function is called from `compilation-filter-hook'." ;;;###autoload (defun grep (command-args) - "Run Grep with user-specified COMMAND-ARGS, collect output in a buffer. + "Run Grep with user-specified COMMAND-ARGS. +The output from the command goes to the \"*grep*\" buffer. + While Grep runs asynchronously, you can use \\[next-error] (M-x next-error), or \\\\[compile-goto-error] in the *grep* \ buffer, to go to the lines where Grep found @@ -912,7 +920,7 @@ list is empty)." ;;;###autoload (defun grep-find (command-args) "Run grep via find, with user-specified args COMMAND-ARGS. -Collect output in a buffer. +Collect output in the \"*grep*\" buffer. While find runs asynchronously, you can use the \\[next-error] command to find the text that grep hits refer to. @@ -946,11 +954,15 @@ easily repeat a find command." ("" . excl) ("" . (shell-quote-argument (or regexp "")))) "List of substitutions performed by `grep-expand-template'. -If car of an element matches, the cdr is evalled in to get the -substitution string. Note dynamic scoping of variables.") +If car of an element matches, the cdr is evalled in order to get the +substitution string. + +The substitution is based on variables bound dynamically, and +these include `opts', `dir', `files', `null-device', `excl' and +`regexp'.") (defun grep-expand-template (template &optional regexp files dir excl) - "Patch grep COMMAND string replacing , , , , and ." + "Expand grep COMMAND string replacing , , , , and ." (let* ((command template) (env `((opts . ,(let (opts) (when (and case-fold-search @@ -985,7 +997,9 @@ substitution string. Note dynamic scoping of variables.") "Read a file-name pattern arg for interactive grep. The pattern can include shell wildcards. As whitespace triggers completion when entering a pattern, including it requires -quoting, e.g. `\\[quoted-insert]'." +quoting, e.g. `\\[quoted-insert]'. + +REGEXP is used as a string in the prompt." (let* ((grep-read-files-function (get major-mode 'grep-read-files)) (file-name-at-point (run-hook-with-args-until-success 'file-name-at-point-functions)) @@ -1051,12 +1065,15 @@ With \\[universal-argument] prefix, you can edit the constructed shell command l before it is executed. With two \\[universal-argument] prefixes, directly edit and run `grep-command'. -Collect output in a buffer. While grep runs asynchronously, you +Collect output in the \"*grep*\" buffer. While grep runs asynchronously, you can use \\[next-error] (M-x next-error), or \\\\[compile-goto-error] \ in the grep output buffer, to go to the lines where grep found matches. -This command shares argument histories with \\[rgrep] and \\[grep]." +This command shares argument histories with \\[rgrep] and \\[grep]. + +If CONFIRM, the user will be given an opportunity to edit the +command before it's run." (interactive (progn (grep-compute-defaults) @@ -1132,7 +1149,7 @@ With \\[universal-argument] prefix, you can edit the constructed shell command l before it is executed. With two \\[universal-argument] prefixes, directly edit and run `grep-find-command'. -Collect output in a buffer. While the recursive grep is running, +Collect output in the \"*grep*\" buffer. While the recursive grep is running, you can use \\[next-error] (M-x next-error), or \\\\[compile-goto-error] \ in the grep output buffer, to visit the lines where matches were found. To kill the job @@ -1141,7 +1158,10 @@ before it finishes, type \\[kill-compilation]. This command shares argument histories with \\[lgrep] and \\[grep-find]. When called programmatically and FILES is nil, REGEXP is expected -to specify a command to run." +to specify a command to run. + +If CONFIRM, the user will be given an opportunity to edit the +command before it's run." (interactive (progn (grep-compute-defaults) @@ -1253,7 +1273,10 @@ to specify a command to run." (defun zrgrep (regexp &optional files dir confirm template) "Recursively grep for REGEXP in gzipped FILES in tree rooted at DIR. Like `rgrep' but uses `zgrep' for `grep-program', sets the default -file name to `*.gz', and sets `grep-highlight-matches' to `always'." +file name to `*.gz', and sets `grep-highlight-matches' to `always'. + +If CONFIRM, the user will be given an opportunity to edit the +command before it's run." (interactive (progn ;; Compute standard default values. commit 3f8885638a667dadcd9c38c1da07d143c9341b9a Author: Lars Ingebrigtsen Date: Fri Oct 11 21:58:26 2019 +0200 Factor out the lambda from help-function-def * lisp/help-mode.el (help-function-def--button-function): Factor out into own function for easier reuse. (help-function-def): ... from the lambda here. diff --git a/lisp/help-mode.el b/lisp/help-mode.el index efc0b8ffa9..054a1ef8c2 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el @@ -190,32 +190,34 @@ The format is (FUNCTION ARGS...).") (customize-face v)) 'help-echo (purecopy "mouse-2, RET: customize face")) +(defun help-function-def--button-function (fun &optional file type) + (or file + (setq file (find-lisp-object-file-name fun type))) + (if (not file) + (message "Unable to find defining file") + (require 'find-func) + (when (eq file 'C-source) + (setq file + (help-C-file-name (indirect-function fun) 'fun))) + ;; Don't use find-function-noselect because it follows + ;; aliases (which fails for built-in functions). + (let* ((location + (find-function-search-for-symbol fun type file)) + (position (cdr location))) + (pop-to-buffer (car location)) + (run-hooks 'find-function-after-hook) + (if position + (progn + ;; Widen the buffer if necessary to go to this position. + (when (or (< position (point-min)) + (> position (point-max))) + (widen)) + (goto-char position)) + (message "Unable to find location in file"))))) + (define-button-type 'help-function-def :supertype 'help-xref - 'help-function (lambda (fun &optional file type) - (or file - (setq file (find-lisp-object-file-name fun type))) - (if (not file) - (message "Unable to find defining file") - (require 'find-func) - (when (eq file 'C-source) - (setq file - (help-C-file-name (indirect-function fun) 'fun))) - ;; Don't use find-function-noselect because it follows - ;; aliases (which fails for built-in functions). - (let* ((location - (find-function-search-for-symbol fun type file)) - (position (cdr location))) - (pop-to-buffer (car location)) - (run-hooks 'find-function-after-hook) - (if position - (progn - ;; Widen the buffer if necessary to go to this position. - (when (or (< position (point-min)) - (> position (point-max))) - (widen)) - (goto-char position)) - (message "Unable to find location in file"))))) + 'help-function #'help-function-def--button-function 'help-echo (purecopy "mouse-2, RET: find function's definition")) (define-button-type 'help-function-cmacro ; FIXME: Obsolete since 24.4. commit 8e4a090ff71f64b1d36aebc3f6a8e0145f690bf9 Author: Lars Ingebrigtsen Date: Fri Oct 11 21:36:32 2019 +0200 Make << shell heredoc expansion less enthusiastic * lisp/progmodes/sh-script.el (sh--maybe-here-document): Require a space before expanding a heredoc (bug#3226). This allows the user to insert a bash <<< "herestring", which was previously difficult. diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index cbc0ac74f0..2046080c42 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -4356,7 +4356,7 @@ The document is bounded by `sh-here-document-word'." (or arg (sh--maybe-here-document))) (defun sh--maybe-here-document () - (or (not (looking-back "[^<]<<" (line-beginning-position))) + (or (not (looking-back "[^<]<< " (line-beginning-position))) (save-excursion (backward-char 2) (or (sh-quoted-p) commit 255c892b486eeb507b4533141fec9218b7a67b2f Author: Alan Mackenzie Date: Fri Oct 11 19:10:11 2019 +0000 C++ Mode: Correctly handle <:, <::, <::>, etc, according to the C++ standard * lisp/progmodes/cc-engine.el (c-before-change-check-<>-operators): Perform checking now on an insertion, should point be inside a critical token. (c-forward-<>-arglist-recur, c-guess-continued-construct): Check for <::, etc. * lisp/progmodes/cc-langs.el (c-<-pseudo-digraph-cont-regexp) (c-<-pseudo-digraph-cont-len): New lang variables/constants. diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 4ca440fd84..9ed4fe3d88 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -6922,7 +6922,15 @@ comment at the start of cc-engine.el for more info." ;; ;; FIXME!!! This routine ignores the possibility of macros entirely. ;; 2010-01-29. - (when (and (> end beg) + (when (and (or (> end beg) + (and (> c-<-pseudo-digraph-cont-len 0) + (goto-char beg) + (progn + (skip-chars-backward + "^<" (max (- (point) c-<-pseudo-digraph-cont-len) + (point-min))) + (eq (char-before) ?<)) + (looking-at c-<-pseudo-digraph-cont-regexp))) (or (progn (goto-char beg) @@ -7948,7 +7956,8 @@ comment at the start of cc-engine.el for more info." (forward-char) ; Forward over the opening '<'. - (unless (looking-at c-<-op-cont-regexp) + (unless (and (looking-at c-<-op-cont-regexp) + (not (looking-at c-<-pseudo-digraph-cont-regexp))) ;; go forward one non-alphanumeric character (group) per iteration of ;; this loop. (while (and @@ -8026,7 +8035,8 @@ comment at the start of cc-engine.el for more info." (let (id-start id-end subres keyword-match) (cond ;; The '<' begins a multi-char operator. - ((looking-at c-<-op-cont-regexp) + ((and (looking-at c-<-op-cont-regexp) + (not (looking-at c-<-pseudo-digraph-cont-regexp))) (goto-char (match-end 0))) ;; We're at a nested <.....> ((progn @@ -12552,7 +12562,8 @@ comment at the start of cc-engine.el for more info." (/= (char-before placeholder) ?<) (progn (goto-char (1+ placeholder)) - (not (looking-at c-<-op-cont-regexp)))))) + (or (not (looking-at c-<-op-cont-regexp)) + (looking-at c-<-pseudo-digraph-cont-regexp)))))) (goto-char placeholder) (c-beginning-of-statement-1 containing-sexp t) (if (save-excursion diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index d092094817..a6fdc3ec79 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -1406,6 +1406,23 @@ operators." (lambda (op) (substring op 1))))) (c-lang-defvar c-<-op-cont-regexp (c-lang-const c-<-op-cont-regexp)) +(c-lang-defconst c-<-pseudo-digraph-cont-regexp + "Regexp matching the continuation of a pseudo digraph starting \"<\". +This is used only in C++ Mode, where \"<::\" is handled as a +template opener followed by the \"::\" operator - usually." + t regexp-unmatchable + c++ "::\\([^:>]\\|$\\)") +(c-lang-defvar c-<-pseudo-digraph-cont-regexp + (c-lang-const c-<-pseudo-digraph-cont-regexp)) + +(c-lang-defconst c-<-pseudo-digraph-cont-len + "The maximum length of the main bit of a `c--op-cont-tokens ;; A list of second and subsequent characters of all multicharacter tokens ;; that begin with ">". commit a93dceda3fdcca18b51cb96461e1b8a4fc61bfd7 Author: Stefan Monnier Date: Fri Oct 11 13:54:30 2019 -0400 * lisp/cedet/mode-local.el (define-overload): Declare obsolete * lisp/cedet/srecode/ctxt.el (srecode-calculate-context): * lisp/cedet/srecode/semantic.el (srecode-semantic-apply-tag-to-dict) (srecode-semantic-find-template): Use define-overloadable-function instead. diff --git a/etc/NEWS b/etc/NEWS index 2fe0a907ef..eeb02b7066 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2076,6 +2076,9 @@ Emacs init file does not expose you to this change. However, if you set 'time-stamp-format' or 'time-stamp-pattern' with a file-local variable, you may need to update the value. +** mode-local +*** define-overload is declared obsolete + * New Modes and Packages in Emacs 27.1 diff --git a/lisp/cedet/mode-local.el b/lisp/cedet/mode-local.el index 50dc3cb793..28867eea9b 100644 --- a/lisp/cedet/mode-local.el +++ b/lisp/cedet/mode-local.el @@ -560,7 +560,8 @@ OVERARGS is a list of arguments passed to the override and (put ',name 'mode-local-overload t))) (put :override-with-args 'lisp-indent-function 1) -(defalias 'define-overload 'define-overloadable-function) +(define-obsolete-function-alias 'define-overload + #'define-overloadable-function "27.1") (defsubst function-overload-p (symbol) "Return non-nil if SYMBOL is a function which can be overloaded." diff --git a/lisp/cedet/semantic/bovine/el.el b/lisp/cedet/semantic/bovine/el.el index b4217080b6..dd21f50325 100644 --- a/lisp/cedet/semantic/bovine/el.el +++ b/lisp/cedet/semantic/bovine/el.el @@ -241,8 +241,8 @@ Return a bovination list to use." (semantic-elisp-desymbolify-args (nth 2 form)) :user-visible-flag (eq (car-safe (nth 4 form)) 'interactive) :documentation (semantic-elisp-do-doc (nth 3 form)) - :overloadable (or (eq (car form) 'define-overload) - (eq (car form) 'define-overloadable-function)) + :overloadable (memq (car form) '(define-overload + define-overloadable-function)) )) defun defun* diff --git a/lisp/cedet/srecode/ctxt.el b/lisp/cedet/srecode/ctxt.el index b20b9bc641..ee9f12fcae 100644 --- a/lisp/cedet/srecode/ctxt.el +++ b/lisp/cedet/srecode/ctxt.el @@ -36,7 +36,7 @@ ;;; Code: -(define-overload srecode-calculate-context () +(define-overloadable-function srecode-calculate-context () "Calculate the context at the current point. The returned context is a list, with the top-most context first. Each returned context is a string that would show up in a `context' diff --git a/lisp/cedet/srecode/semantic.el b/lisp/cedet/srecode/semantic.el index 1e1a60e024..344b908da3 100644 --- a/lisp/cedet/srecode/semantic.el +++ b/lisp/cedet/srecode/semantic.el @@ -89,7 +89,7 @@ If this is nil, then `senator-tag-ring' is used.") The hook is called with two arguments, the TAG and DICT to be augmented.") -(define-overload srecode-semantic-apply-tag-to-dict (tagobj dict) +(define-overloadable-function srecode-semantic-apply-tag-to-dict (tagobj dict) "Insert features of TAGOBJ into the dictionary DICT. TAGOBJ is an object of class `srecode-semantic-tag'. This class is a compound inserter value. @@ -227,7 +227,7 @@ Assumes the cursor is in a tag of class type. If not, throw an error." ;;; INSERT A TAG API ;; ;; Routines that take a tag, and insert into a buffer. -(define-overload srecode-semantic-find-template (class prototype ctxt) +(define-overloadable-function srecode-semantic-find-template (class prototype ctxt) "Find a template for a tag of class CLASS based on context. PROTOTYPE is non-nil if we want a prototype template instead." ) commit 421db07d061cdc493300b30646c2acd13f26d8f3 Author: Andrea Corallo Date: Fri Oct 11 12:18:21 2019 -0400 * lisp/emacs-lisp/map.el (map-into) : Allow keyword args (map--into-hash): New function, extracted from `map-into `. Speed it up a bit by using gethash instead of map-elt when we know we're accessing a hash table. * test/lisp/emacs-lisp/map-tests.el (test-map-into): Add corresponding test. diff --git a/etc/NEWS b/etc/NEWS index 4e7843ced8..2fe0a907ef 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -665,6 +665,8 @@ at the end of the active minibuffer. *** New generic function 'map-insert'. +++ +** The 'type' arg can be a list '(hash-table :key1 VAL1 :key2 VAL2 ...)' + ** seq.el New convenience functions 'seq-first' and 'seq-rest' give easy access to respectively the first and all but the first elements of sequences. diff --git a/lisp/emacs-lisp/map.el b/lisp/emacs-lisp/map.el index 54e802edf4..74927b6224 100644 --- a/lisp/emacs-lisp/map.el +++ b/lisp/emacs-lisp/map.el @@ -338,7 +338,8 @@ The default implementation delegates to `map-apply'." t)) (defun map-merge (type &rest maps) - "Merge into a map of type TYPE all the key/value pairs in MAPS." + "Merge into a map of type TYPE all the key/value pairs in MAPS. +See `map-into' for all supported values of TYPE." (let ((result (map-into (pop maps) type))) (while maps ;; FIXME: When `type' is `list', we get an O(N^2) behavior. @@ -354,7 +355,8 @@ The default implementation delegates to `map-apply'." "Merge into a map of type TYPE all the key/value pairs in MAPS. When two maps contain the same key (`eql'), call FUNCTION on the two values and use the value returned by it. -MAP can be a list, hash-table or array." +MAP can be a list, hash-table or array. +See `map-into' for all supported values of TYPE." (let ((result (map-into (pop maps) type)) (not-found (cons nil nil))) (while maps @@ -458,17 +460,28 @@ If you want to insert an element in place, use `map-put!'." (funcall function index elt)) array)) -(cl-defmethod map-into (map (_type (eql hash-table))) - "Convert MAP into a hash-table." - ;; FIXME: Just knowing we want a hash-table is insufficient, since that - ;; doesn't tell us the test function to use with it! - (let ((ht (make-hash-table :size (map-length map) - :test 'equal))) +(defun map--into-hash (map keyword-args) + "Convert MAP into a hash-table. +KEYWORD-ARGS are forwarded to `make-hash-table'." + (let ((ht (apply #'make-hash-table keyword-args))) (map-apply (lambda (key value) - (setf (map-elt ht key) value)) + (setf (gethash key ht) value)) map) ht)) +(cl-defmethod map-into (map (_type (eql hash-table))) + "Convert MAP into a hash-table." + (map--into-hash map (list :size (map-length map) :test 'equal))) + +(cl-defmethod map-into (map (type (head hash-table))) + "Convert MAP into a hash-table. +TYPE is a list where the car is `hash-table' and the cdr are the keyword-args +forwarded to `make-hash-table'. + +Example: + (map-into '((1 . 3)) '(hash-table :test eql))" + (map--into-hash map (cdr type))) + (defun map--make-pcase-bindings (args) "Return a list of pcase bindings from ARGS to the elements of a map." (seq-map (lambda (elt) diff --git a/test/lisp/emacs-lisp/map-tests.el b/test/lisp/emacs-lisp/map-tests.el index a54af8059b..5e8c9cb9f0 100644 --- a/test/lisp/emacs-lisp/map-tests.el +++ b/test/lisp/emacs-lisp/map-tests.el @@ -340,7 +340,8 @@ Evaluate BODY for each created map. (ert-deftest test-map-into () (let* ((alist '((a . 1) (b . 2))) - (ht (map-into alist 'hash-table))) + (ht (map-into alist 'hash-table)) + (ht2 (map-into alist '(hash-table :test equal)))) (should (hash-table-p ht)) (should (equal (map-into (map-into alist 'hash-table) 'list) alist)) @@ -349,6 +350,8 @@ Evaluate BODY for each created map. (map-keys ht))) (should (equal (map-values (map-into (map-into ht 'list) 'hash-table)) (map-values ht))) + (should (equal (map-into ht 'alist) (map-into ht2 'alist))) + (should (eq (hash-table-test ht2) 'equal)) (should (null (map-into nil 'list))) (should (map-empty-p (map-into nil 'hash-table))) (should-error (map-into [1 2 3] 'string)))) commit 65cda95be4f69c32b16364c95cb7c08971bc9397 Author: Stefan Kangas Date: Fri Oct 11 15:59:42 2019 +0200 Remove reference to obsolete package gnuserv from FAQ On visiting http://meltin.net/hacks/emacs/, we now find: "I used to have some Emacs and Haskell hacks on my previous sites. However, these hacks are now old and un-maintained. I don’t think there is enough interest to keep them around." * doc/misc/efaq.texi (Using an already running Emacs process): Remove reference to obsolete package 'gnuserv'. (Bug#37574) diff --git a/doc/misc/efaq.texi b/doc/misc/efaq.texi index 5a81fc0094..bb79b6c837 100644 --- a/doc/misc/efaq.texi +++ b/doc/misc/efaq.texi @@ -2019,17 +2019,6 @@ the user is done editing a file, the user can type @kbd{C-x #} (or requested by @code{emacsclient}, Emacs will switch to it; otherwise @code{emacsclient} will exit, signaling the calling program to continue. -@cindex @code{gnuserv} -There is an alternative version of @samp{emacsclient} called -@c ange@@hplb.hpl.hp.com -@samp{gnuserv}, written by Andy Norman -(@pxref{Packages that do not come with Emacs}). @samp{gnuserv} uses -Internet domain sockets, so it can work across most network connections. - -The most recent @samp{gnuserv} package is available at - -@uref{http://meltin.net/hacks/emacs/} - @end itemize For more information, @xref{Emacs Server,,, emacs, The GNU Emacs Manual}. commit de063da61beb076190104fa21ec69a3479d59647 Author: Robert Pluim Date: Wed Oct 9 15:28:47 2019 +0200 Correct some more custom type specs * lisp/winner.el (winner-boring-buffers-regexp): * lisp/progmodes/js.el (js-jsx-indent-level): * lisp/image-dired.el (image-dired-external-viewer): * lisp/gnus/nnir.el (nnir-notmuch-filter-group-names-function): Correct custom type specification. * lisp/textmodes/bibtex.el (bibtex-string-file-path): (bibtex-file-path): Correct custom type specification and document source of initial value. diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el index 1041373a05..7cb2d1615a 100644 --- a/lisp/gnus/nnir.el +++ b/lisp/gnus/nnir.el @@ -535,7 +535,7 @@ like so: (lambda (g) (replace-regexp-in-string \"\\\\.\" \"/\" g)))" :version "27.1" :type '(choice function - nil)) + (const :tag "No" nil))) ;;; Developer Extension Variable: diff --git a/lisp/image-dired.el b/lisp/image-dired.el index c1c767ba78..85bc924794 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -538,7 +538,9 @@ with the comment." "Name of external viewer. Including parameters. Used when displaying original image from `image-dired-thumbnail-mode'." - :type 'string + :version "27.1" + :type '(choice string + (const :tag "Not Set" nil)) :group 'image-dired) (defcustom image-dired-main-image-directory "~/pics/" diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 3050e8f1a7..8d457a28ec 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -650,7 +650,8 @@ indentation looks like this (different): )" :version "27.1" - :type 'integer + :type '(choice integer + (const :tag "Not Set" nil)) :safe (lambda (x) (or (null x) (integerp x))) :group 'js) ;; This is how indentation behaved out-of-the-box until Emacs 27. JSX diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el index 7e99032084..c29e963180 100644 --- a/lisp/textmodes/bibtex.el +++ b/lisp/textmodes/bibtex.el @@ -933,9 +933,12 @@ to the directories specified in `bibtex-string-file-path'." :type '(repeat file)) (defcustom bibtex-string-file-path (getenv "BIBINPUTS") - "Colon-separated list of paths to search for `bibtex-string-files'." + "Colon-separated list of paths to search for `bibtex-string-files'. +Initialized from the BIBINPUTS environment variable." :group 'bibtex - :type 'string) + :version "27.1" + :type '(choice string + (const :tag "Not Set" nil))) (defcustom bibtex-files nil "List of BibTeX files that are searched for entry keys. @@ -949,9 +952,12 @@ See also `bibtex-search-entry-globally'." directory file))) (defcustom bibtex-file-path (getenv "BIBINPUTS") - "Colon separated list of paths to search for `bibtex-files'." + "Colon separated list of paths to search for `bibtex-files'. +Initialized from the BIBINPUTS environment variable." :group 'bibtex - :type 'string) + :version "27.1" + :type '(choice string + (const :tag "Not Set" nil))) (defcustom bibtex-search-entry-globally nil "If non-nil, interactive calls of `bibtex-search-entry' search globally. diff --git a/lisp/winner.el b/lisp/winner.el index dc8bde5331..a97bfbde9d 100644 --- a/lisp/winner.el +++ b/lisp/winner.el @@ -61,7 +61,8 @@ You may want to include buffer names such as *Help*, *Apropos*, (defcustom winner-boring-buffers-regexp nil "`winner-undo' will not restore windows with buffers matching this regexp." - :type 'string + :type '(choice (regexp :tag "Regexp") + (const :tag "Not Set" nil)) :version "27.1") commit b259bf63c77a01f3035813b3485fbd9ad7ae02a0 Author: Michael Albinus Date: Fri Oct 11 13:50:34 2019 +0200 Cleanup Tramp * lisp/net/tramp-archive.el (tramp-archive-gvfs-host): Fix docstring. * lisp/net/tramp.el: Remove :group from all defcustoms. (tramp-encoding-shell): Fix docstring. (tramp-error): Remove text properties from error message. diff --git a/lisp/net/tramp-archive.el b/lisp/net/tramp-archive.el index 82fd327770..84dba32cb6 100644 --- a/lisp/net/tramp-archive.el +++ b/lisp/net/tramp-archive.el @@ -409,7 +409,7 @@ used `tramp-file-name' structure for tramp-gvfs, and the file name of a local copy, if any.") (defsubst tramp-archive-gvfs-host (archive) - "Return host name of ARCHIVE as used in GVFS for mounting" + "Return host name of ARCHIVE as used in GVFS for mounting." (url-hexify-string (tramp-gvfs-url-file-name archive))) (defun tramp-archive-dissect-file-name (name) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 2e57f7e1c7..be6d29e768 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -4662,13 +4662,11 @@ Goes through the list `tramp-inline-compress-commands'." ;; Host. (string-match-p (or (eval (nth 0 item)) "") - (or (tramp-file-name-host-port (car target-alist)) - "")) + (or (tramp-file-name-host-port (car target-alist)) "")) ;; User. (string-match-p (or (eval (nth 1 item)) "") - (or (tramp-file-name-user-domain (car target-alist)) - ""))) + (or (tramp-file-name-user-domain (car target-alist)) ""))) (if (null proxy) ;; No more hops needed. (setq choices nil) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index b17e4a787c..d0d8f276ca 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -90,7 +90,6 @@ (defcustom tramp-mode t "Whether Tramp is enabled. If it is set to nil, all remote file names are used literally." - :group 'tramp :type 'boolean) (defcustom tramp-verbose 3 @@ -108,7 +107,6 @@ Any level x includes messages for all levels 1 .. x-1. The levels are 8 connection properties 9 test commands 10 traces (huge)." - :group 'tramp :type 'integer) (defcustom tramp-backup-directory-alist nil @@ -122,7 +120,6 @@ name prefix \(method, user, host) of file. gives the same backup policy for Tramp files on their hosts like the policy for local files." - :group 'tramp :type '(repeat (cons (regexp :tag "Regexp matching filename") (directory :tag "Backup directory name")))) @@ -130,7 +127,6 @@ policy for local files." "Put auto-save files in this directory, if set. The idea is to use a local directory so that auto-saving is faster. This setting has precedence over `auto-save-file-name-transforms'." - :group 'tramp :type '(choice (const :tag "Use default" nil) (directory :tag "Auto save directory name"))) @@ -140,8 +136,8 @@ This setting has precedence over `auto-save-file-name-transforms'." (or (tramp-compat-funcall 'w32-shell-name) "/bin/sh")) "Use this program for encoding and decoding commands on the local host. This shell is used to execute the encoding and decoding command on the -local host, so if you want to use `~' in those commands, you should -choose a shell here which groks tilde expansion. `/bin/sh' normally +local host, so if you want to use \"~\" in those commands, you should +choose a shell here which groks tilde expansion. \"/bin/sh\" normally does not understand tilde expansion. For encoding and decoding, commands like the following are executed: @@ -157,7 +153,6 @@ If the shell must be forced to be interactive, see Note that this variable is not used for remote commands. There are mechanisms in tramp.el which automatically determine the right shell to use for the remote host." - :group 'tramp :type '(file :must-match t)) ;; Suppress `shell-file-name' for w32 systems. @@ -166,7 +161,6 @@ use for the remote host." (if (tramp-compat-funcall 'w32-shell-dos-semantics) "/c" "-c")) "Use this switch together with `tramp-encoding-shell' for local commands. See the variable `tramp-encoding-shell' for more information." - :group 'tramp :type 'string) ;; Suppress `shell-file-name' for w32 systems. @@ -176,7 +170,6 @@ See the variable `tramp-encoding-shell' for more information." "Use this switch together with `tramp-encoding-shell' for interactive shells. See the variable `tramp-encoding-shell' for more information." :version "24.1" - :group 'tramp :type '(choice (const nil) string)) (defvar tramp-methods nil @@ -377,7 +370,6 @@ useful only in combination with `tramp-default-proxies-alist'.") "Default method to use for transferring files. See `tramp-methods' for possibilities. Also see `tramp-default-method-alist'." - :group 'tramp :type 'string) (defcustom tramp-default-method-alist nil @@ -392,7 +384,6 @@ If the file name does not specify the user, lookup is done using the empty string for the user name. See `tramp-methods' for a list of possibilities for METHOD." - :group 'tramp :type '(repeat (list (choice :tag "Host regexp" regexp sexp) (choice :tag "User regexp" regexp sexp) (choice :tag "Method name" string (const nil))))) @@ -406,7 +397,6 @@ It is nil by default; otherwise settings in configuration files like \"~/.ssh/config\" would be overwritten. Also see `tramp-default-user-alist'. This variable is regarded as obsolete, and will be removed soon." - :group 'tramp :type '(choice (const nil) string)) (defcustom tramp-default-user-alist nil @@ -419,7 +409,6 @@ matches, the variable `tramp-default-user' takes effect. If the file name does not specify the method, lookup is done using the empty string for the method name." - :group 'tramp :type '(repeat (list (choice :tag "Method regexp" regexp sexp) (choice :tag " Host regexp" regexp sexp) (choice :tag " User name" string (const nil))))) @@ -427,7 +416,6 @@ empty string for the method name." (defcustom tramp-default-host (system-name) "Default host to use for transferring files. Useful for su and sudo methods mostly." - :group 'tramp :type 'string) (defcustom tramp-default-host-alist nil @@ -440,7 +428,6 @@ matches, the variable `tramp-default-host' takes effect. If the file name does not specify the method, lookup is done using the empty string for the method name." - :group 'tramp :version "24.4" :type '(repeat (list (choice :tag "Method regexp" regexp sexp) (choice :tag " User regexp" regexp sexp) @@ -466,14 +453,12 @@ carries the non-nil text property `tramp-ad-hoc'. HOST, USER or PROXY could also be Lisp forms, which will be evaluated. The result must be a string or nil, which is interpreted as a regular expression which always matches." - :group 'tramp :type '(repeat (list (choice :tag "Host regexp" regexp sexp) (choice :tag "User regexp" regexp sexp) (choice :tag " Proxy name" string (const nil))))) (defcustom tramp-save-ad-hoc-proxies nil "Whether to save ad-hoc proxies persistently." - :group 'tramp :version "24.3" :type 'boolean) @@ -486,7 +471,6 @@ a registered shell like \"rbash\". Those hosts can be used as proxies only, see `tramp-default-proxies-alist'. If the local host runs a registered shell, it shall be added to this list, too." :version "24.3" - :group 'tramp :type '(repeat (regexp :tag "Host regexp"))) (defcustom tramp-local-host-regexp @@ -498,7 +482,6 @@ host runs a registered shell, it shall be added to this list, too." "Host names which are regarded as local host. If the local host runs a chrooted environment, set this to nil." :version "27.1" - :group 'tramp :type '(choice (const :tag "Chrooted environment" nil) (regexp :tag "Host regexp"))) @@ -551,14 +534,12 @@ the remote shell.") (if (memq system-type '(windows-nt)) "\r\n" "\n") "String used for end of line in local processes." :version "24.1" - :group 'tramp :type 'string) (defcustom tramp-rsh-end-of-line "\n" "String used for end of line in rsh connections. I don't think this ever needs to be changed, so please tell me about it if you need to change this." - :group 'tramp :type 'string) (defcustom tramp-login-prompt-regexp @@ -567,7 +548,6 @@ if you need to change this." The regexp should match at end of buffer. Sometimes the prompt is reported to look like \"login as:\"." - :group 'tramp :type 'regexp) (defcustom tramp-shell-prompt-pattern @@ -589,7 +569,6 @@ which should work well in many cases. This regexp must match both `tramp-initial-end-of-output' and `tramp-end-of-output'." - :group 'tramp :type 'regexp) (defcustom tramp-password-prompt-regexp @@ -599,7 +578,6 @@ The regexp should match at end of buffer. The `sudo' program appears to insert a `^@' character into the prompt." :version "24.4" - :group 'tramp :type 'regexp) (defcustom tramp-wrong-passwd-regexp @@ -624,7 +602,6 @@ The `sudo' program appears to insert a `^@' character into the prompt." "\\).*") "Regexp matching a `login failed' message. The regexp should match at end of buffer." - :group 'tramp :type 'regexp) (defcustom tramp-yesno-prompt-regexp @@ -638,7 +615,6 @@ The regexp should match at end of buffer." The confirmation should be done with yes or no. The regexp should match at end of buffer. See also `tramp-yn-prompt-regexp'." - :group 'tramp :type 'regexp) (defcustom tramp-yn-prompt-regexp @@ -651,7 +627,6 @@ See also `tramp-yn-prompt-regexp'." The confirmation should be done with y or n. The regexp should match at end of buffer. See also `tramp-yesno-prompt-regexp'." - :group 'tramp :type 'regexp) (defcustom tramp-terminal-prompt-regexp @@ -663,7 +638,6 @@ See also `tramp-yesno-prompt-regexp'." "Regular expression matching all terminal setting prompts. The regexp should match at end of buffer. The answer will be provided by `tramp-action-terminal', which see." - :group 'tramp :type 'regexp) (defcustom tramp-operation-not-permitted-regexp @@ -672,7 +646,6 @@ The answer will be provided by `tramp-action-terminal', which see." "Regular expression matching keep-date problems in (s)cp operations. Copying has been performed successfully already, so this message can be ignored safely." - :group 'tramp :type 'regexp) (defcustom tramp-copy-failed-regexp @@ -684,7 +657,6 @@ be ignored safely." t) "\\)\\s-*") "Regular expression matching copy problems in (s)cp operations." - :group 'tramp :type 'regexp) (defcustom tramp-process-alive-regexp @@ -694,7 +666,6 @@ In fact this expression is empty by intention, it will be used only to check regularly the status of the associated process. The answer will be provided by `tramp-action-process-alive', `tramp-action-out-of-band', which see." - :group 'tramp :type 'regexp) (defconst tramp-temp-name-prefix "tramp." @@ -726,7 +697,6 @@ It can have the following values: Do not change the value by `setq', it must be changed only via Customize. See also `tramp-change-syntax'." - :group 'tramp :version "26.1" :package-version '(Tramp . "2.3.3") :type '(choice (const :tag "Default" default) @@ -1041,7 +1011,6 @@ initial value is overwritten by the car of `tramp-file-name-structure'.") (defcustom tramp-ignored-file-name-regexp nil "Regular expression matching file names that are not under Tramp’s control." :version "27.1" - :group 'tramp :type '(choice (const nil) regexp)) (defconst tramp-completion-file-name-regexp-default @@ -1186,7 +1155,6 @@ in the third line of the code. Please raise a bug report via \"M-x tramp-bug\" if your system needs this variable to be set as well." - :group 'tramp :type '(choice (const nil) integer)) ;; Logging in to a remote host normally requires obtaining a pty. But @@ -1197,7 +1165,6 @@ this variable to be set as well." "Overrides `process-connection-type' for connections from Tramp. Tramp binds `process-connection-type' to the value given here before opening a connection to a remote host." - :group 'tramp :type '(choice (const nil) (const t) (const pty))) (defcustom tramp-connection-timeout 60 @@ -1205,7 +1172,6 @@ opening a connection to a remote host." This can be overwritten for different connection types in `tramp-methods'. The timeout does not include the time reading a password." - :group 'tramp :version "24.4" :type 'integer) @@ -1219,7 +1185,6 @@ necessary, when several out-of-order copy operations are performed, or when several asynchronous processes will be started in a short time frame. In those cases it is recommended to let-bind this variable." - :group 'tramp :version "24.4" :type '(choice (const nil) integer)) @@ -1232,7 +1197,6 @@ more than `tramp-completion-reread-directory-timeout' seconds have been gone since last remote command execution. A value of t would require an immediate reread during filename completion, nil means to use always cached values for the directory contents." - :group 'tramp :type '(choice (const nil) (const t) integer)) ;;; Internal Variables: @@ -1842,7 +1806,8 @@ signal identifier to be raised, remaining arguments passed to (list signal (get signal 'error-message) (apply #'format-message fmt-string arguments))))) - (signal signal (list (apply #'format-message fmt-string arguments))))) + (signal signal (list (substring-no-properties + (apply #'format-message fmt-string arguments)))))) (defsubst tramp-error-with-buffer (buf vec-or-proc signal fmt-string &rest arguments) @@ -2798,7 +2763,6 @@ for all methods. Resulting data are derived from default settings." "Whether to use `auth-source-search' for completion of user and host names. This could be disturbing, if it requires a password / passphrase, as for \"~/.authinfo.gpg\"." - :group 'tramp :version "27.1" :type 'boolean) commit 552c20ce39cd513cd6d0c847a1d291554143ba9a Author: Stefan Kangas Date: Fri Oct 11 13:01:13 2019 +0200 Support showing directory in shell command prompt * lisp/simple.el (shell-command-prompt-show-cwd): New defcustom. (async-shell-command, shell-command): Show current directory in prompt when above option is non-nil. (Bug#4987) * etc/NEWS: Announce it. diff --git a/etc/NEWS b/etc/NEWS index a3a7ff28e8..4e7843ced8 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1568,6 +1568,10 @@ variable for remote shells. It still defaults to "/bin/sh". *** 'async-shell-command-width' defines the number of display columns available for output of asynchronous shell commands. ++++ +*** Prompt for shell commands can now show the current directory. +Customize 'shell-command-prompt-show-cwd' to enable it. + ** Pcomplete *** The 'pcomplete' command is now obsolete diff --git a/lisp/simple.el b/lisp/simple.el index 597278ae2b..44ab8e125d 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3384,6 +3384,13 @@ command output." :group 'shell :version "27.1") +(defcustom shell-command-prompt-show-cwd nil + "If non-nil, show current directory when prompting for a shell command. +This affects `shell-command' and `async-shell-command'." + :type 'boolean + :group 'shell + :version "27.1") + (defcustom shell-command-dont-erase-buffer nil "If non-nil, output buffer is not erased between shell commands. Also, a non-nil value sets the point in the output buffer @@ -3473,7 +3480,12 @@ directly, since it offers more control and does not impose the use of a shell (with its need to quote arguments)." (interactive (list - (read-shell-command "Async shell command: " nil nil + (read-shell-command (if shell-command-prompt-show-cwd + (format-message "Async shell command in `%s': " + (abbreviate-file-name + default-directory)) + "Async shell command: ") + nil nil (let ((filename (cond (buffer-file-name) @@ -3546,7 +3558,12 @@ impose the use of a shell (with its need to quote arguments)." (interactive (list - (read-shell-command "Shell command: " nil nil + (read-shell-command (if shell-command-prompt-show-cwd + (format-message "Shell command in `%s': " + (abbreviate-file-name + default-directory)) + "Shell command: ") + nil nil (let ((filename (cond (buffer-file-name)