]> git.eshelyaron.com Git - emacs.git/log
emacs.git
5 years agoRemove the need for temacs.in
Paul Eggert [Tue, 9 Apr 2019 22:42:10 +0000 (15:42 -0700)]
Remove the need for temacs.in

Instead of building a file temacs.in used only to compute a
fingerprint, compute the fingerprint directly from the .o and
.a files that go into temacs.in.  This speeds up the build by
avoiding the need to link temacs twice, once with a dummy
fingerprint.
* lib-src/make-fingerprint.c (main): No need to generate
a fingerprint file that includes config.h, now that fingerprint.c
depends on all the .o files.
* src/Makefile.in ($(libsrc)/make-fingerprint$(EXEEXT)):
Use the same rule as $(libsrc)/make-docfile$(EXEEXT).
* src/fingerprint-dummy.c: Remove.
* src/Makefile.in (${charsets}, $(libsrc)/make-docfile$(EXEEXT))
($(LIBEGNU_ARCHIVE), $(lwlibdir)/liblw.a, $(oldXMenudir)/libXMenu11.a)
(../config.status, ${ETAGS}, ../lisp/TAGS, $(lwlibdir)/TAGS)
($(lispsource)/loaddefs.el):
Prefer ‘$(MAKE) -C $(dir $@)’ to ‘${MAKE} -C SOMESTRING’ when
either will do, as the former is more regular and lets us
coalesce rules better.
(EMACS_DEPS_PRE, EMACS_DEPS_POST, BUILD_EMACS_PRE)
(BUILD_EMACS_POST, temacs.in$(EXEEXT)): Remove.
(FINGERPRINTED): New macro.
(fingerprint.c): Use it instead of temacs.in$(EXEEXT), to
avoid the need to build temacs.in at all.
(temacs$(EXEEXT)): No need to depend on other .o files now;
fingerprint.o is enough, since it depends on the rest.
Spell out what used to be in BUILD_EMACS_PRE and BUILD_EMACS_POST.
(mostlyclean): No need to remove temacs.in.

5 years agoRemove assumption of uint64_t etc. in portable code
Paul Eggert [Tue, 9 Apr 2019 22:42:10 +0000 (15:42 -0700)]
Remove assumption of uint64_t etc. in portable code

C11 doesn’t guarantee the existence of types like uint64_t,
so avoid these types in portable code, as it’s easy to do so.
There’s no need to avoid the types in w32-specific code,
since w32 is guaranteed to have them.
* lib-src/make-fingerprint.c (main):
* src/fingerprint-dummy.c:
* src/fingerprint.h:
* src/pdumper.c (dump_fingerprint, struct dump_header):
Prefer unsigned char to uint8_t in portable code, as either will do.
Put an "#include <config.h>" in fingerprint.c files, so
that the corresponding .o file is rebuilt after ./configure is run.
* lib-src/make-fingerprint.c (main):
Simplify loop.
* src/Makefile.in (fingerprint.c): Update atomically.
* src/pdumper.c: Omit unnecessary check that off_t is the same
size as int32_t or int64_t, as the code does not rely on this
assumption.
(dump_off): Use int_least32_t, not int32_t.
(struct dump_reloc): Use unsigned int, not uint32_t.
(dump_anonymous_allocate_w32, dump_anonymous_allocate_posix)
(dump_anonymous_allocate, dump_map_file_w32, dump_map_file_posix)
(dump_map_file:
Do the sanity checks at compile time, not at run-time, to avoid
usage of uint64_t etc. on non-w32 platforms.

5 years agoRemove dmpstruct.h
Paul Eggert [Tue, 9 Apr 2019 22:42:10 +0000 (15:42 -0700)]
Remove dmpstruct.h

The hassles of updating the dmpstruct.h-using code bit me again.
These updates are more trouble than they’re worth.  See:
https://lists.gnu.org/r/emacs-devel/2019-03/msg00122.html
As I’m the main person who’s made changes in this area since
dmpstruct.h was introduced, I’m the most motivated to clean up
the situation.
* make-dist (possibly_non_vc_files): Remove src/dmpstruct.h.
* src/Makefile.in (dmpstruct_headers, dmpstruct.h): Remove.
(pdumper.o): Do not depend on dmpstruct.h.
(mostlyclean): Do not remove dmpstruct.h.
* src/dmpstruct.awk: Remove.
* src/pdumper.c: Do not include dmpstruct.h.
(CHECK_STRUCTS): Remove.  All uses removed.

5 years agodiff-font-lock-syntax: clarify distinction between t and hunk-also
Stefan Monnier [Tue, 9 Apr 2019 22:39:22 +0000 (18:39 -0400)]
diff-font-lock-syntax: clarify distinction between t and hunk-also

* lisp/vc/diff-mode.el (diff-font-lock-syntax): Rework docstring.
(diff-syntax-fontify-hunk): Never use the hunk method when
diff-font-lock-syntax is just t.

5 years agoUse lexical-binding in bug-reference.el
Alex Branham [Tue, 9 Apr 2019 21:27:50 +0000 (16:27 -0500)]
Use lexical-binding in bug-reference.el

* .dir-locals.el: Set bug-reference-url-format in all modes, not just
changelog mode. Use (eval . (bug-reference-mode)) as described
in (info "(emacs) Specifying File Variables")
* lisp/progmodes/bug-reference.el: Use lexical binding.
(bug-reference-unfontify):
(bug-reference-fontify): Mention args in docstring.

Bug#35123

5 years agoFix Gnus duplicate suppression guards (bug#34987)
Basil L. Contovounesios [Mon, 25 Mar 2019 02:15:10 +0000 (02:15 +0000)]
Fix Gnus duplicate suppression guards (bug#34987)

* lisp/gnus/gnus-dup.el (gnus-dup-enter-articles)
(gnus-dup-suppress-articles): Use gnus-dup-hashtb as an indicator of
initialization instead of gnus-dup-list, which may happen to be nil.
(gnus-dup-unsuppress-article): Do nothing if gnus-dup-hashtb is
uninitialized.

5 years ago* lisp/printing.el: Use lexical-binding
Stefan Monnier [Tue, 9 Apr 2019 20:28:42 +0000 (16:28 -0400)]
* lisp/printing.el: Use lexical-binding

Require easy-menu instead of adding declarations.
Remove backward compatiblity.  Remove redundant ':group' args.
(pr-region-active-p): Use use-region-p.
(pr-set-keymap-name): Delete function and callers.
(pr-set-keymap-parents): Delete function; use set-keymap-parent instead.
(pr-read-string): Delete function; use read-string instead.
(pr-menu-char-height): Delete function; use frame-char-height instead.
(pr-menu-char-width): Delete function; use frame-char-width instead.
(pr-menu-position): Merge the two definitions.
(pr-get-symbol): Delete function; use easy-menu-intern instead.
(pr-update-mode-line): Delete function; use force-mode-line-update instead.
(pr-do-update-menus): Turn local save-var into dynbound pr--save-var.
(pr-menu-alist): Use setf.  Simplify since we don't keep key-bindings
in the menus any more.
(pr-dosify-file-name): Remove interactive spec.
(pr-filename-style): Rename from pr-path-style.
(pr-unixify-file-name): Delete function.
(pr-standard-file-name): Don't turn \ into / under POSIX.
(pr-temp-dir): Don't dosify.  Use temporary-file-directory unconditionally.
(pr-save-file-modes): Delete macro.
(pr-ps-directory-using-ghostscript, pr-ps-directory-print)
(pr-ps-directory-ps-print, pr-ps-mode-using-ghostscript, pr-ps-print)
(pr-ps-mode-preview, pr-ps-mode-print, pr-printify-directory)
(pr-txt-directory, pr-ps-file-up-preview, pr-ps-directory-preview)
(pr-ps-file-up-ps-print, pr-ps-preview, pr-ps-using-ghostscript):
Use properly prefixed, declared, and
explicitly let-bound dynamically bound variables around calls to
pr-ps-utility-args and pr-set-dir-args.
(pr-ps-file-using-ghostscript): Only dosify when passing to suprocess.
(pr-expand-file-name): Delete function; use expand-file-name instead.
(pr-ps-file-print): Properly dosify.
(pr-menu-create): Use backquotes.
(pr-eval-alist, pr-eval-local-alist): Use dolist.
(pr-ps-utility-args): Don't dosify here.
(pr-ps-utility-process): Dosify here instead.
(pr-ps-file, pr-command): Don't dosify here either.
(pr-interface-map): Move initialization into declaration.
(pr-insert-section-1): Use 'push'.
(pr-insert-toggle): Use closure instead of backquoted lambda.
(pr-insert-menu): Use apply i.s.o eval.
(pr-insert-radio-button): Avoid 'eval'.

5 years agoquail.el: Use delete-and-extract-region
Stefan Monnier [Tue, 9 Apr 2019 19:11:38 +0000 (15:11 -0400)]
quail.el: Use delete-and-extract-region

* lisp/international/quail.el (quail-overlay-region-events):
Use delete-and-extract-region.
(quail-activate): Use setq-local.

5 years agopython.el: don't syntax-propertize single/double quoted strings
Stefan Monnier [Tue, 9 Apr 2019 19:08:21 +0000 (15:08 -0400)]
python.el: don't syntax-propertize single/double quoted strings

* lisp/progmodes/python.el (python-syntax-propertize-function):
Only mark triple-quoted strings, let the normal syntax-table handle
the rest.
(python-syntax-stringify): Adjust accordingly.

5 years ago* lisp/progmodes/js.el (js-mode): Don't set comment-start-skip globally!
Stefan Monnier [Tue, 9 Apr 2019 19:02:00 +0000 (15:02 -0400)]
* lisp/progmodes/js.el (js-mode): Don't set comment-start-skip globally!

5 years agoFix up Eshell 'require's after previous dependency reshuffle.
Stefan Monnier [Tue, 9 Apr 2019 18:57:29 +0000 (14:57 -0400)]
Fix up Eshell 'require's after previous dependency reshuffle.

* lisp/eshell/em-unix.el:
* lisp/eshell/em-script.el:
* lisp/eshell/em-pred.el:
* lisp/eshell/em-dirs.el:
* lisp/eshell/em-alias.el:
Fix up 'require's to silence byte-compiler.

* lisp/eshell/esh-util.el (eshell-read-hosts-file): Don't limit number
of entries per line.  Preserve the structure.
(eshell-read-hosts): Adjust accordingly.

5 years ago* lisp/gnus/mm-view.el (mm-display-inline-fontify): Simplify.
Stefan Monnier [Tue, 9 Apr 2019 16:04:03 +0000 (12:04 -0400)]
* lisp/gnus/mm-view.el (mm-display-inline-fontify): Simplify.

Remove hacks that were needed before font-lock-ensure.
Don't use switch-to-buffer.  Don't assume point-min == 1.

5 years ago; Warn of while/dolist pitfall in gnus-sum.el
Basil L. Contovounesios [Tue, 9 Apr 2019 15:32:27 +0000 (16:32 +0100)]
; Warn of while/dolist pitfall in gnus-sum.el

Suggested by Andy Moreton in the following thread:
https://lists.gnu.org/archive/html/emacs-devel/2019-04/msg00294.html
* lisp/gnus/gnus-sum.el (gnus-summary-move-article): Add comment
warning of common while/dolist pitfall. (bug#33653#134)

5 years ago* lisp/vc/diff-mode.el: Cosmetic changes in diff-syntax-fontify-hunk
Stefan Monnier [Tue, 9 Apr 2019 15:09:11 +0000 (11:09 -0400)]
* lisp/vc/diff-mode.el: Cosmetic changes in diff-syntax-fontify-hunk

(diff-default-directory): Use defvar-local.
(diff-syntax-fontify-hunk): Use 'setq' less.  Fit within 80 columns.
Simplify some looking-at tests.
(diff-syntax-fontify-props): Don't check the buffer-local part of
find-file-hook.

5 years agoClarify the TESTFN argument to `alist-get'
Mattias Engdegård [Tue, 9 Apr 2019 14:56:37 +0000 (16:56 +0200)]
Clarify the TESTFN argument to `alist-get'

* lisp/subr.el (alist-get):
Rephrase the initial text to clarify the meaning of the TESTFN argument.
It's an equality predicate, not a look-up function (Bug#35206).

5 years ago; * etc/NEWS: Fix recently added entries.
Eli Zaretskii [Tue, 9 Apr 2019 08:09:56 +0000 (11:09 +0300)]
; * etc/NEWS: Fix recently added entries.

5 years agoFix "M-x eshell"
Eli Zaretskii [Tue, 9 Apr 2019 08:01:24 +0000 (11:01 +0300)]
Fix "M-x eshell"

* lisp/eshell/em-dirs.el (eshell-variable-aliases-list)
(eshell-directory-name, eshell-mode): Defvar them.
(eshell-dirs-initialize): Require esh-var.  (Bug#35203)
(eshell-apply-indices): Declare.

5 years ago* etc/NEWS: Document new and improved JSX support in js-mode
Jackson Ray Hamilton [Tue, 9 Apr 2019 07:52:43 +0000 (00:52 -0700)]
* etc/NEWS: Document new and improved JSX support in js-mode

5 years agoExplain reasonings for JSX syntax support design decisions
Jackson Ray Hamilton [Tue, 9 Apr 2019 05:40:51 +0000 (22:40 -0700)]
Explain reasonings for JSX syntax support design decisions

* lisp/progmodes/js.el: Throughout the code, provide explanations for
why JSX support was implemented in the way that it was; in particular,
address the overlap between syntax-propertize-function, font-lock, and
indentation (as requested by Stefan).

5 years agoMove curly functions closer to where they’re used
Jackson Ray Hamilton [Tue, 9 Apr 2019 05:27:41 +0000 (22:27 -0700)]
Move curly functions closer to where they’re used

* lisp/progmodes/js.el (js-jsx--enclosing-curly-pos)
(js-jsx--goto-outermost-enclosing-curly): As the code evolved, these
functions’ definitions ended up being far away from the only places
where they were used.  Move them there.

5 years agoAdd open/close parenthesis syntax to “<” and “>” in JSX
Jackson Ray Hamilton [Tue, 9 Apr 2019 03:01:13 +0000 (20:01 -0700)]
Add open/close parenthesis syntax to “<” and “>” in JSX

* lisp/progmodes/js.el (js-jsx--syntax-propertize-tag): Like in
sgml-mode, treat “<” and “>” like open/close parenthesis, making the
text more navigable via forward-sexp, etc.

5 years agoPermit non-ASCII identifiers in JS
Jackson Ray Hamilton [Mon, 8 Apr 2019 15:36:38 +0000 (08:36 -0700)]
Permit non-ASCII identifiers in JS

* lisp/progmodes/js.el (js--name-start-re): Generally allow
identifiers to begin with non-ASCII letters.  This is of particular
importance to JSX parsing.

* test/manual/indent/jsx-unclosed-2.jsx: Add test to ensure non-ASCII
characters are parsed properly.

5 years agoIdentify JSX strings (for js2-mode)
Jackson Ray Hamilton [Mon, 8 Apr 2019 14:47:37 +0000 (07:47 -0700)]
Identify JSX strings (for js2-mode)

* lisp/progmodes/js.el (js-jsx--syntax-propertize-tag): Derived modes
like js2-mode may use font-lock-syntactic-face-function to apply faces
to JSX strings (and only JSX strings).  Apply the js-jsx-string text
property to such strings so they can be distinctly identified.
(js-jsx--text-properties): Ensure the js-jsx-string text property gets
cleaned up, too.

5 years agoProperly set a dynamic, syntactic mode name
Jackson Ray Hamilton [Mon, 8 Apr 2019 01:12:26 +0000 (18:12 -0700)]
Properly set a dynamic, syntactic mode name

Use mode-line-format constructs to properly set mode-name, rather than
use the very hacky solution that was filling-in for my lack of
knowledge of this feature.

* lisp/progmodes/js.el (js--update-mode-name)
(js--idly-update-mode-name): Remove.

(js--syntactic-mode-name-part): New helper function for mode-name.
(js-use-syntactic-mode-name): Helper to set up the dynamic mode-name.

(js-jsx-enable): Don’t need to call any extra functions now.
(js-mode): Use the new setup function rather than the old ones.

(js-jsx-mode): Use the same initial mode name as js-mode so the final
one is identical for both modes.

5 years agoImprove whitespace and unary keyword parsing
Jackson Ray Hamilton [Sun, 7 Apr 2019 21:36:47 +0000 (14:36 -0700)]
Improve whitespace and unary keyword parsing

* lisp/progmodes/js.el (js--name-start-chars): Remove, adding these
chars back to js--name-start-re.
(js--name-start-re): Add chars back from js--name-start-chars.

(js-jsx--tag-start-re): Improve regexp to capture the tag name (so it
can be disambiguated from a unary keyword), to match newlines (which
are common in this spot), and to require at least one whitespace
character before the attribute name.

(js-jsx--matched-tag-type): Ensure the “tag name” isn’t possibly a
unary keyword.

(js-jsx--self-closing-re, js-jsx--matching-close-tag-pos): Allow
whitespace around “<” and “>”.

* test/manual/indent/jsx-unclosed-2.jsx: Add tests for unary keyword
and whitespace parsing.

5 years agoOptimize js-jsx--enclosing-tag-pos
Jackson Ray Hamilton [Sun, 7 Apr 2019 20:25:57 +0000 (13:25 -0700)]
Optimize js-jsx--enclosing-tag-pos

* lisp/progmodes/js.el (js-jsx--enclosing-tag-pos): Update docstring
to be more precise.  Also, remember close tag positions after they’ve
been calculated once to avoid many redundant calls to
js-jsx--matching-close-tag-pos.
(js-jsx--text-properties): Ensure js-jsx-close-tag-pos text properties
get cleaned up, too.

5 years agoOptimize js-jsx--matching-close-tag-pos
Jackson Ray Hamilton [Sun, 7 Apr 2019 07:25:35 +0000 (00:25 -0700)]
Optimize js-jsx--matching-close-tag-pos

This function’s performance was having a noticeable impact when
editing large JSX structures.  Improve its performance
slightly (elapsed time will be cut in half according to ELP).

* lisp/progmodes/js.el (js-jsx--tag-re): Remove.
(js-jsx--matched-tag-type): Simplify implementation with respect to
the new implementation of js-jsx--matching-close-tag-pos.
(js-jsx--self-closing-re): Simplify regexp slightly in sync with a
generally simpler matching algorithm.
(js-jsx--matching-close-tag-pos): Optimize matching algorithm by using
multiple simple regexp searches, rather than one big complex search.

* test/manual/indent/jsx-unclosed-2.jsx: Use the term “inequality” and
add a test for a possible parsing foible.

5 years agoAdd tests for miscellaneous JSX parsing feats
Jackson Ray Hamilton [Wed, 27 Mar 2019 04:47:34 +0000 (21:47 -0700)]
Add tests for miscellaneous JSX parsing feats

* test/manual/indent/jsx.jsx: Add tests for JSXMemberExpression names
and JSXOpeningFragment/JSXClosingFragment support (already supported).

5 years agoSplit JSX indentation calculation into several functions
Jackson Ray Hamilton [Wed, 27 Mar 2019 03:14:46 +0000 (20:14 -0700)]
Split JSX indentation calculation into several functions

* lisp/progmodes/js.el (js-jsx--contextual-indentation)
(js-jsx--expr-attribute-pos, js-jsx--expr-indentation): Extract logic
from js-jsx--indentation, and improve the logic’s documentation.
(js-jsx--indentation): Simplify by splitting into several
functions (see above) and improve the logic’s documentation.

5 years agoIndent expressions in JSXAttributes relative to the attribute’s name
Jackson Ray Hamilton [Wed, 27 Mar 2019 01:18:39 +0000 (18:18 -0700)]
Indent expressions in JSXAttributes relative to the attribute’s name

* lisp/progmodes/js.el (js-jsx--syntax-propertize-tag): Refer to the
beginning of a JSXExpressionContainer’s associated JSXAttribute (so
line numbers can be calculated later).
(js-jsx--text-properties): Also clear the new text property
js-jsx-expr-attribute.

(js-jsx--indenting): Remove.
(js-jsx--indent-col, js-jsx--indent-attribute-line): New variables.
(js-jsx--indentation): Instead of alternating between two separate
column calculations, neither necessarily correct, bind the JSX column
such that the second call to js--proper-indentation can use it as a
base column.
(js--proper-indentation): Use JSX as the base column for some indents
while indenting JSX.

* test/manual/indent/jsx.jsx: Add more tests for expression indents.

5 years agoFix counting of nested self-closing JSXOpeningElements
Jackson Ray Hamilton [Tue, 26 Mar 2019 03:39:48 +0000 (20:39 -0700)]
Fix counting of nested self-closing JSXOpeningElements

* lisp/progmodes/js.el (js-jsx--matching-close-tag-pos): Fix bug where
self-closing JSXOpeningElements might be missed if one was nested
within another.

* test/manual/indent/jsx-self-closing.jsx: Add test for bug concerning
self-closing JSXOpeningElement counting.

5 years agoIndent broken arrow function bodies as an N+1th arg
Jackson Ray Hamilton [Sun, 24 Mar 2019 20:17:12 +0000 (13:17 -0700)]
Indent broken arrow function bodies as an N+1th arg

* lisp/progmodes/js.el (js--line-terminating-arrow-re): Revise regexp
for use with re-search-backward.
(js--looking-at-broken-arrow-function-p): Remove.
(js--broken-arrow-terminates-line-p): Replacement for
js--looking-at-broken-arrow-function-p.  Don’t consider whether an
arrow appears at point (in an arglist); instead, just look for an
arrow that terminates the line.
(js--proper-indentation): Use js--broken-arrow-terminates-line-p.

* test/manual/indent/js.js: Add test for a broken arrow as an N+1th
arg.

5 years agoRename tests to use the “.jsx” file extension
Jackson Ray Hamilton [Sun, 24 Mar 2019 17:05:28 +0000 (10:05 -0700)]
Rename tests to use the “.jsx” file extension

* test/manual/indent/js-jsx-quote.js: Renamed to “jsx-quote.jsx”.
* test/manual/indent/js-jsx-unclosed-1.js: Renamed to
“jsx-unclosed-1.jsx”.
* test/manual/indent/js-jsx-unclosed-2.js: Renamed to
“jsx-unclosed-2.jsx”.
* test/manual/indent/js-jsx.js: Renamed to “jsx.jsx”.

* test/manual/indent/jsx-quote.jsx: Renamed from “js-jsx-quote.js”.
* test/manual/indent/jsx-unclosed-1.jsx: Renamed from
“js-jsx-unclosed-1.js”.
* test/manual/indent/jsx-unclosed-2.jsx: Renamed from
“js-jsx-unclosed-2.js”.
* test/manual/indent/jsx.jsx: Renamed from “js-jsx.js”.

5 years agoImprove JSX syntax propertization
Jackson Ray Hamilton [Sun, 24 Mar 2019 16:55:14 +0000 (09:55 -0700)]
Improve JSX syntax propertization

* lisp/progmodes/js.el (js-jsx--attribute-name-re): New variable.
(js-jsx--syntax-propertize-tag): Allow “-” in JSXAttribute names.  Fix
“out of range” error when typing at the end of a buffer.  Fix/improve
future propertization of unfinished JSXBoundaryElements.

* test/manual/indent/js-jsx-unclosed-2.js: Add tests for allowed
characters in JSX.

5 years agoAutomatically detect JSX in JavaScript files
Jackson Ray Hamilton [Sun, 24 Mar 2019 03:14:29 +0000 (20:14 -0700)]
Automatically detect JSX in JavaScript files

* lisp/files.el (auto-mode-alist): Simply enable
javascript-mode (js-mode) when opening “.jsx” files, since the “.jsx”
file extension will be used as an indicator of JSX syntax by js-mode,
and more code is likely to work in js-mode than js-jsx-mode, and we
probably want to guide users to use js-mode (with js-jsx-syntax)
instead.  Code that used to work exclusively in js-jsx-mode (if anyone
ever wrote any) ought to be updated to work in js-mode too when
js-jsx-syntax is set to t.

* lisp/progmodes/js.el (js-jsx-detect-syntax, js-jsx-regexps)
(js-jsx--detect-and-enable, js-jsx--detect-after-change): New
variables and functions for detecting and enabling JSX.

(js-jsx-syntax): Update docstring with respect to the widened scope of
the effects and use of this variable.

(js-syntactic-mode-name, js--update-mode-name)
(js--idly-update-mode-name, js-jsx-enable): New variable and functions
for indicating when JSX is enabled.

(js-mode): Detect and enable JSX.  Print all enabled syntaxes after
the mode name whenever Emacs goes idle; this ensures lately-enabled
syntaxes are evident.

(js-jsx-mode): Update mode name for consistency with the state in
which JSX is enabled in js-mode.  Update docstring to suggest
alternative means of using JSX without this mode.  Going forward, it
may be best to gently guide users away from js-jsx-mode, since a “one
mode per syntax extension” model would not scale well if more syntax
extensions were to be simultaneously supported (e.g. Facebook’s
“Flow”).

5 years agoFinish replacing SGML-based JSX detection with js-mode’s parsing
Jackson Ray Hamilton [Sat, 23 Mar 2019 22:01:55 +0000 (15:01 -0700)]
Finish replacing SGML-based JSX detection with js-mode’s parsing

This removes the last dependency on sgml-mode for JSX-related logic.

* lisp/progmodes/js.el (js-jsx--start-tag-re)
(js-jsx--end-tag-re): Remove.
(js-jsx--looking-at-start-tag-p)
(js-jsx--looking-back-at-end-tag-p): Reimplement using text
properties, using syntax information which ought to be slightly more
accurate than regexps since it was found by complete parsing.

5 years agoIndent JSX as parsed in a JS context
Jackson Ray Hamilton [Sat, 23 Mar 2019 21:22:35 +0000 (14:22 -0700)]
Indent JSX as parsed in a JS context

Fixes the following issues (and re-fixes indentation issues initially
fixed but later re-broken by previous commits in the process of adding
comprehensive JSX support):

- https://github.com/mooz/js2-mode/issues/389#issuecomment-390766873
- https://github.com/mooz/js2-mode/issues/482
- Bug#32158
- https://github.com/mooz/js2-mode/issues/462

Previously, we delegated to sgml-mode functions for JSX indentation.
However, there were some problems with this approach:

- sgml-mode does not anticipate tags inside attributes when indenting,
  which compromises JSX indentation inside JSXExpressionContainers
  inside JSXAttributes.

- In previous iterations to provide comprehensive JSX support, it
  proved tedious to disambiguate “<” and “>” as JS inequality
  operators and arrow functions from opening and closing angle
  brackets as part of SGML tags.  That code evolved into a more
  complete JSX parsing implementation for syntax-propertize rules for
  font-locking, discarding the superfluous “<”/“>” disambiguation in
  anticipation of using the improved JSX analysis for indentation.

- Using sgml-mode functions, we controlled JSX indentation using SGML
  variables.  However, JSX is a different thing than SGML; referencing
  SGML in JS was a leaky abstraction.

To resolve these issues, use the text properties added by the JSX
syntax-propertize code to determine the boundaries of various aspects
of JSX syntax, and reimplement the sgml-mode indentation code in
js-mode with better respect to JSX indentation conventions.

* lisp/progmodes/js.el (js-jsx-attribute-offset): New variable to
provide a way for users to still control JSX attribute offsets as they
could with sgml-attribute-offset before.  The value of this feature is
dubious IMO, but it’s trivial to keep it, so let’s do it just in case.

(js-jsx--goto-outermost-enclosing-curly): New function.

(js-jsx--enclosing-tag-pos): Refactor to be unbounded by curlies, so
this function can be used to find JSXExpressionContainers within JSX.
Fix bug where an enclosing JSXElement couldn’t be found when point was
at the start of its JSXClosingElement.  Return the JSXClosingElement’s
position as well, so the JSXClosingElement can be indentified when
indenting and be indented like the matching JSXOpeningElement.

(js-jsx--at-enclosing-tag-child-p): js-jsx--enclosing-tag-pos now
returns a list rather than a cons, so retrieve the JSXOpeningElement’s
end position from a list.

(js-jsx--context, js-jsx--indenting): New function and variable.
(js-jsx--indentation): New function replacing the prior
js-jsx--indent* functions and js-jsx-indent-line’s implementation.
Use the JSX parsing performed in a JS context to more accurately
calculate JSX indentation than by delegating to sgml-mode functions.
(js--proper-indentation): Use js-jsx--indentation as yet another type
of indentation.
(js-jsx--as-sgml, js-jsx--outermost-enclosing-tag-pos)
(js-jsx--indentation-type, js-jsx--indent-line-in-expression)
(js-jsx--indent-n+1th-line): Remove obsolete functions.

(js-jsx-indent-line): Refactor nearly-obsolete function to behave the
same as it usually would before these changes, without respect to the
binding of js-jsx-syntax.

(js-jsx-mode): Remove obsolete documentation about the use of SGML
variables to control indentation, and don’t bind indent-line-function
any more, because it is no longer necessary given the new
implementation of js-jsx-indent-line.

5 years agoUpdate expectations for JSX indentation in JSXAttribute space
Jackson Ray Hamilton [Sat, 23 Mar 2019 19:33:20 +0000 (12:33 -0700)]
Update expectations for JSX indentation in JSXAttribute space

* test/manual/indent/js-jsx.js: Align expectations for dangling
closing constructs with other places in the tests.

5 years agoPropertize and font-lock JSXText and JSXExpressionContainers
Jackson Ray Hamilton [Sat, 9 Mar 2019 00:29:02 +0000 (16:29 -0800)]
Propertize and font-lock JSXText and JSXExpressionContainers

This completes highlighting support for JSX, as requested in:

- https://github.com/mooz/js2-mode/issues/140
- https://github.com/mooz/js2-mode/issues/330
- https://github.com/mooz/js2-mode/issues/409

* lisp/progmodes/js.el (js--name-start-chars): Extract part of
js--name-start-re so it can be reused in another regexp.
(js--name-start-re): Use js--name-start-chars.

(js-jsx--font-lock-keywords): Use new matchers.
(js-jsx--match-text, js-jsx--match-expr): New matchers to remove
typical JS font-locking and extend the font-locked region,
respectively.

(js-jsx--tag-re, js-jsx--self-closing-re): New regexps matching JSX.
(js-jsx--matched-tag-type, js-jsx--matching-close-tag-pos)
(js-jsx--enclosing-curly-pos, js-jsx--enclosing-tag-pos)
(js-jsx--at-enclosing-tag-child-p): New functions for parsing and
analyzing JSX.

(js-jsx--text-range, js-jsx--syntax-propertize-tag-text): New
functions for propertizing JSXText.
(js-jsx--syntax-propertize-tag): Propertize JSXText children of tags.
(js-jsx--text-properties): Remove JSXText-related text properties when
repropertizing.
(js-mode): Extend the syntax-propertize region with
syntax-propertize-multiline; we are now adding the syntax-multiline
text property to buffer ranges that are JSXText to ensure the whole
multiline JSX construct is reidentified.

5 years agoFont-lock JSX while editing it by extending regions
Jackson Ray Hamilton [Mon, 18 Feb 2019 05:16:13 +0000 (21:16 -0800)]
Font-lock JSX while editing it by extending regions

* lisp/progmodes/js.el (js-jsx--font-lock-keywords):
Call tag beginning and end matchers.
(js-jsx--match-tag-beg, js-jsx--match-tag-end): New functions.
(js-jsx--syntax-propertize-tag): Record buffer positions of JSXElement
beginning and end for font-locking.

(js--syntax-propertize-extend-region)
(js-jsx--syntax-propertize-extend-region): New functions for extending
the syntax-propertize region backwards to the start of a JSXElement so
its JSXAttribute children on its n+1th lines can be parsed as such
while editing those lines.
(js-mode): Add js--syntax-propertize-extend-region to
syntax-propertize-extend-region-functions.

5 years agoAdd basic JSX font-locking
Jackson Ray Hamilton [Sun, 17 Feb 2019 08:38:01 +0000 (00:38 -0800)]
Add basic JSX font-locking

Font-lock JSX from the beginning of the buffer to the end.  Tends to
break temporarily when editing lines, because the parser doesn’t yet
look backwards to determine if the end of a tag in the current range
starts before the range.

This also re-breaks some tests fixed by previous commits, as we begin
to take a different direction in our parsing code, looking for JSX,
rather than for non-JSX.  The parsing code will eventually provide
information for indentation again.

* lisp/progmodes/js.el (js--dotted-captured-name-re)
(js-jsx--disambiguate-beginning-of-tag)
(js-jsx--disambiguate-end-of-tag, js-jsx--disambiguate-syntax):
Remove.
(js-jsx--font-lock-keywords): New variable.
(js--font-lock-keywords-3): Add JSX matchers.
(js-jsx--match-tag-name, js-jsx--match-attribute-name): New functions.
(js-jsx--syntax-propertize-tag): New function to aid in JSX
font-locking and eventually indentation.
(js-jsx--text-properties): New variable.
(js-syntax-propertize): Propertize JSX properly using
syntax-propertize-rules.

5 years agoUse js-jsx- prefix for functions and variables
Jackson Ray Hamilton [Sat, 16 Feb 2019 06:15:11 +0000 (22:15 -0800)]
Use js-jsx- prefix for functions and variables

* lisp/progmodes/js.el (js--disambiguate-beginning-of-jsx-tag): Rename
to js-jsx--disambiguate-beginning-of-tag.
(js--disambiguate-end-of-jsx-tag): Rename to
js-jsx--disambiguate-end-of-tag.
(js--disambiguate-js-from-jsx): Rename to js-jsx--disambiguate-syntax.
(js--jsx-start-tag-re): Rename to js-jsx--start-tag-re.
(js--looking-at-jsx-start-tag-p): Rename to
js-jsx--looking-at-start-tag-p.
(js--jsx-end-tag-re): Rename to js-jsx--end-tag-re.
(js--looking-back-at-jsx-end-tag-p): Rename to
js-jsx--looking-back-at-end-tag-p.
(js--as-sgml): Rename to js-jsx--as-sgml.
(js--outermost-enclosing-jsx-tag-pos): Rename to
js-jsx--outermost-enclosing-tag-pos.
(js--jsx-indentation): Rename to js-jsx--indentation-type.
(js--indent-line-in-jsx-expression): Rename to
js-jsx--indent-line-in-expression.
(js--indent-n+1th-jsx-line): Rename to js-jsx--indent-n+1th-line.

5 years agojs-syntax-propertize: Disambiguate JS from JSX, fixing some indents
Jackson Ray Hamilton [Mon, 11 Feb 2019 11:00:34 +0000 (03:00 -0800)]
js-syntax-propertize: Disambiguate JS from JSX, fixing some indents

Fix some JSX indentation bugs:

- Bug#24896 / https://github.com/mooz/js2-mode/issues/389
- Bug#30225
- https://github.com/mooz/js2-mode/issues/459

* lisp/progmodes/js.el (js--dotted-captured-name-re)
(js--unary-keyword-re, js--unary-keyword-p)
(js--disambiguate-beginning-of-jsx-tag)
(js--disambiguate-end-of-jsx-tag)
(js--disambiguate-js-from-jsx): New variables and functions.

(js-syntax-propertize): Additionally clarify when syntax is JS so that
‘(with-syntax-table sgml-mode-syntax-table …)’ does not mistake some
JS punctuation syntax for SGML parenthesis syntax, namely ‘<’ and ‘>’.

* test/manual/indent/js-jsx-unclosed-2.js: Add additional test for
unary operator parsing.

5 years agoAdd new (failing) unclosed JSX test and separate such tests
Jackson Ray Hamilton [Mon, 11 Feb 2019 05:11:17 +0000 (21:11 -0800)]
Add new (failing) unclosed JSX test and separate such tests

* test/manual/indent/js-jsx.js: Move test with intentional scan error to
its own file, js-jsx-unclosed-1.js.
* test/manual/indent/js-jsx-unclosed-1.js: New file.
* test/manual/indent/js-jsx-unclosed-2.js: New file with test for
regression caused by new ambiguous parsing of JS/JSX.

5 years agoRefactor JSX indentation code to improve enclosing JSX discovery
Jackson Ray Hamilton [Sun, 10 Feb 2019 04:06:29 +0000 (20:06 -0800)]
Refactor JSX indentation code to improve enclosing JSX discovery

Fix a number of bugs reported for JSX indentation (caused by poor JSX
detection):

- https://github.com/mooz/js2-mode/issues/140#issuecomment-166250016
- https://github.com/mooz/js2-mode/issues/490
- Bug#24896 / https://github.com/mooz/js2-mode/issues/389 (with
respect to comments)
- Bug#26001 /
https://github.com/mooz/js2-mode/issues/389#issuecomment-271869380
- https://github.com/mooz/js2-mode/issues/411 / Bug#27000 /
https://github.com/mooz/js2-mode/issues/451

Potentially manifest some new bugs (due to false positives with ‘<’
and ‘>’ and SGML detection).  Slow down indentation a fair bit.

* list/progmodes/js.el (js-jsx-syntax, js--jsx-start-tag-re)
(js--looking-at-jsx-start-tag-p, js--looking-back-at-jsx-end-tag-p):
New variables and functions.
(js--jsx-find-before-tag, js--jsx-after-tag-re): Deleted.

(js--looking-at-operator-p): Don’t mistake a JSXOpeningElement for the
‘<’ operator.
(js--continued-expression-p): Don’t mistake a JSXClosingElement as a
fragment of a continued expression including the ‘>’ operator.

(js--as-sgml): Simplify.  Probably needn’t bind forward-sexp-function
to nil (sgml-mode already does) and probably shouldn’t bind
parse-sexp-lookup-properties to nil either (see Bug#24896).

(js--outermost-enclosing-jsx-tag-pos): Find enclosing JSX more
accurately than js--jsx-find-before-tag.  Use sgml-mode’s parsing
logic, rather than unreliable heuristics like paren-wrapping.  This
implementation is much slower; the previous implementation was fast,
but at the expense of accuracy.  To make up for all the grief we’ve
caused users, we will prefer accuracy over speed from now on.  That
said, this can still probably be optimized a lot.

(js--jsx-indented-element-p): Rename to js--jsx-indentation, since it
doesn’t just return a boolean.
(js--jsx-indentation): Refactor js--jsx-indented-element-p to simplify
the implementation as the improved accuracy of other code allows (and
to repent for some awful stylistic choices I made earlier).

(js--expression-in-sgml-indent-line): Rename to
js--indent-line-in-jsx-expression, since it’s a private function and
we can give it a name that reads more like English.
(js--indent-line-in-jsx-expression): Restructure point adjustment
logic more like js-indent-line.

(js--indent-n+1th-jsx-line): New function to complement
js--indent-line-in-jsx-expression.

(js-jsx-indent-line): Refactor.  Don’t bind js--continued-expression-p
to ignore any more; instead, rely on the improved accuracy of
js--continued-expression-p.

(js-jsx-mode): Set js-jsx-syntax to t.  For now, this will be the flag
we use to determine whether ‘JSX is enabled.’  (Maybe later, we will
refactor the code to use this variable instead of requiring
js-jsx-mode to be enabled, thus rendering the mode obsolete.)

5 years agoAdd failing tests for JSX indentation bugs
Jackson Ray Hamilton [Sat, 9 Feb 2019 23:42:42 +0000 (15:42 -0800)]
Add failing tests for JSX indentation bugs

* test/manual/indent/js-jsx.js: Add failing tests for all the js-mode
and js2-mode JSX indentation bugs reported over the years that I could
find.  Some may be duplicates, so I have grouped similar reports
together, for now; we’ll see for certain which distinct cases we need
once we start actually implementing fixes.
* test/manual/indent/js-jsx-quote.js: New file with a nasty test.

5 years agoRestore .dir-locals.el accidentally deleted
Katsumi Yamaoka [Tue, 9 Apr 2019 04:38:31 +0000 (04:38 +0000)]
Restore .dir-locals.el accidentally deleted

But this way -- git add/commit/push -- is probably wrong, sorry.

5 years agoFix last commit message
Katsumi Yamaoka [Tue, 9 Apr 2019 04:28:03 +0000 (04:28 +0000)]
Fix last commit message

5 years agoMerge remote-tracking branch 'origin/master'
Katsumi Yamaoka [Tue, 9 Apr 2019 04:27:08 +0000 (04:27 +0000)]
Merge remote-tracking branch 'origin/master'

5 years agoMake `jump to group' work even if it is not activated (bug#33653)
Katsumi Yamaoka [Tue, 9 Apr 2019 04:15:57 +0000 (04:15 +0000)]
Make `jump to group' work even if it is not activated (bug#33653)

* lisp/gnus/gnus-group.el (gnus-group-goto-group):
Use gnus-newsrc-hashtb instead of gnus-active-hashtb to check if
a group exists even if its server is not activated (bug#33653).

5 years agoMake `jump to group' work even if it is not activated (bug#33653)
Katsumi Yamaoka [Tue, 9 Apr 2019 04:15:57 +0000 (04:15 +0000)]
Make `jump to group' work even if it is not activated (bug#33653)

* lisp/gnus/gnus-group.el (gnus-group-goto-group):
Use gnus-newsrc-hashtb instead of gnus-newsrc-hashtb to check if
a group exists even if its server is not activated (bug#33653).

5 years agoFix encoding and access of Gnus group names
Eric Abrahamsen [Sun, 31 Mar 2019 16:09:18 +0000 (09:09 -0700)]
Fix encoding and access of Gnus group names

* lisp/gnus/gnus-start.el (gnus-active-to-gnus-format): Encode group
  names as 'latin-1.
* lisp/gnus/nnmail.el (nnmail-parse-active): Ditto.
* lisp/gnus/nnml.el (nnml-request-group, nnml-request-create-group,
  nnml-request-expire-articles, nnml-request-delete-group,
  nnml-request-rename-group, nnml-deletable-article-p,
  nnml-active-number, nnml-open-incremental-nov): Use assoc-string
  with nnml-group-alist.
* lisp/gnus/nnrss.el (nnrss-request-delete-group,
  nnrss-retrieve-groups, nnrss-read-group-data, nnrss-check-group,
  nnrss-generate-download-script): Use assoc-string with
  nnrss-group-alist.

5 years agoMake `move article' work again (bug#33653)
Katsumi Yamaoka [Fri, 5 Apr 2019 04:25:06 +0000 (04:25 +0000)]
Make `move article' work again (bug#33653)

* lisp/gnus/gnus-sum.el (gnus-summary-move-article): Back to while loop
m dolist that blocks nov and active from saving (bug#33653).

5 years ago* lisp/gnus/gnus-sum.el: Prepare for lexical-binding
Stefan Monnier [Mon, 8 Apr 2019 20:49:11 +0000 (16:49 -0400)]
* lisp/gnus/gnus-sum.el: Prepare for lexical-binding

Add defvars for all the gnus-tmp-*.
(gnus-summary-make-local-variables): Move let binding to avoid setq.
(gnus-set-global-variables): Use dolist.
(gnus-summary-from-or-to-or-newsgroups, gnus-summary-insert-line)
(gnus-summary-insert-dummy-line): Avoid dynbind args.
(gnus-build-old-threads): Remove unused var 'id'.
(gnus-nov-parse-line): Remove unused var 'buffer'.
(gnus-thread-header): Prepare it for a lexbind world.
(gnus-adjust-marked-articles): Remove unused var 'marks'.
(gnus-mark-xrefs-as-read): Remove unused var 'idlist'.
(gnus-summary-display-article): Erase&widen before mm-enable-multibyte.
(gnus-summary-better-unread-subject): Remove unused var 'score'.
(gnus-summary-find-matching): Remove unused var 'd'.
(ps-right-header, ps-left-header, shr-ignore-cache): Declare vars.
(gnus-summary-idna-message, gnus-summary-morse-message)
(gnus-summary-sort-by-original):
Fix interactive spec since we don't actually use any prefix arg.
(gnus-summary-move-article, gnus-read-move-group-name): Use user-error.
(gnus-summary-move-article): Use dolist.
(gnus-summary-edit-article): Fix unquoting.
(gnus-summary-highlight-line-0, gnus-summary-highlight-line):
Declare dynbind vars documented in gnus-summary-highlight.

5 years ago* lisp/vc/diff-mode.el (diff-syntax-fontify-props): Check both buffer-local
Juri Linkov [Mon, 8 Apr 2019 20:34:20 +0000 (23:34 +0300)]
* lisp/vc/diff-mode.el (diff-syntax-fontify-props): Check both buffer-local

and default value of find-file-hook.

5 years agoAllow gap before first non-Lisp pseudovec member
Paul Eggert [Mon, 8 Apr 2019 19:59:22 +0000 (12:59 -0700)]
Allow gap before first non-Lisp pseudovec member

Problem reported by Keith David Bershatsky in:
https://lists.gnu.org/r/emacs-devel/2019-04/msg00259.html
Solution suggested by Stefan Monnier in:
https://lists.gnu.org/r/emacs-devel/2019-04/msg00282.html
* src/buffer.h (BUFFER_LISP_SIZE): Simplify by using PSEUDOVECSIZE.
(BUFFER_REST_SIZE): Simplify by using VECSIZE and BUFFER_LISP_SIZE.
* src/lisp.h (PSEUDOVECSIZE): Base it on the last Lisp field,
not the first non-Lisp field.  All callers changed.  Callers
without Lisp fields changed to use ALLOCATE_PLAIN_PSEUDOVECTOR.
(ALLOCATE_PLAIN_PSEUDOVECTOR): New macro.

5 years ago* lisp/gnus/gnus-agent.el (gnus-agent-fetch-articles): Use match-string
Stefan Monnier [Mon, 8 Apr 2019 19:43:26 +0000 (15:43 -0400)]
* lisp/gnus/gnus-agent.el (gnus-agent-fetch-articles): Use match-string

(gnus-agent-expire-group-1): Dial down on the 'setq'.

5 years ago* nadvice.el: Add ourselves to package--builtin-versions
Stefan Monnier [Mon, 8 Apr 2019 19:36:18 +0000 (15:36 -0400)]
* nadvice.el: Add ourselves to package--builtin-versions

5 years agoEshell: Try to untangle the dependencies; move 'provide's to the end
Stefan Monnier [Mon, 8 Apr 2019 18:28:34 +0000 (14:28 -0400)]
Eshell: Try to untangle the dependencies; move 'provide's to the end

* lisp/eshell/esh-arg.el: Move defsubst and vars before first use.
Don't require `esh-mode but esh-util instead.

* lisp/eshell/esh-cmd.el: Require esh-module and esh-io.

* lisp/eshell/esh-ext.el: Don't require esh-proc nor esh-cmd.
(eshell-external-command): Require esh-proc for
eshell-gather-process-output.

* lisp/eshell/esh-mode.el: Don't require esh-io nor esh-var, but
require esh-arg.
(eshell-directory-name): Move from eshell.el.

* lisp/eshell/esh-module.el: Don't require eshell.

* lisp/eshell/esh-opt.el: Don't require esh-ext at top-level.
(eshell--do-opts, eshell-show-usage): Require it here instead.

* lisp/eshell/esh-proc.el: Don't require esh-cmd, but require esh-io.
(eshell-reset-after-proc, eshell-record-process-object)
(eshell-gather-process-output, eshell-send-eof-to-process):
Require esh-mode and esh-var here.

* lisp/eshell/esh-var.el: Require esh-module, esh-arg, and esh-io.

* lisp/eshell/eshell.el: Require esh-module, esh-proc, esh-io, and esh-cmd.
But don't require esh-mode.
(eshell-directory-name): Move to esh-mode.
(eshell-return-exits-minibuffer): Don't bind 'return' and 'M-return'
since we already bind RET and M-RET.

5 years agoFix file-readable-p and file-executable-p in some Tramp backends
Michael Albinus [Mon, 8 Apr 2019 11:34:54 +0000 (13:34 +0200)]
Fix file-readable-p and file-executable-p in some Tramp backends

* lisp/net/tramp-archive.el (tramp-archive-handle-file-readable-p):
Use tramp-gvfs.

* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-executable-p):
Check that FILENAME exists.
(tramp-gvfs-handle-file-readable-p): Check that FILENAME exists.
Use heuristic in case it cannot be determined correctly.

5 years ago; * src/frame.h (MonitorInfo): Remove const modifier
Alexander Gramiak [Mon, 8 Apr 2019 01:17:48 +0000 (19:17 -0600)]
; * src/frame.h (MonitorInfo): Remove const modifier

This removes a compiler warning with xfree.

5 years ago; * src/xfns.c (x-display-monitor-attributes-list) Fix typo.
Alexander Gramiak [Sun, 7 Apr 2019 18:53:41 +0000 (12:53 -0600)]
; * src/xfns.c (x-display-monitor-attributes-list) Fix typo.

5 years agoRename variable for clarity
Mattias Engdegård [Sun, 7 Apr 2019 18:50:40 +0000 (20:50 +0200)]
Rename variable for clarity

* lisp/progmodes/verilog-mode.el (verilog-sk-define-signal):
Rename sig-re to sig-chars, to make it clear that it isn't a regexp.

5 years agoPlug memory leak in GTK x-display-monitor-attributes-list
Alexander Gramiak [Sun, 7 Apr 2019 05:02:24 +0000 (23:02 -0600)]
Plug memory leak in GTK x-display-monitor-attributes-list

* src/frame.c (free_monitors) [USE_GTK]: Define in the GTK case as
  well.

* src/xfns.c (x-display-monitor-attributes-list) [USE_GTK]: Plug
  memory leak.

* src/frame.h (MonitorInfo): Declare name as pointing to const char.

5 years agoSimplify fill_gstring_header
Paul Eggert [Sun, 7 Apr 2019 18:43:17 +0000 (11:43 -0700)]
Simplify fill_gstring_header

* src/composite.c (fill_gstring_header): Omit first argument HEADER,
since in practice it is always nil.  Change caller to match.
Help the compiler by telling it LEN is nonnegative.
Problem found with --enable-gcc-warnings and gcc -O2 -Og.

5 years agoHelp the compiler with byte order
Paul Eggert [Sun, 7 Apr 2019 18:36:50 +0000 (11:36 -0700)]
Help the compiler with byte order

* src/xsettings.c (parse_settings): Help the compiler by
letting it deduce the native endianness at compile-time.

5 years agoFix more regexp oddities
Paul Eggert [Sun, 7 Apr 2019 09:44:37 +0000 (02:44 -0700)]
Fix more regexp oddities

Problems reported by Mattias Engdegård in:
https://lists.gnu.org/archive/html/emacs-devel/2019-04/msg00178.html
* lisp/progmodes/sh-script.el (sh-get-indent-info):
Reorder skip-chars-forward arg so that it does not look like a regexp.
* lisp/progmodes/verilog-mode.el (verilog-sk-define-signal):
Fix typo: the string is not a regexp.
* lisp/vc/log-edit.el (log-edit-goto-eoh): Fix typo: stray ‘:’.
* lisp/xml.el (xml-parse-dtd): Avoid ‘-’ right after char class.

5 years agoFix typo in tramp.texi
Michael Albinus [Sun, 7 Apr 2019 08:10:52 +0000 (10:10 +0200)]
Fix typo in tramp.texi

* doc/misc/tramp.texi (Change file name syntax)
(Frequently Asked Questions): '.' or ',' must follow xref.

5 years ago* lisp/net/tramp.el (tramp-parse-group): Rename third arg to SKIP-CHARS.
Michael Albinus [Sun, 7 Apr 2019 08:10:30 +0000 (10:10 +0200)]
* lisp/net/tramp.el (tramp-parse-group): Rename third arg to SKIP-CHARS.

(tramp-parse-sconfig-group): Fix thinko.

5 years ago* lisp/frame.el (display-planes): Use logb over truncate + log
Alexander Gramiak [Tue, 2 Apr 2019 17:14:18 +0000 (11:14 -0600)]
* lisp/frame.el (display-planes): Use logb over truncate + log

Suggested by Basil L. Contovounesios:
https://lists.gnu.org/archive/html/bug-gnu-emacs/2019-03/msg01052.html

5 years agoIntroduce new defcustom for terminal CUA rectangle commands
Alexander Gramiak [Wed, 3 Apr 2019 20:06:45 +0000 (14:06 -0600)]
Introduce new defcustom for terminal CUA rectangle commands

This allows a user to set a non-meta modifier for their terminal
should his/her terminal support it. See bug#35058 for background on
this change.

* lisp/emulation/cua-base.el (cua-rectangle-terminal-modifier-key):
New defcustom.

* lisp/emulation/cua-base.el (cua--shift-control-x-prefix): Use new
defcustom.

5 years agoDefine and use new procedure display-symbol-keys-p
Alexander Gramiak [Wed, 3 Apr 2019 20:03:28 +0000 (14:03 -0600)]
Define and use new procedure display-symbol-keys-p

* lisp/frame.el (display-symbol-keys-p): Define.

* lisp/simple.el (normal-erase-is-backspace-setup-frame): Use eq
instead of memq.
(normal-erase-is-backspace-mode): Use display-symbol-keys-p.

5 years agoDefine and use new alias display-blink-cursor-p
Alexander Gramiak [Wed, 3 Apr 2019 20:03:42 +0000 (14:03 -0600)]
Define and use new alias display-blink-cursor-p

display-graphic-p is not used in this case because it may be possible
in the future for terminals to allow control over cursor blinking. For
details, see bug#35058.

* lisp/frame.el (blink-cursor-mode): Use display-blink-cursor-p.

5 years agoUse display-graphic-p and display-multi-frame-p in more cases
Alexander Gramiak [Wed, 3 Apr 2019 19:57:16 +0000 (13:57 -0600)]
Use display-graphic-p and display-multi-frame-p in more cases

* lisp/disp-table.el:
* lisp/faces.el:
* lisp/frame.el:
* lisp/info.el (Info-fontify-node):
* lisp/window.el (handle-select-window): Use display-graphic-p and
  display-multi-frame-p instead of explicit memq calls.

5 years agoDistinguish buttons from widgets (bug#34506)
Basil L. Contovounesios [Sun, 7 Apr 2019 02:36:47 +0000 (03:36 +0100)]
Distinguish buttons from widgets (bug#34506)

* lisp/button.el (button-at):
* lisp/wid-edit.el (widget-at): Avoid returning a false positive
when looking for a button and finding a widget, or vice versa.
* test/lisp/button-tests.el:
* test/lisp/wid-edit-tests.el: New files.

5 years ago* src/buffer.c (Fget_buffer_create): Apply booleans's eta-reduction
Stefan Monnier [Sat, 6 Apr 2019 22:54:31 +0000 (18:54 -0400)]
* src/buffer.c (Fget_buffer_create): Apply booleans's eta-reduction

5 years ago* lisp/subr.el (setq-default): Fix thinko
Stefan Monnier [Sat, 6 Apr 2019 22:44:24 +0000 (18:44 -0400)]
* lisp/subr.el (setq-default): Fix thinko

Reported by Johan Bockgård <bojohan+news@gnu.org>

5 years ago* doc/misc/tramp.texi (Remote processes): '.' or ',' must follow xref.
Glenn Morris [Sat, 6 Apr 2019 19:57:44 +0000 (12:57 -0700)]
* doc/misc/tramp.texi (Remote processes): '.' or ',' must follow xref.

5 years agoEncode the FILENAME argument of 'file-locked-p'
Eli Zaretskii [Sat, 6 Apr 2019 14:53:30 +0000 (17:53 +0300)]
Encode the FILENAME argument of 'file-locked-p'

* src/filelock.c (Ffile_locked_p): Encode the file name,
before passing it to system APIs.  (Bug#35171)

5 years agoDon't leave inhibit_buffer_hooks uninitialized
Basil L. Contovounesios [Sat, 6 Apr 2019 01:41:16 +0000 (02:41 +0100)]
Don't leave inhibit_buffer_hooks uninitialized

* src/buffer.c (Fget_buffer_create): Explicitly initialize
inhibit_buffer_hooks. (bug#34847)

5 years ago; * src/w32fns.c (Fw32_read_registry): Doc fix.
Eli Zaretskii [Sat, 6 Apr 2019 13:16:32 +0000 (16:16 +0300)]
; * src/w32fns.c (Fw32_read_registry): Doc fix.

5 years agoFix Bug#34847
Michael Albinus [Sat, 6 Apr 2019 09:36:34 +0000 (11:36 +0200)]
Fix Bug#34847

* lisp/autorevert.el (auto-revert-remove-current-buffer):
Add optional argument BUFFER.
(auto-revert-notify-rm-watch): Remove local hook.
(auto-revert-buffers): Check `buffer-live-p' in time.  (Bug#34847)

5 years agoUpdate documentation for indent-relative functions
Alex Branham [Tue, 26 Mar 2019 01:49:01 +0000 (20:49 -0500)]
Update documentation for indent-relative functions

* lisp/indent.el (indent-relative): Document what happens when there
  is no previous nonblank line.
* doc/lispref/text.texi (Relative Indent): Document
  indent-relative-first-indent-point instead of obsolete
  indent-relative-maybe. Fix documentation of which argument from
  'indent-relative' is used.

Bug#34858

5 years agoSmall elide-head.el update
Michał Krzywkowski [Sat, 6 Apr 2019 00:33:07 +0000 (20:33 -0400)]
Small elide-head.el update

* lisp/elide-head.el (elide-head-headers-to-hide):
Also match https for GPL.  (Bug#34919)

5 years ago* doc/emacs/emacs.texi (Acknowledgments): Remove duplicate.
Glenn Morris [Sat, 6 Apr 2019 00:03:04 +0000 (17:03 -0700)]
* doc/emacs/emacs.texi (Acknowledgments): Remove duplicate.

5 years agoAdapt tramp-tests.el
Michael Albinus [Fri, 5 Apr 2019 11:27:06 +0000 (13:27 +0200)]
Adapt tramp-tests.el

* test/lisp/net/tramp-tests.el (tramp-test30-make-process):
Instrument test.  Adapt check string.
(tramp-test34-explicit-shell-file-name)
(tramp-test43-asynchronous-requests): Skip tests for tramp-adb
with older Emacsen.

5 years agoMinor cleanup in widget.c
Konstantin Kharlamov [Tue, 2 Apr 2019 20:49:58 +0000 (23:49 +0300)]
Minor cleanup in widget.c

* src/widget.c (update_wm_hints): Remove variables that are
always zero, and simplify all expressions which used them.
(Bug#35062)

5 years agoMinor cleanup in gtkutil.c
Konstantin Kharlamov [Tue, 2 Apr 2019 00:23:27 +0000 (03:23 +0300)]
Minor cleanup in gtkutil.c

* src/gtkutil.c (x_wm_set_size_hint): Remove variables that
are always zero, and simplify all expressions which used
them.  (Bug#35062)

5 years agoMake `move article' work again (bug#33653)
Katsumi Yamaoka [Fri, 5 Apr 2019 04:25:06 +0000 (04:25 +0000)]
Make `move article' work again (bug#33653)

* lisp/gnus/gnus-sum.el (gnus-summary-move-article): Back to while loop
m dolist that blocks nov and active from saving (bug#33653).

5 years ago; Fix copyright years
Glenn Morris [Fri, 5 Apr 2019 00:41:02 +0000 (20:41 -0400)]
; Fix copyright years

5 years agoDon't check comp-buffer-name-function in derived mode (Bug#34956)
Troy Hinckley [Wed, 16 Jan 2019 22:47:07 +0000 (14:47 -0800)]
Don't check comp-buffer-name-function in derived mode (Bug#34956)

* lisp/progmodes/compile.el (define-compilation-mode): Remove
'compilation-buffer-name-function' from the list of overridden
variables to ensure that it is not mistaken for a variable that can be
major mode specific.  'compilation-buffer-name-function' is used
before the major mode is loaded, therefore overriding it here is
ineffectual.  Also, the function 'compilation-start' takes an optional
argument name-function, so there is already a mechanism to override
it.

5 years agoFix comment-empty-lines docstring (bug#35152)
Basil L. Contovounesios [Thu, 4 Apr 2019 22:37:08 +0000 (23:37 +0100)]
Fix comment-empty-lines docstring (bug#35152)

* lisp/newcomment.el (comment-empty-lines): Consistently use US
commas in docstring.  Fix indentation of and typo in custom :type.

5 years ago* lisp/progmodes/compile.el (compilation-error-regexp-alist): Typo
Stefan Monnier [Thu, 4 Apr 2019 20:27:29 +0000 (16:27 -0400)]
* lisp/progmodes/compile.el (compilation-error-regexp-alist): Typo

Reported by Kévin Le Gouguec <kevin.legouguec@gmail.com>

5 years ago* lisp/desktop.el (desktop--v2s): Add case for defstructs (bug#35131)
Stefan Monnier [Thu, 4 Apr 2019 17:46:30 +0000 (13:46 -0400)]
* lisp/desktop.el (desktop--v2s): Add case for defstructs (bug#35131)

5 years ago* test/lisp/net/tramp-tests.el (tramp-test43-asynchronous-requests):
Michael Albinus [Thu, 4 Apr 2019 11:41:53 +0000 (13:41 +0200)]
* test/lisp/net/tramp-tests.el (tramp-test43-asynchronous-requests):

Make it fit for tramp-adb.  Apply better check in process filter.

5 years agoAvoid recursive load of eshell
Mauro Aranda [Sat, 23 Mar 2019 14:38:14 +0000 (11:38 -0300)]
Avoid recursive load of eshell

* lisp/eshell/eshell.el: Provide eshell before requiring esh-mode to
avoid a recursive load when esh-mode requires esh-module (which in
turn requires eshell).  (Bug #34954)
The double loading can be noticed by entries in 'eshell-load-hook' or
forms passed to (with-eval-after-load 'eshell ...).

5 years agoFix repeated 'custom-add-option' in esh-mode.el (Bug#34993)
Mauro Aranda [Mon, 25 Mar 2019 13:38:39 +0000 (10:38 -0300)]
Fix repeated 'custom-add-option' in esh-mode.el (Bug#34993)

* lisp/eshell/esh-mode.el: Call 'custom-add-option' with the right
argument.

5 years agoWork on asynchronous processes for tramp-adb.el
Michael Albinus [Wed, 3 Apr 2019 19:36:40 +0000 (21:36 +0200)]
Work on asynchronous processes for tramp-adb.el

* lisp/net/tramp-adb.el (tramp-adb-handle-make-process):
Simplify.  Remove echoed first line.
(tramp-adb-send-command): Add NEVEROPEN and NOOUTPUT.

* lisp/net/tramp-sh.el (tramp-process-sentinel): Remove.
(tramp-sh-handle-make-process): Simplify.

* lisp/net/tramp.el (tramp-process-sentinel): New defun, taken from
tramp-sh.el.  Delete trailing shell prompt.

* test/lisp/net/tramp-tests.el (tramp-test29-start-file-process)
(tramp-test30-make-process): Run also for tramp-adb.
(tramp-test32-shell-command): Remove tramp-adb restrictions.
(tramp-test34-explicit-shell-file-name): Rework.  Remove :unstable tag.

5 years ago* test/lisp/progmodes/flymake-tests.el (different-diagnostic-types):
Glenn Morris [Wed, 3 Apr 2019 19:20:50 +0000 (15:20 -0400)]
* test/lisp/progmodes/flymake-tests.el (different-diagnostic-types):
Expect failure on hydra.nixos.

5 years agoImprove commentary in 'field_relpos'
Eli Zaretskii [Wed, 3 Apr 2019 17:41:47 +0000 (20:41 +0300)]
Improve commentary in 'field_relpos'

* src/pdumper.c (PDUMPER_MAX_OBJECT_SIZE): New macro.
(field_relpos): Use PDUMPER_MAX_OBJECT_SIZE, and comment on
why we require that relpos be not too large.