1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-20 18:17:20 +00:00
Commit Graph

69648 Commits

Author SHA1 Message Date
Aurelien Aptel
349c1f9302 Add parser for Netscape/Mozilla cookie file format
* lisp/url/url-cookie.el (url-cookie-parse-file-netscape): New function.
2017-10-10 11:07:56 +02:00
Philipp Stephani
6abff55b55 Revert "Raise an error when detecting old-style backquotes."
This reverts commit 9613690f6e.
2017-10-09 16:08:15 +02:00
Mark Oteiza
2c39565dc0 Disable XTerm titles (Bug#28591)
* etc/NEWS: Mention it.
* lisp/term/xterm.el (xterm-set-window-title): Disable it.
2017-10-09 08:12:46 -04:00
Gemini Lasswell
3c2e8eff8c 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.
2017-10-08 16:13:39 -07:00
Gemini Lasswell
d79cf638f2 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.
2017-10-08 16:08:49 -07:00
Gemini Lasswell
06e452a572 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'.
2017-10-08 16:08:49 -07:00
Stefan Monnier
85b4e88194 * 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.
2017-10-08 15:44:49 -04:00
Philipp Stephani
9613690f6e 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.

* etc/NEWS: Document change.
2017-10-08 18:52:37 +02:00
Philipp Stephani
f4995e7d36 Say that side effect-free functions don't change the matchd data
* lisp/help-fns.el (describe-function-1): Add note if a function is
known not to change the match data.
2017-10-08 17:43:54 +02:00
Eli Zaretskii
9b3ce62521 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)

* etc/NEWS: Mention 'tooltip-resize-echo-area'.
2017-10-07 15:04:37 +03:00
Paul Eggert
53da55b8cc 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 ...
2017-10-06 10:35:07 -07:00
João Távora
fa92f0c447 Cleanup emacs-lisp-mode's use of Flymake
* lisp/progmodes/elisp-mode.el (elisp-flymake--checkdoc-1):
Delete.
(elisp-flymake-checkdoc): Incorporate old
elisp-flymake--checkdoc-1.
(elisp-flymake--byte-compile-done): Simplify.  Don't cleanup
here.
(elisp-flymake-byte-compile): Remove spurious interactive spec.
Simplify.  Cleanup on every possible exit.
2017-10-06 18:12:58 +01:00
Mark Oteiza
295457ae52 Move read-multiple-choice to its own library
* lisp/emacs-lisp/rmc.el: New file.
* lisp/emacs-lisp/subr-x.el (read-multiple-choice): Remove.
* lisp/gnus/message.el:
* lisp/net/nsm.el: Change required library.
2017-10-06 10:42:06 -04:00
Stefan Monnier
11f9cb522f Merge emacs-26 2017-10-06 09:50:54 -04:00
Lele Gaifax
9655937da4 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.

* lisp/progmodes/flymake.el (flymake-error)
(flymake-diagnostic-functions): Fix typos.
(flymake-diagnostic-types-alist): Rephrase and fix typos.
(flymake--backend-state): Fix typos and rephrase.
(flymake--handle-report): Delete empty line.
(flymake--disable-backend)
(flymake--run-backend): Fix typos.
(flymake-goto-next-error, flymake-goto-prev-error): Rephrase.
2017-10-06 14:09:49 +01:00
Eli Zaretskii
e5bff696bc 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)
2017-10-06 15:42:22 +03:00
João Távora
6b88f78aa1 Don't error when turning on Flymake with no known backends
Leave it to the mode line indicator to inform the user that there
is still some configuration to do.

* lisp/progmodes/flymake.el (flymake-mode): Simplify.
2017-10-06 00:07:53 +01:00
João Távora
03eab7a05e 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.

* lisp/progmodes/flymake.el (flymake-ler-make-ler): Delete.
2017-10-06 00:07:03 +01:00
Gemini Lasswell
9a10c8713b 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.
2017-10-05 12:43:15 -07:00
Rasmus
2a32ee1fbc Update Org to v9.1.2
Please note this is a bugfix release.  See etc/ORG-NEWS for details.
2017-10-05 21:30:05 +02:00
Alan Mackenzie
57ab49f7da 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.
2017-10-05 17:16:10 +00:00
Eli Zaretskii
bd5326f879 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)
2017-10-05 17:57:58 +03:00
Gemini Lasswell
0c8f4e5ea1 * lisp/ses.el (ses-print-cell): Fix alignment of text cells. (Bug#27653) 2017-10-05 16:49:34 +03:00
Alexander Gramiak
c625fb645a 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)
2017-10-05 13:50:02 +03:00
Vasilij Schneidermann
e3f4b71c9d Support indirection for all shr-tag-* calls
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)
2017-10-05 13:00:13 +03:00
Eli Zaretskii
3c4ff63bea 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)
2017-10-05 12:41:36 +03:00
João Távora
7a1133f1ff 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.
2017-10-05 03:09:12 +01:00
Alan Mackenzie
4e0b67ed27 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.
2017-10-04 17:34:27 +00:00
Michael Albinus
0b558b4acb * lisp/net/tramp.el (tramp-tramp-file-p): Use `string-match-p'.
Reported by Clément Pit-Claudel <cpitclaudel@gmail.com>.
2017-10-04 11:48:37 +02:00
Paul Eggert
fdbaebde08 ; Spelling fixes 2017-10-03 16:05:05 -07:00
Michael Albinus
92045f4546 Add file name handler support for file-system-info
* doc/lispref/files.texi (Magic File Names): Add file-system-info.

* etc/NEWS: Mention get-free-disk-space working on remote systems.

* lisp/files.el (get-free-disk-space): Do not block on remote systems.

* src/w32fns.c (Ffile_system_info):
* src/fileio.c (Ffile_system_info): Call file name handler if exists.
(syms_of_fileio): Add Qfile_system_info.
2017-10-03 16:15:08 +02:00
Michael Albinus
4ac5ac50c9 Merge branch 'emacs-26' of git.sv.gnu.org:/srv/git/emacs into emacs-26 2017-10-03 16:08:04 +02:00
Michael Albinus
a9ac20c179 Add support for `file-system-info' in Tramp
* lisp/net/tramp.el (tramp-file-name-for-operation):
Add `file-system-info'.

* 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.
2017-10-03 16:07:32 +02:00
João Távora
f964aa9973 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.
2017-10-03 14:20:29 +01:00
João Távora
602d9376db Integrate Flymake elisp checkers into elisp-mode.el directly
* lisp/progmodes/elisp-mode.el (emacs-lisp-mode): Use
elisp-flymake-checkdoc and elisp-flymake-byte-compile.
(elisp-flymake--checkdoc-1, elisp-flymake-checkdoc)
(elisp-flymake--byte-compile-done)
(elisp-flymake--byte-compile-process)
(elisp-flymake-byte-compile): Rename from flymake-elisp
counterparts in deleted flymake-elisp.el
(elisp-flymake--batch-compile-for-flymake): New helper.
(checkdoc-create-error-function)
(checkdoc-autofix-flag)
(checkdoc-generate-compile-warnings-flag)
(checkdoc-diagnostic-buffer): Forward declare.

* lisp/progmodes/flymake-elisp.el: Delete.
2017-10-03 14:20:29 +01:00
João Távora
30ea272fe4 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.
2017-10-03 14:18:55 +01:00
João Távora
2e84179a29 Tweak Flymake autoloads and dependencies
* lisp/progmodes/elisp-mode.el (emacs-lisp-mode): Add to
flymake-diagnostic-functions here.

* lisp/progmodes/flymake-elisp.el[top]: Don't add to
emacs-lisp-mode-hook.  Don't call flymake-elisp-setup-backends in
every buffer.  (flymake-elisp-checkdoc) (flymake-elisp-byte-compile):
Autoload.  (flymake-elisp-setup-backends): Remove.

* lisp/progmodes/flymake.el: Add some top-level comments.
(flymake-make-diagnostic)
(flymake-mode, flymake-mode-on, flymake-mode-off): Add autoloads

Where to fixup this shit?
2017-10-03 14:18:55 +01:00
João Távora
5d3f8a8b80 Capitalize "Flymake" in docstrings and comments
* lisp/progmodes/flymake-elisp.el (flymake-elisp-checkdoc)
(flymake-elisp-setup-backends): Capitalize "Flymake"

* lisp/progmodes/flymake-proc.el:
(flymake-proc-reformat-err-line-patterns-from-compile-el)
(flymake-proc--panic, flymake-proc-legacy-flymake)
(flymake-start-syntax-check, flymake-proc-compile)
(define-obsolete-variable-alias): Capitalize "Flymake"

* lisp/progmodes/flymake.el (flymake-fringe-indicator-position)
(flymake-make-diagnostic, flymake-delete-own-overlays)
(flymake-diagnostic-functions)
(flymake-diagnostic-types-alist, flymake-is-running)
(flymake-make-report-fn, flymake-mode-on, flymake-mode-off)
(flymake-goto-next-error, flymake-goto-prev-error): Capitalize "Flymake"
2017-10-03 14:18:55 +01:00
João Távora
f6e909b41e 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.
2017-10-03 14:18:55 +01:00
João Távora
22a7372fab 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.
2017-10-03 14:18:55 +01:00
João Távora
91851c3ea0 Flymake variable flymake-diagnostic-functions now a special hook
* lisp/progmodes/flymake-proc.el: Use add-hook to affect
flymake-diagnostic-functions.

* lisp/progmodes/flymake-elisp.el
(flymake-elisp-setup-backends): Use add-hook.

* lisp/progmodes/flymake.el (flymake-diagnostic-functions):
Revise docstring.
(flymake-start): Use run-hook-wrapped.
2017-10-03 14:18:55 +01:00
João Távora
bd8ea8873d 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

Now the changelog:

* lisp/progmodes/flymake-elisp.el: Proper copyright notice.

* 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
2017-10-03 14:18:55 +01:00
João Távora
87993cdcc6 Explicitly add a(n empty) keymap for Flymake
Too early to decide what will be in it, if anything.  Though "M-n" and
"M-p" would be great.

* lisp/progmodes/flymake-ui.el (flymake-mode-map): New variable
2017-10-03 14:18:55 +01:00
João Távora
1b271ad76e 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.
2017-10-03 14:18:55 +01:00
João Távora
cd39edb5d6 Remove old flymake-display-err-menu-for-current-line, it's useless
See https://lists.gnu.org/archive/html/emacs-devel/2017-09/msg00949.html

* lisp/progmodes/flymake-ui.el
(flymake-popup-current-error-menu): Remove.
2017-10-03 14:18:55 +01:00
João Távora
5235eaf781 Treat Flymake errors as just another type of diagnostic
* lisp/progmodes/flymake.el (flymake--diag-errorp): Remove.
(flymake--handle-report, flymake-popup-current-error-menu):
Don't use it.
2017-10-03 14:18:55 +01:00
João Távora
8118f0f95f 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.

* test/lisp/progmodes/flymake-resources/Makefile
(check-syntax): Always return success (0) error code.
(CC_OPTS): Add -Wextra

* test/lisp/progmodes/flymake-resources/errors-and-warnings.c
(main): Rewrite comments.

* test/lisp/progmodes/flymake-resources/errors-and-warnings.c:
Include some dummy header files.

* test/lisp/progmodes/flymake-resources/no-problems.h: New file.

* test/lisp/progmodes/flymake-resources/some-problems.h: New file.

* doc/misc/flymake.texi (Example---Configuring a tool called
via make): Recommend adding "|| true" to the check-syntax target.
2017-10-03 14:18:55 +01:00
João Távora
9a629a73e0 Add interactive flymake-start function
* lisp/progmodes/flymake.el (flymake-on-timer-event)
(flymake-after-change-function, flymake-mode): Call
flymake-start.
(flymake-start): Rename from flymake--start-syntax-check.
2017-10-03 14:18:54 +01:00
João Távora
483f1e834d 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.

* lisp/progmodes/flymake.el (top): Require flymake-elisp.

* lisp/progmodes/flymake-elisp.el: New file.
2017-10-03 14:18:54 +01:00
João Távora
e0df7b9699 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.
2017-10-03 14:18:54 +01:00