Stop Testcover from producing spurious 1value errors
Fix bug#25351 by copying results of form evaluations for later
comparison.
* lisp/emacs-lisp/testcover.el (testcover-after): Copy the result
of a form's first evaluation and compare subsequent evaluations to
the copy. Improve the error message used when a form's value
changes.
(testcover--copy-object, testcover--copy-object1): New functions.
* test/lisp/emacs-lisp/testcover-resources/testcases.el
(by-value-vs-by-reference-bug-25351): Remove expected failure tag.
(circular-lists-bug-24402): Add another circular list case.
Rewrite Testcover's internals, fixing several bugs
* lisp/emacs-lisp/testcover.el: Rewrite the internals of Testcover
to analyze instrumented code instead of reinstrumenting it. Use new
hooks in Edebug to collect code coverage information at runtime
using Edebug's instrumentation.
Includes fixes for: (bug#11307) (bug#24509) (bug#24688) (bug#24743)
(bug#25316) (bug#25326).
(testcover-compose-functions): Remove mapcar.
(testcover-start, testcover-this-defun): Analyze code instead of
reinstrumenting it. Set edebug-behavior for each definition.
(testcover--read, testcover-1value, testcover-reinstrument)
(testcover-reinstrument-list, testcover-reinstrument-compose):
Deleted.
(testcover-after-instrumentation, testcover-init-definition)
(testcover-before): New functions.
(testcover-enter): Change call signature to match edebug-enter.
(testcover-after, testcover-mark): Add handling of 'maybe and
'noreturn.
(testcover-analyze-coverage, testcover-analyze-coverage-progn)
(testcover-analyze-coverage-edebug-after)
(testcover-analyze-coverage-wrapped-form)
(testcover-analyze-coverage-wrapped-application)
(testcover-analyze-coverage-compose)
(testcover-analyze-coverage-backquote)
(testcover-analyze-coverage-backquote-form)
(testcover-coverage-combine): New functions to analyze instrumented
code.
* lisp/emacs-lisp/gv.el: Modify edebug-after's gv-expander to
instrument in the setter as well as the getter.
* test/lisp/emacs-lisp/testcover-tests.el
(testcover-tests-run-test-case): Use `edebug-default-enter'
instead of `edebug-enter' to detect Edebug invocation
during tests.
* test/lisp/emacs-lisp/testcover-resources/testcases.el
(constants-bug-25316)
(customize-defcustom-bug-25326)
(1-value-symbol-bug-25316)
(quotes-within-backquotes-bug-25316)
(backquote-1value-bug-24509)
(pcase-bug-24688)
(defun-in-backquote-bug-11307-and-24743)
(closure-1value-bug)
(backquoted-vector-bug-25316)
(vector-in-macro-spec-bug-25316)
(mapcar-is-not-compose): Remove expected failure tags.
(function-with-edebug-spec-bug-25316): Remove expected failure tag
and modify expected result.
(quoted-backquote): New test.
* lisp/textmodes/rst.el: Remove workarounds for bugs in Testcover.
(rst-testcover-defcustom): Deleted.
* lisp/subr.el (1value): Remove incorrect description of
testcover-1value from docstring, replace with description of
Testcover's treatment of 1value.
Gemini Lasswell [Sun, 1 Oct 2017 16:12:29 +0000 (09:12 -0700)]
Allow Edebug's instrumentation to be used for other purposes
* lisp/emacs-lisp/edebug.el:
(edebug-after-instrumentation-functions)
(edebug-new-definition-functions): New hook variables.
(edebug-behavior-alist): New variable.
(edebug-read-and-maybe-wrap-form): Run a hook after a form is
wrapped.
(edebug-make-form-wrapper): Run a hook after a definition is
wrapped. Remove message for each definition.
(edebug-announce-definition): New function.
(edebug-enter): Rewritten to change behavior of Edebug based
on symbol property `edebug-behavior' and `edebug-behavior-alist'.
(edebug-default-enter): New function which does what `edebug-enter'
used to do.
(edebug-run-slow, edebug-run-fast): Modify edebug-behavior-alist.
(edebug-before, edebug-after): Function definitions are now set by
`edebug-enter'.
Stefan Monnier [Sun, 8 Oct 2017 19:44:49 +0000 (15:44 -0400)]
* lisp/emacs-lisp/checkdoc.el: cl-defstruct + minor simplifications
(checkdoc-make-overlay, checkdoc-overlay-put, checkdoc-delete-overlay)
(checkdoc-overlay-start, checkdoc-overlay-end, checkdoc-char=)
(checkdoc-mode-line-update): Remove old compatibility aliases.
(checkdoc, checkdoc-interactive-loop):
Consolidate common code in if branches.
(checkdoc-error): New struct type.
(checkdoc-error-text, checkdoc-error-start, checkdoc-error-end)
(checkdoc-error-unfixable): Now defined by cl-defstruct.
Raise an error when detecting old-style backquotes.
They have been deprecated for a decade now.
* src/lread.c (Fload): Don't use record_unwind_protect to warn about
old-style backquotes any more. They now generate a hard error.
(read1): Signal an error when detecting old-style backquotes. Remove
unused label.
(syms_of_lread): Remove unused internal variable
'lread--old-style-backquotes'.
(load_error_old_style_backquotes): Rename from
'load_warn_oldstyle_backquotes'. Signal an error.
* lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Remove check
from byte compiler. It isn't triggered any more.
* test/src/lread-tests.el (lread-tests--old-style-backquotes): Adapt
unit test.
* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp-tests--old-style-backquotes)
(bytecomp-tests-function-put): Adapt unit tests.
Eli Zaretskii [Sat, 7 Oct 2017 12:04:37 +0000 (15:04 +0300)]
New defcustom 'tooltip-resize-echo-area'
* lisp/tooltip.el (tooltip-resize-echo-area): New defcustom.
(tooltip-show-help-non-mode): Use it to avoid truncating the
tooltip text in the echo area. (Bug#28724)
Paul Eggert [Fri, 6 Oct 2017 17:35:07 +0000 (10:35 -0700)]
Merge from origin/emacs-26
9226cf3254 Fix bug in recent styled_format change fa92f0c447 Cleanup emacs-lisp-mode's use of Flymake 0d0265bf50 Fix @include directive in Flymake doc 295457ae52 Move read-multiple-choice to its own library 560dd9b573 * src/process.c (syms_of_process): Remove duplicated call ...
Paul Eggert [Fri, 6 Oct 2017 17:32:46 +0000 (10:32 -0700)]
Fix bug in recent styled_format change
Problem reported by Kaushal Modi in:
http://lists.gnu.org/archive/html/emacs-devel/2017-10/msg00141.html
* src/editfns.c (styled_format): Fix bug where USE_SAFE_ALLOCA was
not always followed by SAFE_FREE. This bug was introduced in my
patch 2017-09-26T23:31:57Z!eggert@cs.ucla.edu entitled "Avoid some
unnecessary copying in Fformat etc."
Lele Gaifax [Fri, 6 Oct 2017 13:08:49 +0000 (14:08 +0100)]
Fix typos in Flymake documentation
* doc/misc/flymake.texi (Syntax check statuses)
(Adding support for a new syntax check tool)
(Implementation overview, Locating the buildfile): Fix typos.
* lisp/progmodes/flymake-proc.el (flymake-proc--report-fn)
(flymake-proc--find-possible-master-files):Fix typos.
(flymake-proc--panic)
(flymake-proc-legacy-flymake): Fix function reference in doc.
Eli Zaretskii [Fri, 6 Oct 2017 12:42:22 +0000 (15:42 +0300)]
Revert last change in 'shr-descend'
* lisp/net/shr.el (shr-descend): Revert the part of the last
change which introduced calls to shr-indirect-call into this
function. Add a comment explaining the rationale for that.
(Bug#28402)
João Távora [Thu, 5 Oct 2017 21:23:24 +0000 (22:23 +0100)]
Delete a Flymake obsolete alias that can't possibly work
The function `flymake-ler-make-ler' can't possibly work as an backward
compatible interface to existing extensinos (even purely hypothetical
ones, since none are known). This is because every diagnostic
considered by Flymake has to passed to a report-fn function.
Gemini Lasswell [Thu, 5 Oct 2017 19:41:35 +0000 (12:41 -0700)]
Fix dynamic binding wrapper in iter-lambda (bug#25965)
* lisp/emacs-lisp/generator.el (cps--make-dynamic-binding-wrapper):
Remove extra evaluation of form.
* test/lisp/emacs-lisp/generator-tests.el
(cps-iter-lambda-with-dynamic-binding): New test.
Alan Mackenzie [Mon, 18 Sep 2017 08:52:24 +0000 (08:52 +0000)]
Fix irregularities with CC Mode fontification, particularly with "known types"
* lisp/progmodes/cc-fonts.el (c-font-lock-declarators): Introduce a new
optional parameter, template-class. In "class <X = Y>", fontify "Y" as a
type.
(c-font-lock-single-decl): New variable template-class, set to non-nil when we
have a construct like the above. Pass this as argument to
c-font-lock-declarators.
(c-font-lock-cut-off-declarators): Check more rigorously that a declaration
being processed starts before the function's starting position.
(c-complex-decl-matchers): Remove the redundant clause which fontified "types
preceded by, e.g., "struct"".
* lisp/progmodes/cc-langs.el (c-template-typename-kwds)
(c-template-typename-key): New lang defconsts and defvar.
Eli Zaretskii [Thu, 5 Oct 2017 14:57:58 +0000 (17:57 +0300)]
Fix breakage due to recent change in tabulated-list-print-entry
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-printer):
Update the doc string.
(tabulated-list-print-entry): Revert to using only 2 arguments.
Update the doc string.
(tabulated-list-entry-lnum-width): New defvar.
(tabulated-list-print): Compute the width of line-number display
once, then store that value in tabulated-list-entry-lnum-width,
for tabulated-list-printer to use. (Bug#28704)
Set xterm click count to 1 even with no last click
* lisp/xt-mouse.el (xterm-mouse-event): Move the check for
the last click so that click-count is initialized properly.
Handle the value of t for double-click-time.
(Bug#28658)
The 'shr-external-rendering-functions' variable was previously only
honored in the shr-descend function, now all direct calls to the
shr-tag-* functions have been replaced by a call to
'shr-indirect-call' which tries using an alternative rendering
function first.
* lisp/net/shr.el (shr-indirect-call): New helper function.
(shr-descend, shr-tag-object, shr-tag-video):
(shr-collect-extra-strings-in-table): Fix callers to call via
shr-indirect-call. (Bug#28402)
Eli Zaretskii [Thu, 5 Oct 2017 09:41:36 +0000 (12:41 +0300)]
Speed up list-packages when 'visual' line numbers are displayed
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-printer):
Update the doc string.
(tabulated-list-print-entry): Accept an additional optional
argument INDENT. Update the doc string.
(tabulated-list-print): Compute the width of line-number display
once, then call tabulated-list-printer with that value as 3rd
argument. (Bug#28704)
João Távora [Thu, 5 Oct 2017 01:42:01 +0000 (02:42 +0100)]
Misc. minor adjustments to Flymake
- Add a half-decent minor-mode menu;
- Fix "waiting for backends" mode line message;
- Adjust the flymake-diag-region API;
- Autoload the flymake-log macro;
- Auto-disable the legacy backend in more situations;
- Fix a couple of warnings in legacy backend.
* lisp/progmodes/flymake-proc.el
(flymake-proc--diagnostics-for-pattern): Use new
flymake-diag-region.
* lisp/progmodes/flymake-proc.el
(flymake-proc-legacy-flymake): Do error when no
buffer-file-name or not writable.
(flymake-proc-legacy-flymake)
(flymake-proc-simple-cleanup): Don't reference flymake-last-change-time
* lisp/progmodes/flymake.el (flymake-diag-region):
Autoload. Take buffer as first argument.
* lisp/progmodes/flymake.el (flymake-switch-to-log-buffer):
New command.
(flymake-menu): Add a simple menu.
(flymake--mode-line-format): Use menu. Fix message. Switch to
log buffer when clicking exceptional warnings.
Paul Eggert [Wed, 4 Oct 2017 21:29:58 +0000 (14:29 -0700)]
Speed up (format "%s" STRING) and the like
Although the Lisp manual said that ‘format’ returns a
newly-allocated string, this was not true for a few cases like
(format "%s" ""), and fixing the documentation to allow reuse of
arguments lets us improve performance in common cases like
(format "foo") and (format "%s" "foo") (Bug#28625).
* doc/lispref/strings.texi (Formatting Strings):
* etc/NEWS:
Say that the result of ‘format’ might not be newly allocated.
* src/callint.c (Fcall_interactively):
* src/dbusbind.c (XD_OBJECT_TO_STRING):
* src/editfns.c (Fmessage, Fmessage_box):
* src/xdisp.c (vadd_to_log, Ftrace_to_stderr):
Just use Fformat or Fformat_message, as that’s simpler and no
longer makes unnecessary copies.
* src/editfns.c (styled_format): Remove last argument, as it
is no longer needed: all callers now want it to behave as if it
were true. All remaining callers changed. Make this function
static again. Simplify the function now that we no longer
need to worry about whether the optimization is allowed.
Alan Mackenzie [Wed, 4 Oct 2017 17:34:27 +0000 (17:34 +0000)]
Fontify untyped function declarations in C Mode correctly.
Also correct two bugs where deleting WS at a BOL could leave an untyped
function declaration unfontified.
* lisp/progmodes/cc-engine.el (c-find-decl-spots): Don't set the flag
"top-level" when we're in a macro.
(c-forward-decl-or-cast-1): Recognize top-level "foo(bar)" or "foo()" in C
Mode as a implicitly typed function declaration.
(c-just-after-func-arglist-p): Don't get confused by "defined (foo)" inside a
macro. It's not a function plus arglist.
* lisp/progmodes/cc-langs.el (c-cpp-expr-functions-key): New defconst and
defvar.
* lisp/progmodes/cc-mode.el (c-fl-decl-end): After c-forward-declarator, move
over any following parenthesis expression (i.e. parameter list).
(c-change-expand-fl-region): When c-new-END is at a BOL, include that line in
the returned region, to cope with deletions at column 0.
Eli Zaretskii [Wed, 4 Oct 2017 07:27:49 +0000 (10:27 +0300)]
Avoid crashes on C-g when several threads wait for input
* src/thread.h (m_getcjmp): New member of 'struct thread_state'.
(getcjmp): Define to current thread's 'm_getcjmp'.
* src/thread.c (maybe_reacquire_global_lock): Switch to main
thread, since this is called from a SIGINT handler, which always
runs in the context of the main thread.
* src/lisp.h (sys_jmp_buf, sys_setjmp, sys_longjmp): Move the
definitions before thread.h is included, as thread.h now uses
sys_jmp_buf.
* src/keyboard.c (getcjmp): Remove declaration.
(read_char): Don't call maybe_reacquire_global_lock here.
(handle_interrupt): Call maybe_reacquire_global_lock here, if
invoked from the SIGINT handler, to make sure
quit_throw_to_read_char runs with main thread's Lisp bindings and
uses the main thread's jmp_buf buffer. (Bug#28630)
Paul Eggert [Tue, 3 Oct 2017 22:42:10 +0000 (15:42 -0700)]
--with-pop is now the default only on MS-Windows
Problem reported by N. Jackson (Bug#28597).
This improves an earlier suggestion by Robert Pluim (Bug#28597#47).
* INSTALL, configure.ac, etc/NEWS:
Make --with-pop the default only on native MS-Windows.
* lisp/net/tramp-adb.el (tramp-adb-handle-file-system-info): New defun.
(tramp-adb-file-name-handler-alist): Use it.
* lisp/net/tramp-gvfs.el (tramp-gvfs-file-system-attributes)
(tramp-gvfs-file-system-attributes-regexp): New defconst.
(tramp-gvfs-handle-file-system-info): New defun.
(tramp-gvfs-file-name-handler-alist): Use it.
(tramp-gvfs-get-directory-attributes): Fix property name.
(tramp-gvfs-get-root-attributes): Support also file system attributes.
* lisp/net/tramp-sh.el (tramp-sh-handle-file-system-info): New defun.
(tramp-sh-file-name-handler-alist): Use it.
(tramp-sh-handle-insert-directory): Insert size information.
(tramp-get-remote-df): New defun.
* lisp/net/tramp-smb.el (tramp-smb-handle-file-system-info): New defun.
(tramp-smb-file-name-handler-alist): Use it.
(tramp-smb-handle-insert-directory): Insert size information.
* test/lisp/net/tramp-tests.el (tramp-test37-file-system-info):
New test.
(tramp-test38-asynchronous-requests)
(tramp-test39-recursive-load, tramp-test40-remote-load-path)
(tramp-test41-unload): Rename.
João Távora [Wed, 27 Sep 2017 17:42:02 +0000 (18:42 +0100)]
Start rewriting Flymake manual
Missing the parts pertaining to the new customization API.
* doc/misc/flymake.texi (Overview of Flymake): Rewrite a bit.
(Installing Flymake): Delete most of this.
(Running the syntax check): Mention flymake-start.
(Navigating to error lines): Rewrite.
(Viewing error messages): Commente out.
(Syntax check statuses, Troubleshooting): Rewrite a bit.
(Customizable variables): New section under "Using
Flymake". Don't mention any proc variables here.
(Configuring Flymake): Delete
(Proc backend): New chapter
(Proc customization variables): New chapter.
* doc/misc/flymake.texi (Overview of Flymake): Rewrite a bit.
(Installing Flymake): Mostly scratch. Flymake comes with Emacs.
(Running the syntax check): Simplify.
(Viewing error messages): Dekete,
(Syntax check statuses): Rewrite.
(Troubleshooting): Simplify.
(Customizable variables): Rewrite.
(Extending Flymake): New chapter, empty for now.
(The legacy Proc backend): New chapter.
(Proc customizable variables)
(Adding support for a new syntax check tool)
(Implementation overview)
(Making a temporary copy)
(Locating a master file)
(Getting the include directories)
(Locating the buildfile)
(Starting the syntax check process)
(Parsing the output)
(Interaction with other modes)
(Example---Configuring a tool called via make)
(Example---Configuring a tool called directly): Rewrite a bit.
João Távora [Mon, 2 Oct 2017 12:28:18 +0000 (13:28 +0100)]
Minimal tweak as an attempt to future-proof Flymake API
Discussed with Stefan that this should allow Flymake to request more
from backends in the future, while also allowing backends to report
more accurately.
* lisp/progmodes/elisp-mode.el (elisp-flymake-checkdoc)
(elisp-flymake-byte-compile): Adjust to new API.
* lisp/progmodes/flymake-proc.el ()
(flymake-proc-legacy-flymake): Adjust to new API.
* lisp/progmodes/flymake.el (flymake-diagnostic-functions):
Review API again.
(flymake--handle-report): Allow other keys. Change ACTION to
REPORT-ACTION.
João Távora [Sun, 1 Oct 2017 12:30:38 +0000 (13:30 +0100)]
Hook Flymake onto proper checkdoc and byte-compile interfaces
The interfaces in bytecomp.el and checkdoc.el are mostly boilerplate,
with little knowledge of actual internals or thought given to the
usefulness of said interfaces in contexts other than Flymake's.
* lisp/emacs-lisp/bytecomp.el
(byte-compile-log-warning-function): New variable.
(byte-compile-log-warning): Use it.
(byte-compile--log-warning-for-byte-compile): New function.
* lisp/emacs-lisp/checkdoc.el
(checkdoc-create-error-function): New variable.
(checkdoc-create-error): Use it.
(checkdoc--create-error-for-checkdoc): New function.xo
* lisp/progmodes/flymake-elisp.el (flymake-elisp--checkdoc-1):
Use checkdoc-create-error-function.
(flymake-elisp--batch-byte-compile): Use
byte-compile-log-warning-function.
João Távora [Sat, 30 Sep 2017 16:32:53 +0000 (17:32 +0100)]
Flymake backends can report multiple times per check
Rewrote a significant part of the Flymake backend API. Flymake now
ignores the return value of backend functions: a function can either
returns or errors. If it doesn't error, a backend is no longer
constrained to call REPORT-FN exactly once. It may do so any number
of times, cumulatively reporting diagnostics. Flymake keeps track of
outdated REPORT-FN instances and disconsiders obsolete reports.
Backends should avoid reporting obsolete data by cancelling any
ongoing processing at every renewed call to the backend function.
Consolidated flymake.el internal data structures to require less
buffer-local variables. Adjusted Flymake's mode-line indicator to the
new semantics.
Adapted and simplified the implementation of elisp and legacy
backends, fixing potential race conditions when calling backends in
rapid succession.
Added a new test for a backend that calls REPORT-FN multiple
times. Simplify test infrastructure.
* lisp/progmodes/flymake-elisp.el (flymake-elisp-checkdoc)
(flymake-elisp-byte-compile): Error instead of returning nil
if not in emacs-lisp-mode.
(flymake-elisp--byte-compile-process): New buffer-local variable.
(flymake-elisp-byte-compile): Mark (and kill) previous process
obsolete process before starting a new one. Don't report if
obsolete process.
* lisp/progmodes/flymake-proc.el
(flymake-proc--current-process): New buffer-local variable.
(flymake-proc--processes): Remove.
(flymake-proc--process-filter): Don't bind
flymake-proc--report-fn.
(flymake-proc--process-sentinel): Rewrite. Don't report if
obsolete process.
(flymake-proc-legacy-flymake): Rewrite. Mark (and kill)
previous process obsolete process before starting a new
one. Integrate flymake-proc--start-syntax-check-process
helper.
(flymake-proc--start-syntax-check-process): Delete.
(flymake-proc-stop-all-syntax-checks): Don't use
flymake-proc--processes, iterate buffers.
(flymake-proc-compile):
* lisp/progmodes/flymake.el (subr-x): Require it
explicitly.
(flymake-diagnostic-functions): Reword docstring.
(flymake--running-backends, flymake--disabled-backends)
(flymake--diagnostics-table): Delete.
(flymake--backend-state): New buffer-local variable and new defstruct.
(flymake--with-backend-state, flymake--collect)
(flymake-running-backends, flymake-disabled-backends)
(flymake-reporting-backends): New helpers.
(flymake-is-running): Use flymake-running-backends.
(flymake--handle-report): Rewrite.
(flymake-make-report-fn): Ensure REPORT-FN runs in the correct
buffer or not at all.
(flymake--disable-backend, flymake--run-backend): Rewrite.
(flymake-start): Rewrite.
(flymake-mode): Set flymake--backend-state.
(flymake--mode-line-format): Rewrite.
* test/lisp/progmodes/flymake-tests.el
(flymake-tests--wait-for-backends): New helper.
(flymake-tests--call-with-fixture): Use it.
(included-c-header-files): Fix whitespace.
(flymake-tests--diagnose-words): New helper.
(dummy-backends): Rewrite for new semantics. Use cl-letf.
(flymake-tests--assert-set): Use quote.
(recurrent-backend): New test.
João Távora [Sat, 30 Sep 2017 09:45:48 +0000 (10:45 +0100)]
Flymake uses proper idle timers
Also, flymake-no-changes-timeout can be set to nil to disable
automatic periodic checks. But even in that situation the idle timer
still runs at a reduced rate to detect changes in the variable and
revert that decision.
* lisp/progmodes/flymake.el (flymake-no-changes-timeout): Improve doc.
(flymake-last-change-time): Delete.
(flymake--schedule-timer-maybe): New helper.
(flymake-after-change-function): Use it.
(flymake-on-timer-event): Delete
(flymake-mode): Don't scheduler timer.
João Távora [Fri, 29 Sep 2017 10:02:36 +0000 (11:02 +0100)]
Batch of minor Flymake cleanup actions agreed to with Stefan
Discussed with Stefan, in no particular order
- Remove aliases for symbols thought to be internal to flymake-proc.el
- Don’t need :group in defcustom and defface in flymake.el
- Fix docstring of flymake-make-diagnostic
- Fix docstring of flymake-diagnostic-functions to clarify keywords.
- Mark overlays with just the property ’flymake, not ’flymake-overlay
- Tune flymake-overlays for performance
- Make flymake-mode-on and flymake-mode-off obsolete
- Don’t use hash-table-keys unless necessary.
- Copyright notice in flymake-elisp.
Added some more
- Clarify docstring of flymake-goto-next-error
- Clarify a comment in flymake--run-backend complaining about ert-deftest.
- Prevent compilation warnings in flymake-proc.el
- Remove doctring from obsolete aliases
* lisp/progmodes/flymake-proc.el (flymake-warning-re)
(flymake-proc-diagnostic-type-pred)
(flymake-proc-default-guess)
(flymake-proc--get-file-name-mode-and-masks): Move up to
beginning of file to shoosh compiler warnings
(define-obsolete-variable-alias): Delete many obsolete aliases.
* lisp/progmodes/flymake.el (flymake-error-bitmap)
(flymake-warning-bitmap, flymake-note-bitmap)
(flymake-fringe-indicator-position)
(flymake-start-syntax-check-on-newline)
(flymake-no-changes-timeout, flymake-gui-warnings-enabled)
(flymake-start-syntax-check-on-find-file, flymake-log-level)
(flymake-wrap-around, flymake-error, flymake-warning)
(flymake-note): Don't need :group in these defcustom and defface.
(flymake--run-backend): Clarify comment
(flymake-mode-map): Remove.
(flymake-make-diagnostic): Fix docstring.
(flymake--highlight-line, flymake--overlays): Identify flymake
overlays with just ’flymake.
(flymake--overlays): Reverse order of invocation for
cl-remove-if-not and cl-sort.
(flymake-mode-on)
(flymake-mode-off): Make obsolete.
(flymake-goto-next-error, flymake-goto-prev-error): Fix docstring.
(flymake-diagnostic-functions): Clarify keyword arguments in
docstring.
Maybe squash in that one where I remove many obsoletes
João Távora [Thu, 28 Sep 2017 13:17:27 +0000 (14:17 +0100)]
Flymake uses some new fringe bitmaps
Also fix behaviour whereby flymake wouldn't react to a change in the
variable.
* lisp/progmodes/flymake-ui.el (flymake-error-bitmap)
(flymake-warning-bitmap): Update bitmaps.
(flymake-note-bitmap): New defcustom.
(flymake-double-exclamation-mark): New bitmap.
(flymake-error, flymake-warning, flymake-note)
(flymake--highlight-line): 'bitmap property must be a symbol.
Also set default face to flymake-error.
(flymake--fringe-overlay-spec): Bitmap property can be a
variable symbol.
João Távora [Thu, 28 Sep 2017 11:06:56 +0000 (12:06 +0100)]
Fix three Flymake bugs when checking C header files
The first of these problems is longstanding: if an error-less B.h is
included from error-ridden A.h, flymake's legacy parser will panic
(and disable itself) since it sees a non-zero exit for a clean file.
To fix this, recommend returning 'true' in the documentation for the
check-syntax target.
Another problem was introduced by the parser rewrite. For error
patterns spanning more than one line, point may be left in the middle
of a line and thus render other patterns useless. Those patterns were
written for the old line-by-line parser. To make them useful again,
move to the beginning of line in those situations.
The third problem was also longstanding and happened on newer GCC's:
The "In file included from" prefix confused
flymake-proc-get-real-file-name. Fix this.
Also updated flymake--diag-region to fallback to highlighting a full
line less often.
Add automatic tests to check this.
* lisp/progmodes/flymake-proc.el
(flymake-proc--diagnostics-for-pattern): Fix bug when patterns
accidentally spans more than one line. Don't create
diagnostics without error messages.
(flymake-proc-real-file-name-considering-includes): New
helper.
(flymake-proc-allowed-file-name-masks): Use it.
* lisp/progmodes/flymake.el (flymake-diag-region): Make COL
argument explicitly optional. Only fall back to full line in extreme
cases.
* test/lisp/progmodes/flymake-tests.el
(included-c-header-files): New test.
(different-diagnostic-types): Update.
João Távora [Wed, 27 Sep 2017 01:44:06 +0000 (02:44 +0100)]
A couple of Flymake backends for emacs-lisp-mode
Loading flymake-elisp.el doesn't setup flymake-mode to turn on
automatically, but it affects emacs-lisp-mode-hook so that
flymake-diagnostic-functions is setup with a suitable buffer-local
value. The variable flymake-diagnostic-funtions in every live
emacs-lisp-mode buffer is also adjusted.
João Távora [Wed, 27 Sep 2017 01:31:58 +0000 (02:31 +0100)]
Fancy Flymake mode-line construct displays status
Imitates compilation-mode's mode-line a bit, and uses its faces.
* lisp/progmodes/flymake.el
(flymake-error, flymake-warning, flymake-note): Add
mode-line-face to these flymake error types.
(flymake-note): Notes don't need a noisy fringe bitmap.
(flymake-lighter): Delete.
(flymake--update-lighter): Delete.
(flymake--mode-line-format): New function and variable.
(flymake--diagnostics-table): New buffer-local variable.
(flymake--handle-report): Don't update "lighters". Affect
flymake--diagnostics-table.
(flymake--run-backend): Init flymake--diagnostics-table for backend.
(flymake-mode): Use flymake--mode-line-format.
(flymake-mode): Don't update lighter.
(flymake--highlight-line): Be more careful when overriding a
nil default overlay property.
Add filters, useful for backends like the upcoming
flymake-elisp-checkdoc backend, for example, which litters everything
with low-priority notes.
Also re-implement wraparound for flymake-goto-next-error. Manual
mentions this, so it's probably a good idea to keep it. Added a new
customization variable flymake-wrap-around to control it.
* lisp/progmodes/flymake.el (flymake-goto-prev-error)
(flymake-goto-next-error): Accept FILTER argument.
(flymake-wrap-around): New variable.
(flymake-goto-next-error): Wrap around according to flymake-wrap-around.
* test/lisp/progmodes/flymake-tests.el
(different-diagnostic-types, dummy-backends): Pass FILTER to
flymake-goto-prev-error.
(different-diagnostic-types)
(dummy-backends): Use flymake-wrap-around.
João Távora [Mon, 25 Sep 2017 23:45:46 +0000 (00:45 +0100)]
New Flymake API variable flymake-diagnostic-functions
Lay groundwork for multiple active backends in the same buffer.
Backends are lisp functions called when flymake-mode sees fit. They
are responsible for examining the current buffer and telling
flymake.el, via return value, if they can syntax check it.
Backends should return quickly and inexpensively, but they are also
passed a REPORT-FN argument which they may or may not call
asynchronously after performing more expensive work.
REPORT-FN's calling convention stipulates that a backend calls it with
a list of diagnostics as argument, or, alternatively, with a symbol
denoting an exceptional situation, usually some panic resulting from a
misconfigured backend. In keeping with legacy behaviour,
flymake.el's response to a panic is to disable the issuing backend.
The flymake--diag object representing a diagnostic now also keeps
information about its source backend. Among other uses, this allows
flymake to selectively cleanup overlays based on which backend is
updating its diagnostics.
* lisp/progmodes/flymake-proc.el (flymake-proc--report-fn):
New dynamic variable.
(flymake-proc--process): New variable.
(flymake-can-syntax-check-buffer): Remove.
(flymake-proc--process-sentinel): Simplify. Use
unwind-protect. Affect flymake-proc--processes here.
Bind flymake-proc--report-fn.
(flymake-proc--process-filter): Bind flymake-proc--report-fn.
(flymake-proc--post-syntax-check): Delete
(flymake-proc-start-syntax-check): Take mandatory
report-fn. Rewrite. Bind flymake-proc--report-fn.
(flymake-proc--process-sentinel): Rewrite and simplify.
(flymake-proc--panic): New helper.
(flymake-proc--start-syntax-check-process): Record report-fn
in process. Use flymake-proc--panic.
(flymake-proc-stop-all-syntax-checks): Use mapc. Don't affect
flymake-proc--processes here. Record interruption reason.
(flymake-proc--init-find-buildfile-dir)
(flymake-proc--init-create-temp-source-and-master-buffer-copy):
Use flymake-proc--panic.
(flymake-diagnostic-functions): Add
flymake-proc-start-syntax-check.
(flymake-proc-compile): Call
flymake-proc-stop-all-syntax-checks with a reason.
* lisp/progmodes/flymake.el (flymake-backends): Delete.
(flymake-check-was-interrupted): Delete.
(flymake--diag): Add backend slot.
(flymake-delete-own-overlays): Take optional filter arg.
(flymake-diagnostic-functions): New user-visible variable.
(flymake--running-backends, flymake--disabled-backends): New
buffer-local variables.
(flymake-is-running): Now a function, not a variable.
(flymake-mode-line, flymake-mode-line-e-w)
(flymake-mode-line-status): Delete.
(flymake-lighter): flymake's minor-mode "lighter".
(flymake-report): Delete.
(flymake--backend): Delete.
(flymake--can-syntax-check-buffer): Delete.
(flymake--handle-report, flymake--disable-backend)
(flymake--run-backend, flymake--run-backend): New helpers.
(flymake-make-report-fn): Make a lambda.
(flymake--start-syntax-check): Iterate
flymake-diagnostic-functions.
(flymake-mode): Use flymake-lighter. Simplify. Initialize
flymake--running-backends and flymake--disabled-backends.
(flymake-find-file-hook): Simplify.
* test/lisp/progmodes/flymake-tests.el
(flymake-tests--call-with-fixture): Use flymake-is-running the
function. Check if flymake-mode already active before activating it.
Add a thorough test for flymake multiple backends
* lisp/progmodes/flymake.el (flymake--start-syntax-check):
Don't use condition-case-unless-debug, use condition-case
* test/lisp/progmodes/flymake-tests.el
(flymake-tests--assert-set): New helper macro.
(dummy-backends): New test.
João Távora [Sat, 23 Sep 2017 17:15:40 +0000 (18:15 +0100)]
More Flymake cleanup before advancing to backend redesign
Diagnostics are reported for buffers, not necessarily files. It’s the
backend’s responsibility to compute the buffer where the diagnostic is
applicable. For now, this has to match the buffer where flymake-mode
is active and which is at the origin of the backend call.
flymake.el knows nothing about line/column diagnostics (except for
backward-compatible flymake-ler-make-ler, which must yet be tested).
It’s also the backend’s reponsibility to compute a BEG and END
positions for the diagnostic in the relevant buffer.
* lisp/progmodes/flymake-proc.el
(flymake-proc--diagnostics-for-pattern): Convert LINE/COL to
region here. Check file buffer here.
(flymake-proc--process-sentinel): Don’t kill output buffer if
high enough log level.
* lisp/progmodes/flymake.el (flymake-diag-region): Make this a utility
function. (flymake--highlight-line): Diagnostic has region now.
(flymake-popup-current-error-menu): Don’t add file and line numbers to
already this silly menu. (flymake--fix-line-numbers): Remove.
(flymake-report): No need to fix diagnostics here.
João Távora [Fri, 22 Sep 2017 00:31:23 +0000 (01:31 +0100)]
Protect Flymake's eager checks against commands like fill-paragraph
If flymake-start-syntax-check-on-newline is t, check should start as
soon as a newline is seen by after-change-functions. But don't rush
it: since the buffer state might not be final, we might end up with
invalid diagnostic regions after some commands silently insert and
delete newlines (looking at you, fill-paragraph).
* lisp/progmodes/flymake.el (flymake-after-change-function): Pass
`deferred' to flymake--start-syntax-check.
(flymake--start-syntax-check): Take optional `deferred' arg.
João Távora [Thu, 21 Sep 2017 13:44:13 +0000 (14:44 +0100)]
Flymake highlights GCC info/notes as detected by flymake-proc.el
* lisp/progmodes/flymake-proc.el
(flymake-proc--diagnostics-for-pattern): Rewrite (using cl-loop) to
honour more sophisticated flymake-proc-diagnostic-type-pred.
(flymake-warning-re): Is now an obsolete alias for
flymake-proc-diagnostic-type-pred.
(flymake-proc-diagnostic-type-pred): Rename and augment from
flymake-proc-warning-predicate. (flymake-proc-warning-predicate):
Delete.
* lisp/progmodes/flymake.el (flymake-note): New face.
(flymake-diagnostic-types-alist): Simplify.
(flymake-note): New overlay category.
(flymake--lookup-type-property): Only lookup single keys, not lists.
(flymake--diag-errorp): Rewrite.
(flymake--highlight-line): Use flymake--lookup-type-property.
* test/lisp/progmodes/flymake-tests.el
(different-diagnostic-types): Rename from errors-and-warnings.
Check notes.
(flymake-tests--call-with-fixture): Use
flymake-proc-diagnostic-type-pred.
João Távora [Tue, 19 Sep 2017 13:25:34 +0000 (14:25 +0100)]
Flymake's flymake-proc.el parses column numbers from gcc/javac errors
Column numbers are not a great way of marking diagnostic regions, but
that's probably all that can be expected from the flymake-proc.el
backend. For now, try (end-of-thing 'sexp) to discover the
diagnostic's end position.
* lisp/progmodes/flymake-proc.el ()
(flymake-proc-err-line-patterns): Also parse column numbers,
if available, for gcc/javac warnings.
João Távora [Thu, 7 Sep 2017 14:13:39 +0000 (15:13 +0100)]
New Flymake variable flymake-diagnostic-types-alist and much cleanup
A new user-visible variable is introduced where different diagnostic
types can be categorized. Flymake backends can also contribute to
this variable. Anything that doesn’t match an existing error type
is considered.
The variable’s alists are used to propertize the overlays pertaining
to each error type. The user can override the built-in properties by
either by modifying the alist, or by modifying the properties of a
special "category" symbol, named by the `flymake-category' entry in
the alist.
The `flymake-category' entry is especially useful for, say, the author
of foo-flymake-backend, who issues diagnostics of type :foo-note, that
should behave like notes, except with no fringe bitmap:
For essential properties like `severity', `priority', etc, a default
value is produced. Some properties like `evaporate' cannot be
overriden.
* lisp/progmodes/flymake.el (flymake--diag): Rename from
flymake-ler.
(flymake-ler-make): Obsolete alias for flymake-diagnostic-make
(flymake-ler-errorp): Rewrite using flymake--severity.
(flymake--place-overlay): Delete.
(flymake--overlays): Now a cl-defun with &key args. Document.
Use `overlays-at' if BEG is non-nil and END is nil.
(flymake--lookup-type-property): New helper.
(flymake--highlight-line): Rewrite.
(flymake-diagnostic-types-alist): New API variable.
(flymake--diag-region)
(flymake--severity, flymake--face)
(flymake--fringe-overlay-spec): New helper.
(flymake-popup-current-error-menu): Use new flymake-overlays.
(flymake-popup-current-error-menu, flymake-report): Use
flymake--diag-errorp.
(flymake--fix-line-numbers): Use flymake--diag-line.
(flymake-goto-next-error): Pass :key to flymake-overlays
* lisp/progmodes/flymake-proc.el
(flymake-proc--diagnostics-for-pattern): Use flymake-diagnostic-make.
João Távora [Thu, 7 Sep 2017 13:19:33 +0000 (14:19 +0100)]
Refactor Flymake tests in preparation for more tests
Introduce a slightly more generic fixture macro.
Also make flymake-tests.el friendlier to interactive runs, by not
killing buffers visited by the user.
* test/lisp/progmodes/flymake-tests.el
(flymake-tests--call-with-fixture): New helper from
flymake-tests--current-face. Don't kill file buffers already
being visited before the test starts.
(flymake-tests--with-flymake): New macro.
(flymake-tests--current-face): Delete.
(warning-predicate-rx-gcc, warning-predicate-function-gcc)
(warning-predicate-rx-perl, warning-predicate-function-perl):
Use flymake-test--with-flymake.
João Távora [Sun, 20 Aug 2017 11:19:45 +0000 (12:19 +0100)]
Allow running Flymake tests from interactive sessions
* test/lisp/progmodes/flymake-tests.el (flymake-tests-data-directory):
Expand to reasonable value if no
EMACS_TEST_DIRECTORY. (flymake-tests--current-face): Work around
"weirdness" of bug 17647 with read-event.
João Távora [Wed, 6 Sep 2017 15:03:24 +0000 (16:03 +0100)]
Flymake diagnostics now apply to arbitrary buffer regions
Make Flymake UI some 150 lines lighter
Strip away much of the original implementation's complexity in
manipulating objects representing diagnostics as well as creating and
navigating overlays.
Lay some groundwork for a more flexible approach that allows for
different classes of diagnostics, not necessarily line-based.
Importantly, one overlay per diagnostic is created, whereas the
original implementation had one per line, and on it it concatenated
the results of errors and warnings.
This means that currently, an error and warning on the same line are
problematic and the warning might be overlooked but this will soon be
fixed by setting appropriate priorities.
Since diagnostics can highlight arbitrary regions, not just lines, the
faces were renamed.
Tests pass and backward compatibility with interactive functions is
maintained, but probably any third-party extension or customization
relying on more than a trivial set of flymake.el internals has stopped
working.
* lisp/progmodes/flymake-proc.el
(flymake-proc--diagnostics-for-pattern): Use new flymake-ler-make
constructor syntax.
* test/lisp/progmodes/flymake-tests.el (warning-predicate-rx-gcc)
(warning-predicate-function-gcc, warning-predicate-rx-perl)
(warning-predicate-function-perl): Use face `flymake-warning'.
João Távora [Wed, 23 Aug 2017 22:18:05 +0000 (23:18 +0100)]
Move symbols in flymake-proc.el to separate namespace
Every symbol in this flymake now starts with the prefix flymake-proc-.
Make obsolete aliases for (almost?) every symbol.
Furthermore, many flymake-proc.el symbols are prefixed with
"flymake-proc--", that is they were considered internal.
Some customization variables, interactive functions, and other symbols
considered useful to user customizations or third-party libraries are
considered "public" or "external" and so use a "flymake-proc-" prefix.
* lisp/progmodes/flymake-proc.el: Every symbol renamed.
* test/lisp/progmodes/flymake-tests.el
(flymake-tests--current-face): Use
flymake-proc-warning-predicate, not flymake-warning-predicate.
Instead of parsing and matching regexps line-by-line, insert
subprocess output in a separate buffer and parse using
`search-forward-regexp'. This eventually enables multi-line error
patterns and simplifies code all around. Store per-check information
in the subprocess using `process-get' and `process-put'. Treat error
messages, warnings, etc. more generically as "diagnostics". Create
these objects as soon as possible, reusing existing `flymake-ler'
structure. Fix some whitespace.
* lisp/progmodes/flymake.el (cl-lib): Require also when
loading.
(flymake--fix-line-numbers): Rename from
flymake-fix-line-numbers. Simplify.
(flymake-report): Call flymake--fix-line-numbers. Rearrange
plain diagnostics list into alist format expected by
flymake-highlight-err-lines.
* lisp/progmodes/flymake-proc.el (flymake-process-filter): Insert
process output and parse in dedicated output buffer.
(flymake-proc--diagnostics-for-pattern): New helper function.
(flymake-process-sentinel): Call flymake-post-syntax-check with
collected diagnostics. Kill output buffer.
(flymake-post-syntax-check): Receive diagnostics as third argument.
(flymake-parse-output-and-residual, flymake-new-err-info)
(flymake-parse-residual, flymake-parse-err-lines)
(flymake-split-output, flymake-proc-parse-line)
(flymake-output-residual): Delete.
(flymake-start-syntax-check-process): Use make-process. Setup
dedicated an output buffer
Noam Postavsky [Tue, 3 Oct 2017 02:54:36 +0000 (22:54 -0400)]
Give more helpful messages for python completion setup failures
* lisp/progmodes/python.el (python-shell-completion-native-setup): In
case the completion setup failed with some exception, print out the
exception type and message. If libedit is detected, raise an
exception, since this is known to fail.
Eli Zaretskii [Mon, 2 Oct 2017 18:35:51 +0000 (21:35 +0300)]
Fix the --without-x build
* src/frame.c (Ficonify_frame) [HAVE_WINDOW_SYSTEM]: Use
frame_parent only in GUI builds to avoid compilation errors in
--without-x builds. (Bug#28611)
Paul Eggert [Mon, 2 Oct 2017 16:04:46 +0000 (09:04 -0700)]
Fix customization of zoneinfo-style-world-list
A customizable variable's initial value cannot depend on that of
another customizable variable, since the variables are initialized
in other than textual order. Problem reported by N. Jackson
(Bug#24291).
* lisp/time.el (display-time-world-list): Default to t,
a special value that expands to zoneinfo-style-word-list
if that works, and to legacy-style-word-list otherwise.
(time--display-world-list): New function.
(display-time-world, display-time-world-timer): Use it.
Alan Mackenzie [Mon, 2 Oct 2017 14:42:13 +0000 (14:42 +0000)]
Fix a CC Mode brace stack cache bug.
* lisp/progmodes/cc-engine.el (c-update-brace-stack): Call
c-beginning-of-current-token after a failing search operation, to ensure we
don't cache a point inside a token.
Paul Eggert [Mon, 2 Oct 2017 05:31:39 +0000 (22:31 -0700)]
Port file-system-info to non-Microsoft
* admin/merge-gnulib (GNULIB_MODULES): Add fsusage.
* doc/emacs/files.texi (Directories): Remove documentation of
now-obsolete directory-free-space-program and
directory-free-space-args.
* etc/NEWS: Mention change.
* etc/PROBLEMS: Slow df is no longer a problem.
* lib/fsusage.c, lib/fsusage.h, m4/fsusage.m4:
New files, copied from Gnulib.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
* lisp/dired.el (dired-free-space-program)
(dired-free-space-args): These aliases are now obsolete.
* lisp/files.el (directory-free-space-program)
(directory-free-space-args): Now obsolete.
(get-free-disk-space): Just call file-system-info instead
of the now-obsolete directory-free-space-program.
* nt/gnulib-cfg.mk (OMIT_GNULIB_MODULE_fsusage): New macro.
* src/fileio.c: Include fsusage.h.
(blocks_to_bytes, Ffile_system_info) [!DOS_NT]: New functions.
(syms_of_fileio) [!DOS_NT]: Defsubr file-system-info.
Paul Eggert [Mon, 2 Oct 2017 04:58:52 +0000 (21:58 -0700)]
Merge from origin/emacs-26
5172fa02cc Prefer HTTPS to HTTP for gnu.org 8cdd8b920a Merge from Gnulib 60b7668b89 Keep eww buffer current when looking up CSS on MDN bd49b6f1b3 Workaround for faulty localtime() under macOS 10.6 913808e224 Doc amendment for syntax-ppss. 98dc91fda8 Remove incorrect NEWS entry about 'find-library' 539d8626cd Remove inadvertent changes to syntax.texi in last commit. 8c18dcbc78 Amend documentation for text-quoting-style becoming a user... 5f76ac150a Make the value nil in text-quoting-style mean what it does... d5e4e004fa Make text-quoting-style customizable. Introduce t and new... 1ba3471b9b eshell.texi improvements 7abb5c3960 Fix ns-win.el on GNUstep 07ea5ef99a Fix reference style in org.texi b03b4f6d79 Improve handling of iconification of child frames (Bug#28611) ba9139c501 Revert "Don't lose arguments to eshell aliases (Bug#27954)" 43fac3beae Make "unsafe directory" error message more informative (Bu... c59ddb2120 Fix slot typecheck in eieio-persistent 8b2ab5014b Fix semantic-ia-fast-jump 5b45e7e1c3 Bind vc-region-history f172894595 Exit macro definition on undefined keys 289fe6c0d1 Reset bidi-paragraph-direction on article rendering a4f7518817 Fix url-http use of url-current-object 4a755ed421 Avoid assertions in vc-hg.el on MS-Windows cb93a6ce72 Improve documentation of 'copy-sequence' 200ef6f721 Minor update of ack.texi cb407d3e87 * doc/emacs/emacs.texi (Acknowledgments): Add more contrib... 82b6c765ff Improve indexing of multi-file/buffer Isearch commands 645ff6c702 Add CAM02 JCh and CAM02-UCS J'a'b' conversions 157007b58e Fix uses of @kindex in the Emacs manual 63a45e8837 Merge branch 'emacs-26' of git.savannah.gnu.org:/srv/git/e... 3ab2f9bbb9 Merge from gnulib cbc8324488 Prefer HTTPS to HTTP for gnu.org bbda601d1d ; Spelling fixes 695cf5300b Wait for frame visibility with timeout in w32term too e1f6e3127a Bring back the busy wait after x_make_frame_visible (Bug#2... bccf635217 ; * src/gtkutil.c (xg_check_special_colors): Add another G... f428757cdb Merge branch 'emacs-26' of git.savannah.gnu.org:/srv/git/e... 26d58f0c58 ; Standardize license notices 73dba0f466 Fix last doc string change in simple.el
Paul Eggert [Mon, 2 Oct 2017 02:53:56 +0000 (19:53 -0700)]
Prefer HTTPS to HTTP for gnu.org
This fixes some URLs I omitted from my previous pass,
notably those in lists.gnu.org. Although lists.gnu.org
does not yet support TLS 1.1, TLS 1.0 is better than nothing.
* lisp/erc/erc.el (erc-official-location):
* lisp/mail/emacsbug.el (report-emacs-bug):
Use https:, not http:.