]> git.eshelyaron.com Git - emacs.git/log
emacs.git
6 years agoStart rewriting Flymake manual scratch/flymake-refactor-cleaner-for-emacs-26
João Távora [Wed, 27 Sep 2017 17:42:02 +0000 (18:42 +0100)]
Start rewriting Flymake manual

* 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.

6 years agoMinimal tweak as an attempt to future-proof Flymake API
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.

6 years agoIntegrate elisp checkers into elisp-mode.el directly
João Távora [Sun, 1 Oct 2017 14:24:15 +0000 (15:24 +0100)]
Integrate 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.

* lisp/progmodes/flymake-elisp.el: Delete.

6 years agoHook Flymake onto proper checkdoc and byte-compile interfaces
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.

6 years agoTweak Flymake autoloads and dependencies
João Távora [Sun, 1 Oct 2017 00:24:31 +0000 (01:24 +0100)]
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?

6 years agoCapitalize "Flymake" in docstrings and comments
João Távora [Sat, 30 Sep 2017 17:04:45 +0000 (18:04 +0100)]
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"

6 years agoFlymake backends can report multiple times per check
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.
(flymake--saving-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.

6 years agoImprove use of flymake-no-changes-timeout
João Távora [Sat, 30 Sep 2017 09:45:48 +0000 (10:45 +0100)]
Improve use of flymake-no-changes-timeout

Can be set to nil to disable automatic periodic checks.

* lisp/progmodes/flymake.el (flymake-no-changes-timeout): Improve doc
(flymake-on-timer-event): Use it.

6 years agoFlymake variable flymake-diagnostic-functions now a special hook
João Távora [Fri, 29 Sep 2017 11:18:30 +0000 (12:18 +0100)]
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.

6 years agoA batch of minor flymake cleanup actions agreed to with Stefan
João Távora [Fri, 29 Sep 2017 10:02:36 +0000 (11:02 +0100)]
A 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

6 years agoExplicitly add a(n empty) keymap for Flymake
João Távora [Thu, 28 Sep 2017 13:57:01 +0000 (14:57 +0100)]
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

6 years agoFlymake uses some new fringe bitmaps
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.

6 years agoRemove old flymake-display-err-menu-for-current-line, it's useless
João Távora [Thu, 28 Sep 2017 11:24:44 +0000 (12:24 +0100)]
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.

6 years agoTreat flymake errors as just another type of diagnostic
João Távora [Thu, 28 Sep 2017 11:21:43 +0000 (12:21 +0100)]
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.

6 years agoFix three Flymake bugs when checking C header files
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.

* 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.

6 years agoAdd interactive flymake-start function
João Távora [Wed, 27 Sep 2017 16:47:14 +0000 (17:47 +0100)]
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.

6 years agoA couple of Flymake backends for emacs-lisp-mode
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.

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

* lisp/progmodes/flymake-elisp.el: New file.

6 years agoFancy Flymake mode-line construct displays status
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.

6 years agoTweak Flymake commands flymake-goto-[next/prev]-error
João Távora [Wed, 27 Sep 2017 11:42:20 +0000 (12:42 +0100)]
Tweak Flymake commands flymake-goto-[next/prev]-error

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.

6 years agoFlymake's flymake-proc.el backend slightly easier to debug
João Távora [Tue, 19 Sep 2017 13:56:59 +0000 (14:56 +0100)]
Flymake's flymake-proc.el backend slightly easier to debug

Misc cleanup in flymake-proc.el

Improve description of what this file contains.

Better name for the backend function.  Fix the case where it is run
interactively.

Keep the output buffer alive iff the external process panics.

* lisp/progmodes/flymake-proc.el
(flymake-proc-legacy-flymake): Rename from
flymake-proc-start-syntax-check.  Allow running interactively.
(flymake-start-syntax-check): Obsolete alias for
flymake-proc-legacy-flymake.
(flymake-proc-start-syntax-check): Delete.
(flymake-diagnostic-functions): Include flymake-proc-legacy-flymake
(flymake-proc--process-sentinel): Keep output buffer alive.
Clarify with comments.
(flymake-proc--diagnostics-for-pattern)
(flymake-proc--process-sentinel)
(flymake-proc--safe-delete-directory)
(flymake-proc--start-syntax-check-process): Use condition-case-unless-debug.

6 years agoSimplify Flymake logging and erroring
João Távora [Tue, 26 Sep 2017 00:35:43 +0000 (01:35 +0100)]
Simplify Flymake logging and erroring

Use display-warning and a dedicated *Flymake log* buffer.

To ease readability, flymake log messages are now prefixed with a
common prefix and the buffer that originated them.

Some situations of over-zealous logging are fixed.

Use byte-compiler info, if available, to determine whence the
flymake-related log message is coming.

* lisp/progmodes/flymake-proc.el
(flymake-proc--diagnostics-for-pattern): Improve log message.
(flymake-proc--panic): Always flymake-log an error
(flymake-proc--safe-delete-file)
(flymake-proc--safe-delete-directory):
Downgrade warning
(flymake-proc-start-syntax-check): Simplify slightly.
(flymake-proc--start-syntax-check-process): Simplify.
(flymake-proc--init-find-buildfile-dir)
(flymake-proc--init-create-temp-source-and-master-buffer-copy):
No need to warn twice.

* lisp/progmodes/flymake.el (flymake-log): Convert to macro.
(flymake--log-1): New helper.
(flymake-log-level): Deprecate.
(flymake-error): New helper.
(flymake-ler-make-ler, flymake--handle-report, flymake-mode):
Use flymake-error.
(flymake-on-timer-event)
(flymake--handle-report, flymake--disable-backend)
(flymake--run-backend, flymake-start, flymake-mode-on)
(flymake-mode-off, flymake-after-change-function)
(flymake-after-save-hook, flymake-find-file-hook): Adjust
flymake-log calls.

* test/lisp/progmodes/flymake-tests.el
(flymake-tests--call-with-fixture): Only log errors.

6 years agoNew Flymake API variable flymake-diagnostic-functions
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.

6 years agoMore Flymake cleanup before advancing to backend redesign
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.

6 years agoProtect Flymake's eager checks against commands like fill-paragraph
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.

6 years agoFlymake highlights GCC info/notes as detected by flymake-proc.el
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.

6 years agoFlymake checks file names before considering diagnostics
João Távora [Thu, 21 Sep 2017 13:45:21 +0000 (14:45 +0100)]
Flymake checks file names before considering diagnostics

The error patterns for gcc picked up errors for the Makefile itself,
for example.  These shouldn't count as actual errors.

* lisp/progmodes/flymake.el (flymake-report): Check
matching file names.

6 years agoEcho Flymake error messages when navigating errors interactively
João Távora [Thu, 21 Sep 2017 13:20:22 +0000 (14:20 +0100)]
Echo Flymake error messages when navigating errors interactively

Perhaps binding M-n and M-p to flymake-goto-next-error and
flymake-goto-prev-error also wouldn't be a bad idea.

* lisp/progmodes/flymake.el (flymake-goto-next-error): Use
target overlay's help-echo.

6 years agoAdd a new Flymake test for multiple errors and warnings
João Távora [Thu, 21 Sep 2017 13:57:20 +0000 (14:57 +0100)]
Add a new Flymake test for multiple errors and warnings

* test/lisp/progmodes/flymake-tests.el
(flymake-tests--call-with-fixture): Save excursion.
(errors-and-warnings): New test.

* test/lisp/progmodes/flymake-resources/errors-and-warnings.c:
New test fixture.

6 years agoProtect against timer triggers when no flymake-mode
João Távora [Wed, 20 Sep 2017 18:10:30 +0000 (19:10 +0100)]
Protect against timer triggers when no flymake-mode

Not 100% sure on how to trigger this error, but it happened once or
twice, possibly during heavy debugging scenarios that wouldn't really
happen.  But a good idea anyway.

* lisp/progmodes/flymake.el (flymake-on-timer-event): Check flymake-mode

6 years agoFlymake warning face easier to distinguish
João Távora [Wed, 20 Sep 2017 18:09:10 +0000 (19:09 +0100)]
Flymake warning face easier to distinguish

A orange wavy underline is very hard to tell from a red wavy
underline.

* lisp/progmodes/flymake.el (flymake-warning): Change color to
"deep sky blue"

6 years agoFlymake's flymake-proc.el parses column numbers from gcc/javac errors
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.

6 years agoNew Flymake variable flymake-diagnostic-types-alist and much cleanup
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:

   (add-to-list 'flymake-diagnostic-types-alist
                '(:foo-note
                  . ((flymake-category . flymake-note)
                     (bitmap . nil))))

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.

6 years agoRefactor flymake-tests.el in preparation for more tests
João Távora [Thu, 7 Sep 2017 13:19:33 +0000 (14:19 +0100)]
Refactor flymake-tests.el 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.

6 years agoAllow running flymake-tests.el from interactive sessions
João Távora [Sun, 20 Aug 2017 11:19:45 +0000 (12:19 +0100)]
Allow running flymake-tests.el 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.

6 years agoFlymake diagnostics now apply to arbitrary buffer regions
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.

* lisp/progmodes/flymake.el (flymake-ins-after)
(flymake-set-at, flymake-er-make-er, flymake-er-get-line)
(flymake-er-get-line-err-info-list, flymake-ler-set-file)
(flymake-ler-set-full-file, flymake-ler-set-line)
(flymake-get-line-err-count, flymake-get-err-count)
(flymake-highlight-err-lines, flymake-overlay-p)
(flymake-make-overlay, flymake-region-has-flymake-overlays)
(flymake-find-err-info)
(flymake-line-err-info-is-less-or-equal)
(flymake-add-line-err-info, flymake-add-err-info)
(flymake-get-first-err-line-no)
(flymake-get-last-err-line-no, flymake-get-next-err-line-no)
(flymake-get-prev-err-line-no, flymake-skip-whitespace)
(flymake-goto-line, flymake-goto-next-error)
(flymake-goto-prev-error, flymake-patch-err-text): Delete
functions no longer used.
(flymake-goto-next-error, flymake-goto-prev-error): Rewrite.
(flymake-report): Rewrite.
(flymake-popup-current-error-menu): Rewrite.
(flymake--highlight-line): Rename from
flymake-highlight-line.  Call `flymake--place-overlay.
(flymake--place-overlay): New function.
(flymake-ler-errorp): New predicate.
(flymake-ler): Simplify.
(flymake-error): Rename from
flymake-errline.
(flymake-warning): Rename from flymake-warnline.
(flymake-warnline, flymake-errline): Obsoletion aliases.

* 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'.

6 years agoMove symbols in flymake-proc.el to separate namespace
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.

* lisp/progmodes/flymake-proc.el
(flymake-proc--get-project-include-dirs-function)
(flymake-proc--get-project-include-dirs-imp)
(flymake-proc--get-include-dirs-dot) (flymake-proc--get-tex-args)
(flymake-proc--find-make-buildfile)
(flymake-proc--get-syntax-check-program-args)
(flymake-proc--init-create-temp-source-and-master-buffer-copy)
(flymake-proc--init-find-buildfile-dir)
(flymake-proc--get-full-nonpatched-file-name)
(flymake-proc--get-full-patched-file-name) (flymake-proc--base-dir,
flymake-proc--temp-master-file-name) (flymake-proc--master-file-name)
(flymake-proc--temp-source-file-name)
(flymake-proc--delete-temp-directory) (flymake-proc--kill-process)
(flymake-proc--start-syntax-check-process)
(flymake-proc--compilation-is-running)
(flymake-proc--safe-delete-directory) (flymake-proc--safe-delete-file)
(flymake-proc--get-program-dir) (flymake-proc--restore-formatting)
(flymake-proc--clear-project-include-dirs-cache)
(flymake-proc--project-include-dirs-cache)
(flymake-proc--get-system-include-dirs)
(flymake-proc--get-project-include-dirs)
(flymake-proc--add-project-include-dirs-to-cache)
(flymake-proc--get-project-include-dirs-from-cache)
(flymake-proc--post-syntax-check) (flymake-proc--process-sentinel)
(flymake-proc--process-filter) (flymake-proc--create-master-file)
(flymake-proc--find-buffer-for-file)
(flymake-proc--copy-buffer-to-temp-buffer)
(flymake-proc--read-file-to-temp-buffer)
(flymake-proc--save-buffer-in-file) (flymake-proc--replace-region,
flymake-proc--check-include)
(flymake-proc--check-patch-master-file-buffer)
(flymake-proc--master-file-compare)
(flymake-proc--find-possible-master-files)
(flymake-proc--included-file-name, flymake-proc--same-files)
(flymake-proc--fix-file-name, flymake-proc--find-buildfile)
(flymake-proc--clear-buildfile-cache)
(flymake-proc--add-buildfile-to-cache)
(flymake-proc--get-buildfile-from-cache)
(flymake-proc--find-buildfile-cache)
(flymake-proc--get-real-file-name-function)
(flymake-proc--get-cleanup-function) (flymake-proc--get-init-function)
(flymake-proc--get-file-name-mode-and-masks)
(flymake-proc--processes): Rename to internal symbol from
flymake-proc- version.

6 years agoCompletely rewrite Flymake's subprocess output processing
João Távora [Wed, 23 Aug 2017 01:23:41 +0000 (02:23 +0100)]
Completely rewrite Flymake's subprocess output processing

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

6 years agoFlymake provides flymake-report re-entry point for backends
João Távora [Sun, 20 Aug 2017 23:17:05 +0000 (00:17 +0100)]
Flymake provides flymake-report re-entry point for backends

* lisp/progmodes/flymake-proc.el (flymake-post-syntax-check):
Simplify.  Call flymake-report.

* lisp/progmodes/flymake.el (flymake-report): New function.

6 years agoSplit Flymake into flymake.el into flymake-proc.el (again!)
João Távora [Thu, 17 Aug 2017 14:38:12 +0000 (15:38 +0100)]
Split Flymake into flymake.el into flymake-proc.el (again!)

After deciding that this work would continue on master only, which
caused two commits named

   Revert "Split flymake.el into flymake-proc.el and flymake-ui.el"

and

   Revert "Add flymake-backends defcustom"

to be added to the emacs-26 branch, further discussion reversed that
decision.

   See:

     https://lists.gnu.org/archive/html/emacs-devel/2017-09/msg01020.html
     https://lists.gnu.org/archive/html/emacs-devel/2017-09/msg01030.html

This means that those two commits MUST be merged to master AFTER ALL.

flymke-proc.el contains the main syntax-checking backend, while
flymake.el keeps mostly the UI part.

* lisp/progmodes/flymake-proc.el: New file.  Require flymake.

* lisp/progmodes/flymake.el: Require flymake-proc.el at the end.

6 years agoRevert "Split flymake.el into flymake-proc.el and flymake-ui.el"
João Távora [Wed, 27 Sep 2017 21:35:49 +0000 (22:35 +0100)]
Revert "Split flymake.el into flymake-proc.el and flymake-ui.el"

In other words, re-coalesce the two files,
lisp/progmodes/flymake-proc.el and lisp/progmodes/flymake-ui.el, back
into a single one, lisp/progmodes/flymake.el.

The changesets "Prefer HTTPS to FTP and HTTP in documentation" and
"allow nil init in flymake-allowed-file-name-masks to disable flymake"
are kept in place in the new lisp/progmodes/flymake.el.

This reverts Git commit eb34f7f5a29e7bf62326ecb6e693f28878be28cd.

Don't merge this back to master as development happening there builds
upon this work. See also
https://lists.gnu.org/archive/html/emacs-devel/2017-09/msg00932.html.

6 years agoRevert "Add flymake-backends defcustom"
João Távora [Wed, 27 Sep 2017 21:15:19 +0000 (22:15 +0100)]
Revert "Add flymake-backends defcustom"

This reverts Git commit 13993c46a21495167517f76d2e36b6c09ac5e89e.

Don't merge this back to master as development happening there builds
upon this work. See also
https://lists.gnu.org/archive/html/emacs-devel/2017-09/msg00932.html

6 years ago* src/editfns.c (styled_format): Fix typo in previous change.
Paul Eggert [Wed, 27 Sep 2017 00:15:56 +0000 (17:15 -0700)]
* src/editfns.c (styled_format): Fix typo in previous change.

6 years agoAvoid some unnecessary copying in Fformat etc.
Paul Eggert [Tue, 26 Sep 2017 23:31:57 +0000 (16:31 -0700)]
Avoid some unnecessary copying in Fformat etc.

This patch is just for performance; it should not affect behavior.
On my platform, it made the microbenchmark (format "%S" load-path)
run about 45% faster.  It should also speed up calls like (message
"%s" STRING).
* 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):
Use styled_format instead of Fformat or Fformat_message,
to avoid unnecessary copying.
* src/editfns.c (styled_format): New arg NEW_RESULT.
All uses changed.  Reuse an input string if it has the
right value and if !NEW_RESULT.
* src/lisp.h (style_format): New decl.

6 years agolisp/simple.el: Indicate when a list of pairs is meant in a docstring
John Wiegley [Tue, 26 Sep 2017 19:35:52 +0000 (12:35 -0700)]
lisp/simple.el: Indicate when a list of pairs is meant in a docstring

6 years ago; * src/gtkutil.c (xg_create_frame_widgets): Add FIXME re. X drawing
Philipp Stephani [Tue, 26 Sep 2017 18:34:27 +0000 (20:34 +0200)]
; * src/gtkutil.c (xg_create_frame_widgets): Add FIXME re. X drawing

6 years agobug#28609: simple.el
Devon Sean McCullough [Tue, 26 Sep 2017 14:51:04 +0000 (10:51 -0400)]
bug#28609: simple.el

Correct grammar; also, call a pair a pair.

6 years agoUse a separate syntax-ppss cache for narrowed buffers
Dmitry Gutov [Mon, 25 Sep 2017 23:49:00 +0000 (02:49 +0300)]
Use a separate syntax-ppss cache for narrowed buffers

* lisp/emacs-lisp/syntax.el (syntax-ppss-wide):
New variable, to contain the data from `syntax-ppss-last' and
`syntax-ppss-cache'.
(syntax-ppss-cache, syntax-ppss-last): Remove.
(syntax-ppss-narrow, syntax-ppss-narrow-start): New variables.
(syntax-ppss-flush-cache): Flush both caches.
(syntax-ppss--data): Return the appropriate last result and
buffer cache for the current restriction.
(syntax-ppss, syntax-ppss-debug): Use it (bug#22983).

6 years agoImprove python3-compatibility of fallback completion (Bug#28499)
Joerg Behrmann [Mon, 18 Sep 2017 14:59:49 +0000 (16:59 +0200)]
Improve python3-compatibility of fallback completion (Bug#28499)

* lisp/progmodes/python.el (python-eldoc-setup-code): Use
inspect.getfullargspec instead of inspect.getargspec to avoid a
deprecation warning on every usage of eldoc in python-mode.

Copyright-paperwork-exempt: yes

6 years agoFix subr-x-tests when running from elc
Noam Postavsky [Mon, 25 Sep 2017 11:15:51 +0000 (07:15 -0400)]
Fix subr-x-tests when running from elc

* test/lisp/emacs-lisp/subr-x-tests.el (subr-x-and-let*-test-group-1):
Use `eval' around the `should-error' cases.

6 years ago* lisp/eshell/esh-util.el (eshell-condition-case): Add debug declaration.
Noam Postavsky [Sat, 23 Sep 2017 14:04:36 +0000 (10:04 -0400)]
* lisp/eshell/esh-util.el (eshell-condition-case): Add debug declaration.

6 years agoMake sh-indentation into an alias for sh-basic-offset (Bug#21751)
Noam Postavsky [Wed, 30 Aug 2017 23:42:47 +0000 (19:42 -0400)]
Make sh-indentation into an alias for sh-basic-offset (Bug#21751)

* lisp/progmodes/sh-script.el (sh-indentation): Redefine as obsolete
variable alias for `sh-basic-offset'.
(sh-mode, sh-smie--indent-continuation)
(sh-smie-rc-rules, sh-basic-indent-line): Replace `sh-indentation'
with `sh-basic-offset'.

6 years agoFix loading of smie-config rules (Bug#24848)
Noam Postavsky [Wed, 30 Aug 2017 23:31:48 +0000 (19:31 -0400)]
Fix loading of smie-config rules (Bug#24848)

* lisp/emacs-lisp/smie.el (smie-config--setter): Use `set-default'
instead of `setq-default'.
(smie-config): Use `custom-initialize-set' instead of
`custom-initialize-default' as the :initialize argument.

* lisp/progmodes/sh-script.el (sh-learn-buffer-indent): Mention that
we call `smie-config-guess' so that the user will have a chance to
find the correct docstring to consult.  Remove hedging comments
regarding use of abnormal hooks.

6 years ago; Update NEWS for the change in eldoc-message
Dmitry Gutov [Mon, 25 Sep 2017 23:25:03 +0000 (02:25 +0300)]
; Update NEWS for the change in eldoc-message

6 years agoReset default-directory inside *xref-grep* buffer
Dmitry Gutov [Mon, 25 Sep 2017 22:44:54 +0000 (01:44 +0300)]
Reset default-directory inside *xref-grep* buffer

* lisp/progmodes/xref.el (xref-collect-matches):
Reset default-directory, too. (Bug#28575)

6 years ago* test/lisp/tramp-tests.el (tramp-test21-file-links): Special code for smb.
Michael Albinus [Mon, 25 Sep 2017 15:52:24 +0000 (17:52 +0200)]
* test/lisp/tramp-tests.el (tramp-test21-file-links): Special code for smb.

6 years agoLoosen strict parsing requirement for desktop files
Mark Oteiza [Mon, 25 Sep 2017 12:45:08 +0000 (08:45 -0400)]
Loosen strict parsing requirement for desktop files

There are other desktop-looking files, for instance those having to do
with MIME typess, that would benefit from being able to be read by this
function.  It helps to have some flexibility.
* lisp/xdg.el (xdg-desktop-read-file): Remove an error condition.
* test/lisp/xdg-tests.el: Remove a test.

6 years ago* lisp/xdg.el (xdg-thumb-uri): Fix doc string.
Mark Oteiza [Mon, 25 Sep 2017 12:44:23 +0000 (08:44 -0400)]
* lisp/xdg.el (xdg-thumb-uri): Fix doc string.

6 years agoFix documentation of `make-frame' and related variables and hooks
Martin Rudalics [Mon, 25 Sep 2017 08:09:32 +0000 (10:09 +0200)]
Fix documentation of `make-frame' and related variables and hooks

* lisp/frame.el (before-make-frame-hook)
(after-make-frame-functions, frame-inherited-parameters)
(make-frame): Fix doc-strings.
* doc/lispref/frames.texi (Creating Frames): Fix description
of `make-frame' and related variables and hooks.

6 years agoAccept new `always' value for option `buffer-offer-save'
Eric Abrahamsen [Sun, 24 Sep 2017 21:01:21 +0000 (14:01 -0700)]
Accept new `always' value for option `buffer-offer-save'

Also revert ee512e9a82

* lisp/files.el (buffer-offer-save): In addition to nil and t, now
  allows a third symbol value, `always'. A buffer where this option is
  set to `always' will always be offered for save by
  `save-some-buffers'.
  (save-some-buffers): Check the exact value of this buffer-local
  variable. No longer check the buffer name, or the value of
  `write-contents-functions'.
* doc/lispref/buffers.texi (Killing Buffers): Note change in manual.
* doc/lispref/files.texi (Saving Buffers): Remove note about buffer
  names.
* etc/NEWS: Mention in NEWS.

6 years agoImprove new NS scrolling variable names
Alan Third [Sun, 24 Sep 2017 21:35:21 +0000 (22:35 +0100)]
Improve new NS scrolling variable names

* src/nsterm.m (ns-use-system-mwheel-acceleration): Replace with
'ns-use-mwheel-acceleration'.
(ns-touchpad-scroll-line-height): Replace with
'ns-mwheel-line-height'.
(ns-touchpad-use-momentum): Replace with 'ns-use-mwheel-momentum'.
* etc/NEWS: Change variable names.

6 years agoDocument 'replace-buffer-contents' in the manual.
Philipp Stephani [Sun, 24 Sep 2017 17:32:16 +0000 (19:32 +0200)]
Document 'replace-buffer-contents' in the manual.

* doc/lispref/text.texi (Replacing): New node.

6 years agoFix undecorated frame resizing issues on NS (bug#28512)
Alan Third [Sat, 23 Sep 2017 18:43:58 +0000 (19:43 +0100)]
Fix undecorated frame resizing issues on NS (bug#28512)

* src/nsterm.m (EmacsView::updateFrameSize): Don't wait for the
toolbar on undecorated frames.
(EmacsView::initFrameFromEmacs): Group window flags correctly.

6 years ago; * doc/emacs/display.texi (Display Custom): Fix wording.
Eli Zaretskii [Sat, 23 Sep 2017 07:45:46 +0000 (10:45 +0300)]
; * doc/emacs/display.texi (Display Custom): Fix wording.

6 years ago; Spelling and URL fixes
Paul Eggert [Sat, 23 Sep 2017 07:34:01 +0000 (00:34 -0700)]
; Spelling and URL fixes

6 years agoDocumentation improvements for 'display-line-numbers'
Eli Zaretskii [Sat, 23 Sep 2017 07:07:11 +0000 (10:07 +0300)]
Documentation improvements for 'display-line-numbers'

* doc/emacs/display.texi (Display Custom): Document a few more
options for display-line-numbers.  (Bug#28533)  Fix a typo.

6 years ago; Fix typo
Mark Oteiza [Fri, 22 Sep 2017 20:34:31 +0000 (16:34 -0400)]
; Fix typo

* lisp/emacs-lisp/subr-x.el: Nix extra parenthesis.

6 years agoFix last change in bat-mode.el
Eli Zaretskii [Fri, 22 Sep 2017 17:41:10 +0000 (20:41 +0300)]
Fix last change in bat-mode.el

* lisp/progmodes/bat-mode.el (bat-font-lock-keywords): Fix last
change.  (Bug#28311)

6 years agoFix restoring in GUI sessions desktop saved in TTY sessions
Eli Zaretskii [Fri, 22 Sep 2017 14:52:47 +0000 (17:52 +0300)]
Fix restoring in GUI sessions desktop saved in TTY sessions

* lisp/frameset.el (frameset-filter-font-param): New function.
(frameset-persistent-filter-alist): Use it for processing the
'font' frame parameter.  (Bug#17352)

6 years agoImprove syntax highlighting in bat-mode
Eli Zaretskii [Fri, 22 Sep 2017 13:40:59 +0000 (16:40 +0300)]
Improve syntax highlighting in bat-mode

* lisp/progmodes/bat-mode.el (bat-font-lock-keywords): Improve
font-locking of environment variables.  Suggested by Achim Gratz
<Stromeko@nexgo.de>.  (Bug#28311)  (Bug#18405)

6 years agoDocument the 'list-FOO' convention
Eli Zaretskii [Fri, 22 Sep 2017 09:41:00 +0000 (12:41 +0300)]
Document the 'list-FOO' convention

* doc/lispref/tips.texi (Coding Conventions): Document the
list-FOO convention.

6 years agoExpose viewing conditions in CAM02-UCS metric
Mark Oteiza [Fri, 22 Sep 2017 02:47:24 +0000 (22:47 -0400)]
Expose viewing conditions in CAM02-UCS metric

Also add tests from the colorspacious library.  Finally, catch an
errant calculation, where degrees were not being converted to radians.
* src/lcms.c (deg2rad, default_viewing_conditions):
(parse_viewing_conditions): New functions.
(lcms-cam02-ucs): Add comments pointing to references used.  Expand
the docstring and explain viewing conditions.  JCh hue is given in
degrees and needs to be converted to radians.
(lcms-d65-xyz): Remove.  No need to duplicate this in Lisp or make the
API needlessly impure.
* test/src/lcms-tests.el: Reword commentary.
(lcms-rgb255->xyz): New function.
(lcms-cri-cam02-ucs): Fix let-binding.
(lcms-dE-cam02-ucs-silver): New test, assimilated from colorspacious.

7 years agoRevert "Set frame size to actual requested size (bug#18215)"
Alan Third [Thu, 21 Sep 2017 20:53:30 +0000 (21:53 +0100)]
Revert "Set frame size to actual requested size (bug#18215)"

This reverts commit d31cd79b40dbd5459b16505a4ee4340210499277.

See bug#28536. I misunderstood bug#18215. It wasn't a bug.

7 years agoAdd tests for Edebug
Gemini Lasswell [Thu, 21 Sep 2017 20:36:08 +0000 (13:36 -0700)]
Add tests for Edebug

* tests/lisp/emacs-lisp/edeug-tests.el: New file.
* tests/lisp/emacs-lisp/edebug-resources/edebug-test-code.el: New file.

7 years agoCatch more messages in ert-with-message-capture
Gemini Lasswell [Thu, 21 Sep 2017 20:35:45 +0000 (13:35 -0700)]
Catch more messages in ert-with-message-capture

* lisp/emacs-lisp/ert-x.el (ert-with-message-capture): Capture
messages from prin1, princ and print.
(ert--make-message-advice): New function.
(ert--make-print-advice): New function.

7 years ago; * lisp/mouse.el (secondary-selection-exist-p): Doc fix.
Eli Zaretskii [Thu, 21 Sep 2017 08:29:11 +0000 (11:29 +0300)]
; * lisp/mouse.el (secondary-selection-exist-p): Doc fix.

7 years agoSupport setting region from secondary selection and vice versa
Tak Kunihiro [Thu, 21 Sep 2017 08:26:00 +0000 (11:26 +0300)]
Support setting region from secondary selection and vice versa

* lisp/mouse.el (secondary-selection-exist-p): New function to
allow callers to tell existence of the secondary selection
in current buffer.
(secondary-selection-to-region): New function to set
beginning and end of the region from those of the secondary
selection.
(secondary-selection-from-region): New function to set
beginning and end of the secondary selection from those of
the region.  (Bug#27530)

* etc/NEWS: Mention the new functions.

7 years agoFix new copy-directory bug with empty dirs
Paul Eggert [Wed, 20 Sep 2017 18:49:12 +0000 (11:49 -0700)]
Fix new copy-directory bug with empty dirs

Problem reported by Afdam Plaice (Bug#28520) and by Eli Zaretskii
(Bug#28483#34).  This is another bug that I introduced in my
recent copy-directory changes.
* lisp/files.el (copy-directory): Work with empty subdirectories, too.
* test/lisp/files-tests.el (files-tests--copy-directory):
Test for this bug.

7 years ago* doc/lispref/strings.texi (Formatting Strings): Improve indexing.
Eli Zaretskii [Wed, 20 Sep 2017 13:40:20 +0000 (16:40 +0300)]
* doc/lispref/strings.texi (Formatting Strings): Improve indexing.

7 years agoFix 2 testsuite tests for MS-Windows
Eli Zaretskii [Wed, 20 Sep 2017 07:16:11 +0000 (10:16 +0300)]
Fix 2 testsuite tests for MS-Windows

* test/lisp/ibuffer-tests.el (test-buffer-list): Don't try to
create files with "*" in their names.
* test/src/editfns-tests.el (format-time-string-with-zone): Adapt
results to MS-Windows build.  Reported by Fabrice Popineau
<fabrice.popineau@gmail.com>.

7 years agoRename timer-list to list-timers
Mark Oteiza [Wed, 20 Sep 2017 02:21:37 +0000 (22:21 -0400)]
Rename timer-list to list-timers

* doc/emacs/anti.texi (Antinews):
* doc/lispref/os.texi (Timers):
* etc/NEWS:
* lisp/emacs-lisp/timer-list.el:
(timer-list-mode): Rename timer-list to list-timers.

7 years agoProvide native touchpad scrolling on macOS
Alan Third [Fri, 8 Sep 2017 18:26:47 +0000 (19:26 +0100)]
Provide native touchpad scrolling on macOS

* etc/NEWS: Describe changes.
* lisp/term/ns-win.el (mouse-wheel-scroll-amount,
mouse-wheel-progressive-speed): Set to smarter values for macOS
touchpads.
* src/nsterm.m (emacsView::mouseDown): Use precise scrolling deltas to
calculate scrolling for touchpads and mouse wheels.
(syms_of_nsterm): Add variables 'ns-use-system-mwheel-acceleration',
'ns-touchpad-scroll-line-height' and 'ns-touchpad-use-momentum'.
* src/keyboard.c (make_lispy_event): Pass on .arg when relevant.
* src/termhooks.h (event_kind): Update comments re. WHEEL_EVENT.
* lisp/mwheel.el (mwheel-scroll): Use line count.
* lisp/subr.el (event-line-count): New function.

7 years agoFix MinGW64 build broken by recent MinGW64 import libraries
Eli Zaretskii [Tue, 19 Sep 2017 17:31:02 +0000 (20:31 +0300)]
Fix MinGW64 build broken by recent MinGW64 import libraries

* configure.ac (W32_LIBS): Put -lusp10 before -lgdi32, as latest
MinGW64 import libraries require that.  (Bug#28493)

* src/Makefile.in: Adjust commentary to the new order of w32
libraries.

7 years agoFix crashes in 'move-point-visually' in minibuffer windows
Eli Zaretskii [Tue, 19 Sep 2017 17:11:42 +0000 (20:11 +0300)]
Fix crashes in 'move-point-visually' in minibuffer windows

* src/xdisp.c (Fmove_point_visually): Fix off-by-one error in
comparing against the last valid glyph_row of a window glyph
matrix.  (Bug#28505)

7 years ago* src/emacs.c (usage_message): Don't mention 'find-file'.
Eli Zaretskii [Tue, 19 Sep 2017 16:52:50 +0000 (19:52 +0300)]
* src/emacs.c (usage_message): Don't mention 'find-file'.

7 years agoFix a minor inaccuracy in the Emacs manual
Eli Zaretskii [Tue, 19 Sep 2017 16:48:27 +0000 (19:48 +0300)]
Fix a minor inaccuracy in the Emacs manual

* doc/emacs/cmdargs.texi (Action Arguments): Don't mention
'find-file', as the implementation has changed.  Reported by
Everton J. Carpes <everton.carpes@gmail.com> in
http://lists.gnu.org/archive/html/help-gnu-emacs/2017-09/msg00146.html.

7 years agoFix errors in flyspell-post-command-hook
Eli Zaretskii [Tue, 19 Sep 2017 16:32:09 +0000 (19:32 +0300)]
Fix errors in flyspell-post-command-hook

* lisp/textmodes/ispell.el (ispell-get-decoded-string): Handle the
case of a nil Nth element of the language dictionary slot.  This
avoids errors in 'flyspell-post-command-hook' when switching
dictionaries with some spell-checkers.  (Bug#28501)

7 years agoWork on Tramp's file-truename
Michael Albinus [Tue, 19 Sep 2017 16:12:35 +0000 (18:12 +0200)]
Work on Tramp's file-truename

* lisp/net/tramp-sh.el (tramp-perl-file-truename):
Check also for symlinks.
(tramp-sh-handle-file-truename): Move check for a symlink
cycle to the end.  Do not blame symlinks which look like a
remote file name.

* lisp/net/tramp.el (tramp-handle-file-truename): Expand result.

7 years agoFix bug with make-directory on MS-Windows root
Paul Eggert [Tue, 19 Sep 2017 08:47:39 +0000 (01:47 -0700)]
Fix bug with make-directory on MS-Windows root

* lisp/files.el (files--ensure-directory): Treat any error, not
just file-already-exists, as an opportunity to check whether DIR
is already a directory (Bug#28508).

7 years agoFix log-view-diff-common when point is after last entry
Tom Tromey [Tue, 19 Sep 2017 02:02:01 +0000 (20:02 -0600)]
Fix log-view-diff-common when point is after last entry

Bug#28466
* lisp/vc/log-view.el (log-view-diff-common): If point is after last
entry, look at the previous revision.

7 years agoAdapt fileio-tests--symlink-failure to Cygwin
Ken Brown [Mon, 18 Sep 2017 21:22:52 +0000 (17:22 -0400)]
Adapt fileio-tests--symlink-failure to Cygwin

* test/src/fileio-tests.el (fileio-tests--symlink-failure)
[CYGWIN]: Skip the case of a symlink target starting with '\';
this is treated specially on Cygwin.

7 years agoIgnore buffers whose name begins with a space in save-some-buffers
Eric Abrahamsen [Mon, 18 Sep 2017 20:29:44 +0000 (13:29 -0700)]
Ignore buffers whose name begins with a space in save-some-buffers

* lisp/files.el (save-some-buffers): Consider these buffers
  "internal", and don't prompt the user to save them.
* doc/lispref/files.texi: Document.

7 years agoImprove tramp-interrupt-process robustness
Michael Albinus [Mon, 18 Sep 2017 16:00:27 +0000 (18:00 +0200)]
Improve tramp-interrupt-process robustness

* lisp/net/tramp.el (tramp-interrupt-process): Wait, until the
process has disappeared.

7 years agoMinor Tramp doc update
Michael Albinus [Mon, 18 Sep 2017 16:00:07 +0000 (18:00 +0200)]
Minor Tramp doc update

* doc/misc/tramp.texi (Frequently Asked Questions):
Mention `vc-handled-backends'.

7 years agoFix gensym
Mark Oteiza [Mon, 18 Sep 2017 13:00:45 +0000 (09:00 -0400)]
Fix gensym

* lisp/subr.el (gensym): Actually implement the default prefix.
* test/lisp/subr-tests.el (subr-tests--gensym): New test.

7 years agoCleanup in files-tests.el
Michael Albinus [Mon, 18 Sep 2017 08:00:17 +0000 (10:00 +0200)]
Cleanup in files-tests.el

* test/lisp/files-tests.el (files-tests--make-directory)
(files-tests--copy-directory): Cleanup temporary directories.

7 years agoRemove old cl-assert calls in 'newline'
Paul Eggert [Mon, 18 Sep 2017 05:32:31 +0000 (22:32 -0700)]
Remove old cl-assert calls in 'newline'

* lisp/simple.el (newline): Remove cl-assert calls
that didn't seem to be helping us debug Bug#18913,
and that caused problems as reported in Bug#28280.
Suggested by Glenn Morris (Bug#28280#8).

7 years agoAvoid crash with C-g C-g in GC
Paul Eggert [Mon, 18 Sep 2017 05:01:56 +0000 (22:01 -0700)]
Avoid crash with C-g C-g in GC

Problem reported by Richard Stallman (Bug#17406).
Based on fix suggested by Eli Zaretskii (Bug#28279#16).
* src/term.c (tty_send_additional_strings):
Use only safe accessors, to avoid crash when C-g C-g in GC.

7 years agoFix format-time-string %Z bug with negative tz
Paul Eggert [Mon, 18 Sep 2017 03:38:12 +0000 (20:38 -0700)]
Fix format-time-string %Z bug with negative tz

* src/editfns.c (tzlookup): Fix sign error in %Z when a purely
numeric zone is negative (Bug#28746).
* test/src/editfns-tests.el (format-time-string-with-zone):
Add test for this bug.

7 years agomessage-citation-line-format %Z is now tz name
Paul Eggert [Mon, 18 Sep 2017 00:46:18 +0000 (17:46 -0700)]
message-citation-line-format %Z is now tz name

* etc/NEWS:
* lisp/gnus/message.el (message-citation-line-format):
Fix doc to match new behavior (Bug#28476).

7 years agoUse doc-view or pdf-tools on any window-system
Mark Oteiza [Sun, 17 Sep 2017 23:37:08 +0000 (19:37 -0400)]
Use doc-view or pdf-tools on any window-system

* lisp/net/mailcap.el (mailcap-mime-data): Simply check for
window-system.