Filipp Gunbin [Thu, 31 Oct 2019 18:39:01 +0000 (21:39 +0300)]
Make ant regexp in compilation-error-regexp-alist-alist more lax
* lisp/progmodes/compile.el: Make ant regexp accept filenames that may
occur on Cygwin (like c:/test) and optional additional severity level
after task name.
* etc/compilation.txt: Add sample.
Paul Eggert [Fri, 1 Nov 2019 06:31:17 +0000 (23:31 -0700)]
Fix insert-file-contents file error regression
Problem reported for dired-view-file (Bug#37950).
* src/fileio.c (Finsert_file_contents): When visiting,
signal an error if the file could not be opened for any reason,
rather than signaling an error only for nonexistent files, fixing
a bug introduced in 2019-09-16T03:17:43!eggert@cs.ucla.edu.
* lisp/cedet/semantic/texi.el (semantic-analyze-possible-completions),
lisp/cedet/srecode/srt-mode.el (semantic-analyze-possible-completions),
lisp/cedet/semantic/bovine/make.el (semantic-analyze-possible-completions):
Add `flags` arg.
* lisp/cedet/semantic/grammar.el (semantic-analyze-possible-completions):
Add `flags` arg. Reverse the found prefix.
(semantic-ctxt-current-class-list): Include token tags as things to
appear in non-lisp context.
Eric Ludlam [Mon, 28 Oct 2019 01:01:54 +0000 (21:01 -0400)]
* test/lisp/cedet/semantic-utest-ia.el: Update from upstream
Merge content from CEDET on SF to bring in additional test points
and support more types of languages.
(semantic-utest-ia-struct.cpp, semantic-utest-ia-templates.cpp)
(semantic-utest-ia-using.cpp, semantic-utest-ia-nsp.cpp)
(semantic-utest-ia-localvars.cpp, semantic-utest-ia-varnamse.java)
(semantic-utest-ia-wisent.wy, semantic-utest-ia-texi)
(semantic-utest-ia-make, semantic-utest-ia-srecoder): New test points
(semantic-ia-utest-buffer): Use comment-start-skip when looking
for test point tokens.
Capture errors ignoring debugger to enable test for empty results.
Improve output from test diagnostics.
(semantic-ia-utest-buffer-refs): Use comment-start-skip to find
test point tokens.
Author: Eric Ludlam <zappo@gnu.org>
Eric Ludlam [Mon, 28 Oct 2019 00:51:54 +0000 (20:51 -0400)]
* test/manual/cedet/tests/test*: More updates from upstream
* test/manual/cedet/tests/testjavacomp.java,
test/manual/cedet/tests/testnsp.cpp,
test/manual/cedet/tests/testsppcomplete.c,
test/manual/cedet/tests/testtypedefs.cpp,
test/manual/cedet/tests/testvarnames.c:
Merge content from CEDET on SF with extended test points for use with
test/lisp/cedet/semantic-utest-ia.el
Author: Eric Ludlam <zappo@gnu.org>
Eric Ludlam [Mon, 28 Oct 2019 00:36:17 +0000 (20:36 -0400)]
* test/manual/cedet/tests/testdoublens.cpp: Update from upstream
* test/manual/cedet/tests/testdoublens.hpp:
Merge content from CEDET on SF with extended test points for use with
test/lisp/cedet/semantic-utest-ia.el
Author: Eric Ludlam <zappo@gnu.org>
Eric Ludlam [Mon, 28 Oct 2019 00:31:34 +0000 (20:31 -0400)]
* test/manual/cedet/tests/: New files for semantic-utest-ia.el
* test/manual/cedet/tests/test.mk,
test/manual/cedet/tests/test.srt, test/manual/cedet/tests/test.texi,
test/manual/cedet/tests/testlocalvars.cpp,
test/manual/cedet/tests/teststruct.cpp,
test/manual/cedet/tests/testtemplates.cpp,
test/manual/cedet/tests/testusing.cpp,
test/manual/cedet/tests/testusing.hh,
test/manual/cedet/tests/testvarnames.java.
test/manual/cedet/tests/testwisent.wy:
New files to be used by test/lisp/cedet/semantic-utest-ia.el.
Author: Eric Ludlam <zappo@gnu.org>
Inhibit undo-in-region for mouse-drag-region (bug#37700)
'mouse-drag-region' leaves the region active around the dragged text,
so a straight undo did not revert the entire operation. To remedy
this, inhibit undo-in-region when the last command was
mouse-drag-region. (Method suggested by Stefan Monnier.)
* lisp/mouse.el (undo-drag-region): Set the undo-inhibit-region property.
* lisp/simple.el (undo): Inhibit undo-in-region if the last command
had the undo-inhibit-region property set.
* doc/lispref/symbols.texi (Standard Properties):
* doc/lispref/text.texi (Undo): Document undo-inhibit-region.
* etc/NEWS: Announce the property.
* lisp/font-lock.el (font-lock-set-defaults): Ensure that the font
lock variables are buffer-local even when nil, so that they're
copied correctly by mhtml mode when changing sub-modes (bug#33937).
* lisp/progmodes/sh-script.el (sh-syntax-propertize-function):
Tweak previous \ #foo change to work on all quoted characters, but
check that the backslash itself is not backslashed. Regexp from
Stefan Monnier.
Robert Pluim [Thu, 31 Oct 2019 09:52:20 +0000 (10:52 +0100)]
Rework vc stash bindings
This adds create/snapshot bindings to the stash button even when there
are no stashes, and extends the stash menu bindings.
* etc/NEWS: Announce the bindings.
* lisp/vc/vc-git.el (vc-git-stash-shared-map): New keymap. Holds
shared bindings between stash button and stash list.
(vc-git-stash-map): Inherit from vc-git-stash-shared-map.
(vc-git-stash-button-map): New keymap. Holds button bindings,
inherit from vc-git-stash-shared-map.
(vc-git-stash-shared-help, vc-git-stash-list-help): New
defconsts. Abstract out list/button help texts.
(vc-git--make-button-text): Set keymap property to
vc-git-stash-button-map.
(vc-git-make-stash-button): Use vc-git-stash-shared-help.
(vc-git-stash-menu-map): Add items for vc-git-stash and
vc-git-stash-snapshot.
(vc-git-dir-extra-headers): Use vc-git-stash-list-help and
vc-git-stash-shared-help. Add vc-git-stash and
vc-git-stash-snapshot bindings to text shown when there are no stashes.
* lisp/dired.el (dired-font-lock-keywords): Font-lock symlinks
differently based on whether they point at a directory or not
(bug#17064). Based on code from Michael Heerdegen.
Paul Eggert [Wed, 30 Oct 2019 21:40:06 +0000 (14:40 -0700)]
Fix print.c infloop on circular lists
Fix infinite loops in print.c when a circular list is passed
to command-error-default-function or to error-message-string.
* src/print.c (print_error_message):
Use FOR_EACH_TAIL to avoid infloop on circular lists.
(print_object): Use FOR_EACH_TAIL_SAFE, as it uses
Brent’s teleporting tortoise-hare algorithm which is
asymptotically better than the classic tortoise-hare
algorithm that the code wsas using.
* test/src/print-tests.el (print-circle-2): When print-circle
is nil, do not insist on a particular cycle-detection heuristic.
(error-message-string-circular): New test.
Paul Eggert [Wed, 30 Oct 2019 21:24:29 +0000 (14:24 -0700)]
Fix keyboard.c infloops on circular lists
Fix infinite loops in keyboard.c when a circular list is
found in a hook, or in help-event-list, or in the argument
of event-convert-list, or in a keymap where a Lucid event
type list is expected, or in a menu or tab spec.
* src/keyboard.c (safe_run_hooks_error, menu_bar_items)
(parse_menu_item, parse_tab_bar_item, parse_tool_bar_item):
Use FOR_EACH_TAIL to avoid infloop on circular lists.
(help_char_p, Fevent_convert_list, lucid_event_type_list_p):
Use FOR_EACH_TAIL_SAFE to avoid infloop on circular lists,
when the action is idempotent so a circular list can be
treated as a noncircular one.
Paul Eggert [Wed, 30 Oct 2019 21:17:40 +0000 (14:17 -0700)]
Fix fileio.c infloops on circular lists
Fix infinite loops in fileio.c when a circular list is the
value of after_insert_file_functions,
buffer-auto-save-file-format, buffer-file-format, or
write-region-annotate-functions.
* src/fileio.c (Finsert_file_contents, build_annotations):
Use FOR_EACH_TAIL to avoid infloop on circular lists.
(build_annotations): Use an EMACS_INT, not an int, to count
nesting level.
* test/src/fileio-tests.el:
(fileio-tests--circular-after-insert-file-functions): New test.
Tweak fontification of \url{http://foo.org/bar%zot} in (la)tex-mode
* lisp/textmodes/tex-mode.el (tex-font-lock-keywords-1):
\url{http://foo.org/bar%zot} shouldn't be fontified as having a
comment, so make the tex-verbatim face overwrite the
already-applied syntactical comment bits (bug#37134).
* lisp/vc/vc-git.el (vc-git-stash-map): Give `vc-git-stash' a
keystroke, because it's a useful command.
When there are no stashes, there's no way to use that keystroke (since
it's only bound on the stash lines), so perhaps that should also be
fixed somehow.
* lisp/progmodes/m4-mode.el (m4-font-lock-keywords): "dnl"
comments should override any previous syntax-based highlighting
(37132). This makes "dnl foo#bar" be highlighted correctly.
Move description of value to syntax-ppss function.
* lisp/emacs-lisp/syntax.el (syntax-ppss): Move the description of
the return value from...
* src/syntax.c (Fparse_partial_sexp): ... here because
`syntax-ppss' is what's called over the place, and jumping through
an indirection to get to the value description is inconvenient.
Juri Linkov [Wed, 30 Oct 2019 00:00:02 +0000 (02:00 +0200)]
Rename read-char-with-history to read-char-from-minibuffer (bug#10477)
* lisp/simple.el (read-char-from-minibuffer-history):
Rename from read-char-with-history--history.
(read-char-from-minibuffer-map):
Rename from read-char-with-history--map.
(read-char-from-minibuffer): Rename from read-char-with-history.
(read-char-from-minibuffer-self-insert): New command.
(zap-to-char): Use read-char-from-minibuffer.
Juri Linkov [Tue, 29 Oct 2019 23:01:11 +0000 (00:01 +0100)]
Reimplement read-char-with-history based on read-from-minibuffer
* lisp/simple.el (read-char-with-history): Reimplement based on
read-from-minibuffer.
* lisp/simple.el (read-char-with-history--map): New variable
(bug#10477).
Juri Linkov [Tue, 29 Oct 2019 22:31:11 +0000 (00:31 +0200)]
* lisp/tab-bar.el: Store point position and frame buffer-lists in tab.
* lisp/tab-bar.el (tab-bar--tab): Store additionally point-marker,
frame parameters buffer-list and buried-buffer-list, both for wc and ws.
Use seq-filter.
(tab-bar-select-tab): Restore point-marker after restoring
window-configuration. Also restore frame parameters buffer-list
and buried-buffer-list both for window-configuration and window-state.
(tab-bar-history-limit, tab-bar-history--minibuffer-depth): New variables.
(tab-bar-history-current): Rename from tab-bar-history--pre-change.
(tab-bar-history--pre-change): Set tab-bar-history-current.
(tab-bar--history-change): Use seq-take for tab-bar-history-limit.
(tab-bar-history-back, tab-bar-history-forward): Restore point-marker.
(tab-bar-list-noselect): Use seq-remove.
Default exotic image formats (like .webp) to image-mode
* doc/lispref/errors.texi (Standard Errors): Mention the new error.
* lisp/files.el (auto-mode-alist): Add a bunch of image suffixes
to the list (bug#37972) based on the output from "gm convert -list
format" (i.e., graphicsmagick).
* lisp/image-mode.el (image-mode): Rewrite to possibly notify the
user about image-use-external-converter.
(image-mode--setup-mode): Factor out into own function and don't
run under `condition-case' as there's nothing here that should
error.
* lisp/image.el (unknown-image-type): New error.
(image-type): Signal that error so that image-mode can offer
sensible feedback to the user.
Stefan Monnier [Tue, 29 Oct 2019 20:17:14 +0000 (16:17 -0400)]
* lisp/minibuffer.el: Tweak and undo parts of recent changes
(completion-metadata): Always return a fresh new cons cell.
(completion--nth-completion): Don't bother calling adjust-metadata
if the result won't be used.
(completion-pcm--hilit-commonality): Revert recent change which had
removed support for `completions-first-difference` in `substring` and
`partial-completion` styles.
(completion--flex-adjust-metadata): Treat the arg as immutable.
* src/xfaces.c (merge_face_vectors) : Pass ATTR_FILTER to
merge_face_ref to stop recursion merging in advance when possible.
(merge_named_face) : add more conditions to potentially reduce calls to
merge_face_vectors in more unneeded situations.
* src/xfaces.c (merge_face_vectors) : Add extra parameter ATTR_FILTER
with the same functionality than in merge_named_face. Update all
occurrences.
(merge_named_face): Remove condition to avoid call
`merge_face_vectors`.
João Távora [Tue, 29 Oct 2019 00:18:55 +0000 (00:18 +0000)]
Make icomplete-exhibit actually work when navigating up directories
Sometimes, when finding files with icomplete-mode, backward-deleting
the previous word or sexp (to move up a directory) doesn't actually
refresh the file list of the new directory. Forcing redisplay in
icomplete-exhibit misteriously fixes the problem.
* lisp/icomplete.el (icomplete-exhibit): Add call to redisplay.
João Távora [Tue, 29 Oct 2019 00:12:16 +0000 (00:12 +0000)]
New commands for making icomplete behave more like ido
This tries (not particularly hard) to emulate Ido's magic C-k, C-d,
RET and DEL. For now, the new commands have to be explicitly added to
an active map by the user, using something like this:
Juri Linkov [Mon, 28 Oct 2019 21:55:16 +0000 (23:55 +0200)]
* lisp/tab-bar.el: Check for minibuffer-depth in tab-bar-history-mode.
* lisp/tab-bar.el (tab-bar-history--pre-change): Store also minibuffer-depth.
(tab-bar-history-change): Check stored minibuffer-depth for zero.
(tab-bar-history-mode): Use prefix -- for internal functions.
* lisp/progmodes/python.el (python-rx): Use `rx-let' instead of
`rx-constituents'. This allows for some slight redundancy reduction,
since `rx-let' definitions are expanded inside `not' (bug#37849).
Reorder some `or' forms for more efficient matching.
* lisp/erc/erc.el (erc-hide-current-message-p): Make
erc-channel-hide-list work (bug#37879) by getting matching on the
channel name instead of the ERC client name.
Fix `G c' in Gnus group buffers for non-ASCII text
* lisp/gnus/gnus-cus.el (gnus-group-customize): Decoding is
superfluous here -- everything is utf-8 already.
(gnus-group-customize-done): Don't double-encode the text (bug#37901).
Koichi Arakawa [Mon, 28 Oct 2019 08:49:59 +0000 (09:49 +0100)]
Reorder command-line switches in Tramp
* lisp/net/tramp-sh.el (tramp-maybe-open-connection):
`tramp-encoding-command-interactive' must be the last command-line
switch, at least for bash. (Bug#37953)
Juri Linkov [Sun, 27 Oct 2019 23:04:47 +0000 (01:04 +0200)]
* lisp/tab-bar.el: Add tab-bar-history-mode with arrow buttons for navigation.
* lisp/tab-bar.el (tab-bar-back-button, tab-bar-forward-button):
New variables.
(tab-bar-make-keymap-1): Show these buttons in tab-bar-history-mode.
(tab-bar--tab): Add history-back and history-forward.
(tab-bar-select-tab): Restore history-back and history-forward.
(tab-bar-history-omit, tab-bar-history-back)
(tab-bar-history-forward, tab-bar-history-pre-change): New variables.
(tab-bar-history-pre-change, tab-bar-history-change)
(tab-bar-history-back, tab-bar-history-forward)
(tab-bar-history-mode): New functions.
Stefan Monnier [Sun, 27 Oct 2019 21:00:55 +0000 (17:00 -0400)]
* .gitignore: Don't ignore .rej files
Left over rejected hunks that we forgot to merge by hand should not be
silently ignored. Better explicitly remove/rename .rej files when
done with them.
Stephen Gildea [Sun, 27 Oct 2019 15:20:13 +0000 (08:20 -0700)]
time-stamp-time-zone: update customization
* time-stamp.el (time-stamp-time-zone): Support customization with
an integer offset (a new possible value of the ZONE argument to
format-time-string in Emacs 27).
Update the safe-local-variable predicate from string-or-null-p
(describing time-stamp-time-zone's domain before 2015) to new
predicate time-stamp-zone-type-p (describing the current domain).
* time-stamp-tests.el (time-stamp-test-helper-zone-type-p): New test.
Eli Zaretskii [Sun, 27 Oct 2019 15:07:47 +0000 (17:07 +0200)]
Fix point position after revert-buffer in tabulated-list mode
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-print):
Don't use count-screen-lines, as it is unreliable when lines
are truncated and the region ends before a newline (the root
cause is in vertical-motion, but is very hard to fix there).
Instead, use vertical-motion directly, as the problems with
counting/not counting the newline that ends the region are not
relevant to what we need in this function, which is simply the
number of the current window line. (Bug#37941)
João Távora [Sun, 27 Oct 2019 13:20:56 +0000 (13:20 +0000)]
Optimize lisp/icomplete.el when default completion available
Often, when using icomplete with icomplete-show-matches-on-no-input
and commands like C-h f, icomplete-exhibit will take a long time (like
several seconds) to show all the completions.
However, if there is a non-nil default value, like when the C-h f is
performed exactly on a function name, the minibuffer prompt will
reflect that immediately. If the user immediately presses RE
(icomplete-force-complete-and-exit) we take that to mean "use the
default" and avoid the long wait.
As an extra performance tweak, this commit also removes an unneeded
call to icomplete-exhibit in icomplete-minibuffer-setup.
* lisp/icomplete.el (icomplete-force-complete-and-exit): Short-circuit
possibility of non-nil minibuffer-default.
(icomplete-minibuffer-setup): No need to explicitly icomplete-exhibit
here since icomplete-post-command-hook will call it unconditionally.
João Távora [Sun, 27 Oct 2019 00:33:54 +0000 (01:33 +0100)]
Improve scoring algorithm for flex-style completions
The previous algorithm had two problems: it considered non-matches in
the beginning and end of the string as matching "holes" and failed to
penalize larger holes, making flex-score-match-tightness only
effective in some corner cases.
The new formula, which is described in code and in pseudo-code in the
comments, fixes these problems.
As a result, by default, C-h f flex now correctly bubbles up
"company-search-flex-regexp" to the top, in front of "file-exists-p".
With a flex-score-match-tightness smaller than 1.0, the situation is
reversed.
Juri Linkov [Sat, 26 Oct 2019 23:20:15 +0000 (02:20 +0300)]
dired-dwim-target uses most recently visited window instead of next window.
* doc/emacs/dired.texi (Operating on Files): Document behavior change.
* lisp/dired-aux.el (dired-dwim-target-directories): New function.
(dired-dwim-target-directory, dired-dwim-target-defaults): Use it
to get the most recently used window instead of the next window (bug#35385).
* lisp/dired.el (dired-dwim-target): Doc fix.
* test/lisp/dired-tests.el: Remove unnecessary require and pacify
byte-compiler.
Juri Linkov [Sat, 26 Oct 2019 22:38:32 +0000 (01:38 +0300)]
Customizable tab-line-tabs-function and new buffer-local tab-line-mode.
* lisp/tab-line.el (tab-line-tabs-function): Turn defvar into defcustom
with default of tab-line-tabs-window-buffers.
(tab-line-tabs-mode-buffers): New function.
(tab-line-tabs-window-buffers): Rename from tab-line-tabs.
(tab-line-select-tab, tab-line-switch-to-prev-tab)
(tab-line-switch-to-next-tab): Handle the value tab-line-tabs-window-buffers
of tab-line-tabs-function specially.
(tab-line-mode): Rename from global-tab-line-mode and change scope
to buffer-local.
(global-tab-line-mode): New globalized-minor-mode.
(tab-line-mode--turn-on): New function.
(tab-line-exclude-modes): New defcustom.
(tab-line-exclude): New buffer-local variable.
https://lists.gnu.org/archive/html/emacs-devel/2019-10/msg00988.html
* lisp/dired.el (dired-mark-pop-up): Set tab-line-exclude to nil.
Don't set tab-line-format. (Bug#37699)
* lisp/speedbar.el (speedbar-mode): Set tab-line-exclude to nil.
Don't set tab-line-format.
Juri Linkov [Sat, 26 Oct 2019 22:16:10 +0000 (01:16 +0300)]
* lisp/tab-bar.el (tab-bar-switch-to-recent-tab): New command.
(tab-recent): Alias to tab-bar-switch-to-recent-tab.
(tab-bar--tab-index-recent): New internal function.
(tab-bar-close-tab-select): Add new default option 'recent'.
(tab-bar-close-tab): Handle it.
Robert Cochran [Thu, 24 Oct 2019 00:34:24 +0000 (17:34 -0700)]
Add customization option for what do when the last tab is closed
* lisp/tab-bar.el (tab-bar-close-last-tab-choice): New custom
variable.
(tab-bar-close-tab): Handle closing the last tab specially, referring to
tab-bar-close-last-tab-choice.
Stephen Gildea [Sat, 26 Oct 2019 21:31:22 +0000 (14:31 -0700)]
time-stamp-tests: add name prefix to tests of formatting
* time-stamp-tests.el: rename all the time-stamp-string formatting tests
to have the word "format" in their name, to make room in the namespace
for other, future tests.
João Távora [Sat, 26 Oct 2019 20:47:36 +0000 (21:47 +0100)]
Restore default value of face completions-common-part
The previous commit titled "Rework face hints for partial-string
completion styles" contained a potentially controversial
backwards-incompatible change to this face's default value.
Arash Esbati [Sat, 26 Oct 2019 11:29:14 +0000 (13:29 +0200)]
Improve support for biblatex and cleveref macros
* lisp/textmodes/reftex-cite.el (reftex-figure-out-cite-format):
Extend regexp to match additional cite commands from biblatex.sty.
* lisp/textmodes/reftex-dcr.el (reftex-view-crossref): Extend
regexp to match additional cite commands from biblatex.sty and
reference commands from cleveref.sty.
Arash Esbati [Sat, 26 Oct 2019 11:25:19 +0000 (13:25 +0200)]
Avoid infloop's by doing a case-sensitive match
* lisp/textmodes/reftex-ref.el (reftex-format-special): Be
case-sensitive when checking the actual reference macro against
\ref. This avoids infloop when \Ref is chosen.
João Távora [Sat, 26 Oct 2019 13:31:38 +0000 (14:31 +0100)]
Rework face hints for partial-string completion styles
Don't use completions-first-difference for the 'substring', 'flex' and
'partial-completion' styles, since there can be really no reasonable
definition of a "first" difference there.
Make completions-common-part inherit from 'underline' so that it is
useful by default for all completion styles.
* lisp/minibuffer.el (completions-common-part): Adjust
description and change default value.
(completions-first-difference): Ajust docstring.
(completion-pcm--hilit-commonality): Don't use
completions-first-difference.
João Távora [Sat, 26 Oct 2019 13:13:08 +0000 (14:13 +0100)]
Allow completion styles to adjust completion metadata
This commit re-does the now-reverted commit with the same title. That
version relied on generic functions, which cannot be used yet in files
such as lisp/minibuffer.el. This version uses a symbol property
completion--adjust-metadata instead.
The new facility allows completion styles to have a say in metadata
properties such as cycle-sort-function and display-sort-function.
This is especially useful for completion styles such as 'flex', which
generally produce many matches, including some potentially "obscure"
ones. The default sorting strategy would often bubble the latter to
the top of the list.
The sorting function for 'flex' considers pre-computed matching scores
and is thus much better than the default for this particular style.
Additionally, it overrides the completion table's cycle-sort-function
or display-sort-function properties if they exist, although it still
uses them to pre-sort the result, so that they are still relevant for
resolving ties.
* lisp/minibuffer.el (completion--nth-completion)
(completion--flex-adjust-metadata): New helper.
(flex): Put completion--adjust-metadata property.