summaryrefslogtreecommitdiff
path: root/test/manual/indent
Commit message (Collapse)AuthorAgeFilesLines
* Convert a manual test for nxml-mode to unit testStefan Kangas2020-09-211-10/+0
| | | | | | * test/manual/indent/nxml.xml: Delete file. * test/lisp/nxml/nxml-mode-tests.el (nxml-mode-test-comment-bug-17264): New test based on deleted file.
* Convert manual indent test for ruby-mode into unit testStefan Kangas2020-09-211-477/+0
| | | | | | | | | * test/manual/indent/ruby.rb: Move from here... * test/lisp/progmodes/ruby-mode-resources/ruby.rb: ...to here. * test/lisp/progmodes/ruby-mode-tests.el (ruby-mode-tests-data-dir): New variable. (ruby--indent/converted-from-manual-test): New test.
* Convert manual indent test for scheme-mode into unit testStefan Kangas2020-09-211-9/+0
| | | | | | * test/manual/indent/scheme.scm: Delete file. * test/lisp/progmodes/scheme-tests.el: New file with unit test for scheme-mode based on deleted file.
* Convert manual indent test for ps-mode into unit testStefan Kangas2020-09-211-14/+0
| | | | | | * test/manual/indent/ps-mode.ps: Delete file. * test/lisp/progmodes/ps-mode-tests.el (ps-mode-test-indent): New unit test based on deleted file.
* Convert manual indent test for opascal-mode into unit testStefan Kangas2020-09-211-12/+0
| | | | | | * test/manual/indent/opascal.pas: Delete file. * test/lisp/progmodes/opascal-tests.el: New file with unit test for oposcal-mode based on deleted file.
* Convert manual indent test for lisp-mode into unit testStefan Kangas2020-09-211-5/+0
| | | | | | * test/manual/indent/lisp.lisp: Delete file. * test/lisp/emacs-lisp/lisp-mode-tests.el (lisp-indent-defun): New unit test based on deleted file.
* Convert manual indent test for elisp-mode into unit testStefan Kangas2020-09-211-6/+0
| | | | | | * test/manual/indent/elisp.el: Delete file. * test/lisp/progmodes/elisp-mode-tests.el (elisp-indent-basic): New unit test based on deleted file.
* ; Fix more trivial typosStefan Kangas2020-09-211-1/+1
|
* Convert indent test for css-mode into automatic testStefan Kangas2020-09-101-100/+0
| | | | | | | | * test/lisp/textmodes/css-mode-tests.el (css-mode-test-indent): New test. (css-mode-tests-data-dir): New variable. * test/manual/indent/css-mode.css: Move from here... * test/lisp/textmodes/css-mode-resources/test-indent.css: ...to here.
* ; * test/manual/indent/elisp.el: Use lexical-binding.Stefan Kangas2020-09-101-0/+1
|
* * lisp/emacs-lisp/lisp-mode.el: Add new indentation conventionakater2020-05-292-0/+10
| | | | | | (calculate-lisp-indent): To distinguish code and data when indenting, introduce the convention that a space between an open paren and a symbol indicate that this should be indented as a simple data list.
* Allow underscores in CSS variable namesSimen Heggestøyl2020-05-103-0/+18
| | | | | | | | | | | | | | * lisp/textmodes/css-mode.el (css-nmchar-re): Allow underscores in variable names (and in identifiers in general). * test/manual/indent/css-mode.css: Add some examples of variable names with underscores in them. * test/manual/indent/less-css-mode.less: Add some examples of variable names with underscores in them. * test/manual/indent/scss-mode.scss: Add some examples of variable names with underscores in them.
* Update copyright year to 2020Paul Eggert2020-01-011-1/+1
| | | | Run "TZ=UTC0 admin/update-copyright $(git ls-files)".
* Ignore comments and strings when matching JSXJackson Ray Hamilton2019-12-071-0/+7
| | | | | | * lisp/progmodes/js.el (js-jsx--matching-close-tag-pos): Ignore comments and strings. * test/manual/indent/jsx-comment-string.jsx: New test.
* * lisp/progmodes/perl-mode.el (perl-calculate-indent): Indent qw(...)Stefan Monnier2019-11-151-0/+6
| | | | | Fix initialization of `state`. Special-case `qw(...)` because we do want to indent its contents.
* Ignore comments and strings when recognizing JSXJackson Ray Hamilton2019-09-221-0/+16
| | | | | | * lisp/progmodes/js.el (js-syntax-propertize): Ignore comments and strings. * test/manual/indent/jsx-comment-string.jsx: New test.
* * lisp/progmodes/opascal.el: Allow inline `var` decl in `for` (bug#36348)Stefan Monnier2019-07-221-0/+12
| | | | (opascal-enclosing-indent-of): Ignore decls "neutered" by delimiter.
* * test/manual/indent/octave.m (spmd): Add test for last changeStefan Monnier2019-07-201-0/+4
|
* * lisp/textmodes/tex-mode.el (latex-noindent-commands): New custom varStefan Monnier2019-06-241-0/+4
| | | | | (latex-find-indent): Obey it. (latex-noindent-environments): Make it into a defcustom as well.
* Add new defcustom js-jsx-align->-with-<Jackson Ray Hamilton2019-04-091-0/+12
| | | | | | | | | | | | | * lisp/progmodes/js.el (js-jsx-align->-with-<): New variable for users to control one opinionated aspect of JSX indentation. It defaults to the style seen in the React docs, which many users expected as the “correct” indentation. Still, the old SGML-style of indentation could be desirable too, especially since it was the old default. This ensures users have a way of getting back the old behavior. (js-jsx--contextual-indentation): Respect js-jsx-align->-with-<. * test/manual/indent/jsx-align-gt-with-lt.jsx: New test for js-jsx-align->-with-<.
* Add new defcustom js-jsx-indent-levelJackson Ray Hamilton2019-04-091-0/+13
| | | | | | | | | | * lisp/progmodes/js.el (js-jsx-indent-level): New variable for users to set JSX indentation differently than JS, like before. (js-jsx--contextual-indentation): Respect js-jsx-indent-level when it’s set. * test/manual/indent/jsx-indent-level.jsx: New test for js-jsx-indent-level.
* Permit non-ASCII identifiers in JSJackson Ray Hamilton2019-04-081-0/+7
| | | | | | | | | * 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.
* Improve whitespace and unary keyword parsingJackson Ray Hamilton2019-04-081-0/+16
| | | | | | | | | | | | | | | | | | | | * 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.
* Optimize js-jsx--matching-close-tag-posJackson Ray Hamilton2019-04-081-1/+6
| | | | | | | | | | | | | | | | | 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.
* Add tests for miscellaneous JSX parsing featsJackson Ray Hamilton2019-04-081-0/+26
| | | | | * test/manual/indent/jsx.jsx: Add tests for JSXMemberExpression names and JSXOpeningFragment/JSXClosingFragment support (already supported).
* Indent expressions in JSXAttributes relative to the attribute’s nameJackson Ray Hamilton2019-04-081-0/+25
| | | | | | | | | | | | | | | | | | | * 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.
* Fix counting of nested self-closing JSXOpeningElementsJackson Ray Hamilton2019-04-081-0/+13
| | | | | | | | | * 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.
* Indent broken arrow function bodies as an N+1th argJackson Ray Hamilton2019-04-081-0/+5
| | | | | | | | | | | | | | * 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.
* Rename tests to use the “.jsx” file extensionJackson Ray Hamilton2019-04-084-8/+0
| | | | | | | | | | | | | | | | * 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”.
* Improve JSX syntax propertizationJackson Ray Hamilton2019-04-081-0/+8
| | | | | | | | | | * 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.
* Update expectations for JSX indentation in JSXAttribute spaceJackson Ray Hamilton2019-04-081-4/+10
| | | | | * test/manual/indent/js-jsx.js: Align expectations for dangling closing constructs with other places in the tests.
* js-syntax-propertize: Disambiguate JS from JSX, fixing some indentsJackson Ray Hamilton2019-04-081-0/+14
| | | | | | | | | | | | | | | | | | | | | 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.
* Add new (failing) unclosed JSX test and separate such testsJackson Ray Hamilton2019-04-083-9/+32
| | | | | | | | * 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.
* Add failing tests for JSX indentation bugsJackson Ray Hamilton2019-04-082-0/+201
| | | | | | | | | * 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.
* Indent arrows’ expression bodies like function bodies (Bug#25904)Jackson Ray Hamilton2019-02-131-0/+9
| | | | | | | | | | | | | | | * lisp/progmodes/js.el (js--continued-expression-p): Don’t confuse ‘=>’ for a ‘>’ operator. (js--line-terminating-arrow-re): New variable. (js--looking-at-broken-arrow-function-p): New function. (js--proper-indentation): Don’t align arrow functions’ expression bodies starting on new lines like list continuations, instead align them like function bodies (js-indent-align-list-continuation need not be nil). * test/manual/indent/js.js: Add test for Bug#25904. Co-authored-by: Felipe Ochoa <felipe@fov.space>
* js--re-search-backward-inner: Fix infloopDmitry Gutov2019-02-011-0/+7
| | | | | | | | | Fix JS indentation infloop reported in https://github.com/mooz/js2-mode/issues/513. * lisp/progmodes/js.el (js--re-search-backward-inner): Account for multiline string literals. * test/manual/indent/js.js: New test example.
* Merge from origin/emacs-26Paul Eggert2018-12-311-1/+1
|\ | | | | | | | | | | 2fcf2df Fix copyright years by hand 26bed8b Update copyright year to 2019 2814292 Fix value of default frame height. (Bug#33921)
| * Update copyright year to 2019Paul Eggert2019-01-011-1/+1
| | | | | | | | Run 'TZ=UTC0 admin/update-copyright $(git ls-files)'.
* | Fix indentation bug with multi-line CSS valuesSimen Heggestøyl2018-01-271-0/+2
|/ | | | | | | * lisp/textmodes/css-mode.el (css-smie-rules): Fix indentation of multi-line CSS values that are separated by spaces. * test/manual/indent/css-mode.css: Add a test case for the fix.
* Update copyright year to 2018Paul Eggert2018-01-011-1/+1
| | | | Run admin/update-copyright.
* Fix two js indentation problemsDmitry Gutov2017-10-261-0/+9
| | | | | | | | | Fix intentation problems reported in https://github.com/mooz/js2-mode/issues/463. * lisp/progmodes/js.el (js--continued-expression-p): Check syntax state after /. (js--multi-line-declaration-indentation): Check syntax state before "const".
* Fix indentation bug in multi-line CSS selectorsSimen Heggestøyl2017-10-131-0/+10
| | | | | | | | * lisp/textmodes/css-mode.el (css--colon-inside-selector-p): Fix indentation of multi-line CSS selectors that include both a pseudo-class and parenthesis. * test/manual/indent/css-mode.css: Add test for the above change.
* Prefer HTTPS to FTP and HTTP in documentationPaul Eggert2017-09-132-2/+2
| | | | | | | | | | | | | Most of this change is to boilerplate commentary such as license URLs. This change was prompted by ftp://ftp.gnu.org's going-away party, planned for November. Change these FTP URLs to https://ftp.gnu.org instead. Make similar changes for URLs to other organizations moving away from FTP. Also, change HTTP to HTTPS for URLs to gnu.org and fsf.org when this works, as this will further help defend against man-in-the-middle attacks (for this part I omitted the MS-DOS and MS-Windows sources and the test tarballs to keep the workload down). HTTPS is not fully working to lists.gnu.org so I left those URLs alone for now.
* Support indentation of detached Less CSS rulesetsSimen Heggestøyl2017-08-151-0/+29
| | | | | | | * lisp/textmodes/css-mode.el (css-smie-rules): Provide better support for indentation of detached rulesets passed to Less mixins. * test/manual/indent/less-css-mode.less: New file.
* * lisp/progmodes/perl-mode.el: Add support for indented here docsStefan Monnier2017-07-241-0/+8
| | | | | | | | | * lisp/progmodes/perl-mode.el (perl-syntax-propertize-function): Recognize the new <<~ syntax for indented here docs. (perl-syntax-propertize-special-constructs): Adjust search of the end of here docs accordingly. * test/manual/indent/perl.perl: Add test for indented here docs.
* Offer non-aligned indentation in lists in js-mode (Bug#27503)Ingo Lohmar2017-07-031-0/+20
| | | | | | | | * lisp/progmodes/js.el (js--proper-indentation): New customization option 'js-indent-align-list-continuation'. Affects argument lists as well as arrays and object properties. * test/manual/indent/js-indent-align-list-continuation-nil.js: Test the change.
* Fix highlighting of CSS selectors with double hyphensSimen Heggestøyl2017-06-111-0/+5
| | | | | | * lisp/textmodes/css-mode.el (css--font-lock-keywords): Fix highlighting of selectors that contain double hyphens. They would be mistaken for a variable.
* Support a new CSS indentation styleSimen Heggestøyl2017-06-032-0/+21
| | | | | | | | | * lisp/textmodes/css-mode.el (css-smie-rules): Indent after property immediately followed by a newline. * test/manual/indent/css-mode.css: Add test for the change above. * test/manual/indent/scss-mode.scss: Ditto.
* Fix mhtml-mode fontification bugTom Tromey2017-05-201-0/+15
| | | | | | | Bug#26922 * lisp/textmodes/mhtml-mode.el (mhtml-syntax-propertize): Call sgml-syntax-propertize-inside if not in a submode. * test/manual/indent/html-multi-4.html: New file.
* Handle indentation of nested ternary operators in JSDmitry Gutov2017-04-131-0/+7
| | | | | * lisp/progmodes/js.el (js--looking-at-operator-p): Handle nested ternary operators.