Commit graph

5902 commits

Author SHA1 Message Date
Lars Ingebrigtsen
547800dade Checkdoc would bug out on empty files
* lisp/emacs-lisp/checkdoc.el (checkdoc--next-docstring): Don't
bug out on malformed Emacs Lisp (bug#34760).
(checkdoc-file-comments-engine): Don't bug out on empty buffers.
2019-07-09 18:45:18 +02:00
Ryan Brown
d34bfbc09c Fix for lisp tagbody indentation
* lisp/emacs-lisp/cl-indent.el (lisp-indent-259): Indent PROG
better (bug#36552).
2019-07-09 15:51:50 +02:00
Lars Ingebrigtsen
733f30b4cb Tweak messaging in re-builder
* lisp/emacs-lisp/re-builder.el (reb-copy): Say what we copied to
the kill ring.
2019-07-09 03:44:13 +02:00
Noam Postavsky
122198d2f1 Turn off bytecode jumptables to avoid Bug#36447
* lisp/emacs-lisp/bytecomp.el (byte-compile-cond-use-jump-table): Set
to nil.  We can turn this back on again when Bug#36447 is solved and
we handle dumped hash tables correctly.
2019-07-08 18:06:21 -04:00
Mattias Engdegård
72e21777d0 Shorter `rx' doc string (bug#36496)
* lisp/emacs-lisp/rx.el (rx): Replace long description with a condensed
summary of the rx syntax, with reference to the manual section.
2019-07-07 11:49:22 +02:00
Stefan Monnier
851535f587 * lisp/emacs-lisp/nadvice.el: Make it a package separate from emacs.
* lisp/finder.el (finder-compile-keywords): Grab version from
package--builtin-versions when available.
2019-07-06 18:42:02 -04:00
Noam Postavsky
1f7b602f84 Add commentary about #$ in autoload files
* lisp/emacs-lisp/autoload.el (autoload-rubric): Add commentary about
`#$' trick.
2019-07-06 14:34:47 -04:00
Mattias Engdegård
3fd7491512 Optimise more inputs to `regexp-opt' (bug#36444)
Use a more precise test to determine whether the input to `regexp-opt'
is safe to optimise when KEEP-ORDER is non-nil, permitting more inputs
to be optimised than before.  For example, ("good" "goal" "go") is now
accepted.

* lisp/emacs-lisp/regexp-opt.el (regexp-opt):
More precise test for whether the list is safe w.r.t. KEEP-ORDER.
(regexp-opt--contains-prefix): Remove.

* test/lisp/emacs-lisp/regexp-opt-tests.el: Use lexical-binding.
(regexp-opt-test--permutation, regexp-opt-test--factorial)
(regexp-opt-test--permutations, regexp-opt-test--match-all)
(regexp-opt-test--check-perm, regexp-opt-test--explain-perm)
(regexp-opt-keep-order): Test KEEP-ORDER.
2019-07-04 17:18:15 +02:00
Mattias Engdegård
22b64f7bac Better error message for C-h P RET
Previously:
  package--incompatible-p: Wrong type argument: package-desc, nil
Now:
  No package specified

* lisp/emacs-lisp/package.el (describe-package): Don't use ## as input.
2019-07-02 10:57:39 +02:00
Mattias Engdegård
f1d414b98f Allow empty argument to `regexp-opt-charset'
* test/lisp/emacs-lisp/regexp-opt-tests.el (regexp-opt-charset):
Handle nil argument, and use regexp-quote for singletons.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt-charset): Expand tests.
2019-06-29 11:12:27 +02:00
Mattias Engdegård
d8aba87a0d Strength-reduce equal', eql', member' and memql'
When comparing against symbols, turn `equal' and `eql' into `eq',
and `member' and `memql' into `memq'.

* lisp/emacs-lisp/byte-opt.el (byte-optimize--constant-symbol-p)
(byte-optimize-equal, byte-optimize-member): New.
(member, memql, equal, eql): Use new byte-optimizers.
2019-06-28 22:47:27 +02:00
Lennart Borgman
c1234ca9c3 Add more fontification to regexp builder mode
* lisp/emacs-lisp/re-builder.el (reb-copy): Work in the presence
of newlines in the regexps.
(reb-change-syntax): Use a dedicated history variable.
(reb-fontify-string-re): Fontify sub-matches.
(reb-regexp-grouping-backslash, reb-regexp-grouping-construct):
New faces.
(reb-string-font-lock-keywords): New variable.
(reb-mark-non-matching-parenthesis): Match parenthesis.
(reb-restart-font-lock): New function.

* lisp/emacs-lisp/re-builder.el (reb-mode-map): Add divider some
dividers (bug#6347).
2019-06-27 19:08:42 +02:00
Stefan Monnier
0b4e003766 Revert "* lisp/calc/calc-ext.el (math-scalarp): Fix typo"
This reverts commit 698ff554ac.
2019-06-26 10:24:59 -04:00
Stefan Monnier
698ff554ac * lisp/calc/calc-ext.el (math-scalarp): Fix typo 2019-06-26 10:03:48 -04:00
Noam Postavsky
9233865b70 Fix (rx-to-string (and (literal STR) (regexp STR)) regression
* lisp/emacs-lisp/rx.el (rx-regexp, rx-literal): Check the cadr of the
form for stringness, not the form itself.
* test/lisp/emacs-lisp/rx-tests.el (rx-to-string-lisp-forms): New test.
2019-06-26 08:50:27 -04:00
Mattias Engdegård
260b6c2c93 Merge consecutive constant `concat' args (bug#14769)
Suggested by Shigeru Fukaya <shigeru.fukaya@gmail.com>

* lisp/emacs-lisp/byte-opt.el (byte-optimize-concat): New.
(concat): Add byte-optimizer.
2019-06-26 11:39:12 +02:00
Noam Postavsky
b59ffd2290 Support (rx (and (regexp EXPR) (literal EXPR))) (Bug#36237)
* lisp/emacs-lisp/rx.el (rx-regexp): Allow non-string forms.
(rx-constituents): Add literal constituent, which is like a plain
STRING form, but allows arbitrary lisp expressions.
(rx-literal): New function.
(rx-compile-to-lisp): New variable.
(rx--subforms): New helper function for handling subforms, including
non-constant case.
(rx-group-if, rx-and, rx-or, rx-=, rx->=, rx-repeat, rx-submatch)
(rx-submatch-n, rx-kleene, rx-atomic-p): Use it to handle non-constant
subforms.
(rx): Document new form, wrap non-constant forms with concat call.
* test/lisp/emacs-lisp/rx-tests.el (rx-tests--match): New macro.
(rx-nonstring-expr, rx-nonstring-expr-non-greedy): New tests.
* etc/NEWS: Announce changes.
2019-06-25 22:00:03 -04:00
Stefan Monnier
5463b7e77a * lisp/emacs-lisp/cl-extra.el (cl-isqrt): Speed up bignum case 2019-06-25 17:08:01 -04:00
Lars Ingebrigtsen
98247645a7 Move widen/narrow in tabulated lists to } and {
* doc/emacs/buffers.texi (Several Buffers): Document it.

* lisp/emacs-lisp/tabulated-list.el (tabulated-list-mode-map):
Move widen/narrow to `}' and `{'.
2019-06-25 22:34:55 +02:00
Vaidheeswaran C
9de1177a1e Preserve header lines from derived modes in tabulated lists
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-init-header):
Preserve header line set by derived modes (bug#21025).
2019-06-25 18:09:54 +02:00
Damien Cassou
cf9f481d98 Add imenu support to package-menu-mode
* lisp/emacs-list/package.el
(package--imenu-prev-index-position-function
package--imenu-extract-index-name-function): Add Imenu functions
to package-menu-mode (bug#27134).
2019-06-25 01:31:10 +02:00
Lars Ingebrigtsen
b72cd0c746 Fix up key bindings in previous tabulated-list patch
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-mode-map):
Actually use `w'/`c' as described in previous patch.
2019-06-24 16:45:54 +02:00
Lars Ingebrigtsen
1ad3387600 Add new commands to widen/narrow tabulated list columns
* doc/emacs/buffers.texi: Document widen/contracting commands in
tabulated list mode.
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-mode-map): Add
keystrokes.
(tabulated-list-widen-current-column): New command.
(tabulated-list-narrow-current-column): Ditto.  The code was
written by Boruch Baum and then tweaked by Drew Adams (bug#32106)
before some white-space changes before the commit.
2019-06-24 16:35:13 +02:00
Lars Ingebrigtsen
f3b1b5fb50 Document syntax-ppss-context
* doc/lispref/syntax.texi (Parser State): Document it.

* lisp/emacs-lisp/syntax.el (syntax-ppss-context): Add a doc
string (bug#32504).
2019-06-24 00:04:04 +02:00
Alex Branham
0b7494414a (if-let): Improve docstring by mentioning let*
* lisp/emacs-lisp/subr-x.el (if-let): Clarify that if-let is like
let*, not like let (bug#33550).
2019-06-23 22:55:40 +02:00
Mattias Engdegård
2eafb4af55 Check validity of rx submatch-n number
* lisp/emacs-lisp/rx.el (rx-submatch): Type and range check (Bug#34373).
2019-06-23 20:31:48 +02:00
Stefan Monnier
b9d0337c84 (with-suppressed-warnings): Also suppress warnings when not byte-compiling
* lisp/emacs-lisp/byte-run.el (with-suppressed-warnings): Bind
byte-compile--suppressed-warnings when possible.
2019-06-22 23:29:00 -04:00
Stefan Monnier
436ccc6967 * lisp/emacs-lisp/bytecomp.el (byte-compile-dynamic): Mark obsolete
See bug#11649 for an example problem, and emacs-devel discussion
«Prickliness of the "invalid byte code" stuff».

* lisp/wid-edit.el, lisp/wdired.el, lisp/vc/pcvs-util.el:
* lisp/progmodes/executable.el, lisp/mail/sendmail.el:
* lisp/emacs-lisp/cl-seq.el, lisp/emacs-lisp/cl-macs.el:
* lisp/emacs-lisp/cl-lib.el, lisp/emacs-lisp/cl-extra.el:
* lisp/dired-x.el, lisp/dired-aux.el, lisp/calendar/calendar.el:
Don't use byte-compile-dynamic any more.
2019-06-21 10:30:50 -04:00
Lars Ingebrigtsen
b67a6cb8dd Clean up eieio-custom slightly
* lisp/emacs-lisp/eieio-custom.el: Remove commented out code.
2019-06-20 12:51:39 +02:00
Lars Ingebrigtsen
4e0baad410 Remove XEmacs compat code from checkdoc.el
* lisp/emacs-lisp/checkdoc.el (checkdoc-minor-mode-map): Remove
XEmacs compat code.
2019-06-20 12:51:39 +02:00
Lars Ingebrigtsen
fc8a8bdb7f Move around defgeneric/defmethods in eieio
* lisp/emacs-lisp/eieio.el (object-print):
* lisp/emacs-lisp/eieio-base.el (eieio-object-set-name-string):
Move the defgeneric before the defmethod, because that makes more
sense.
2019-06-19 17:12:29 +02:00
Stefan Monnier
416b83e907 (with-suppressed-warnings): Make it apply to macro-expansion as well
* lisp/emacs-lisp/bytecomp.el (byte-compile-initial-macro-environment):
Change with-suppressed-warnings so it also affects the macro-expansion of
the body.
2019-06-19 10:47:55 -04:00
Lars Ingebrigtsen
eef48e124d Tweak progress reporting in update-directory-autoloads
* lisp/emacs-lisp/autoload.el (update-directory-autoloads): Use
progress reporter so say what percentage the progress is at.
2019-06-19 13:48:48 +02:00
Mattias Engdegård
d3a7f3e6cd Compile any subsequence of `cond' clauses to switch (bug#36139)
A single `cond' form can how be compiled to any number of switch ops,
optionally interspersed with non-switch conditions.
Previously, switch ops would only be used for whole `cond' forms
containing no other tests.

* lisp/emacs-lisp/bytecomp.el (byte-compile--cond-vars):
Rename from `byte-compile-cond-vars'.
(byte-compile--default-val): Remove.
(byte-compile--cond-switch-prefix):
Replace `byte-compile-cond-jump-table-info'; now also returns
trailing non-switch clauses.
(byte-compile-cond-jump-table): New arguments; no longer compiles
the default case.
(byte-compile-cond): Look for and compile switches at any place in the
list of clauses.
* test/lisp/emacs-lisp/bytecomp-tests.el (byte-opt-testsuite-arith-data):
Add test expression.
2019-06-19 11:22:21 +02:00
Mattias Engdegård
14a81524c2 Compile cond with heterogeneous tests into switch (bug#36139)
Allow any mixture of `eq', `eql' and `equal', `memq', `memql' and
`member' in a switch-like `cond' to be compiled into a single switch.

* lisp/emacs-lisp/bytecomp.el (byte-compile--common-test): New.
(byte-compile-cond-jump-table-info): Use most specific common test.
* test/lisp/emacs-lisp/bytecomp-tests.el (byte-opt-testsuite-arith-data):
Add test cases for multi-value clause cond forms.
2019-06-19 11:20:59 +02:00
Mattias Engdegård
b8c74742c0 Tighter pcase or-pattern member function selection (bug#36139)
* lisp/emacs-lisp/pcase.el (pcase--u1):
Use the most specific of `memq', `memql' and `member' in or-patterns
with constant cases.  This improves performance and may help the byte-code
compiler generate a switch.
* test/lisp/emacs-lisp/pcase-tests.el (pcase-tests-member):
Add mixed-type or-pattern test cases.
2019-06-19 11:20:58 +02:00
Mattias Engdegård
36ab408207 Compile list member functions in cond to switch (bug#36139)
* lisp/emacs-lisp/bytecomp.el (byte-compile-cond-jump-table-info):
Expand `memq', `memql' and `member' to their corresponding
equality tests.
(byte-compile-cond-jump-table): Cases now have multiple values.
* lisp/emacs-lisp/byte-opt.el (byte-decompile-bytecode-1)
(byte-optimize-lapcode): Don't assume switch hash tables to be injective.
2019-06-19 11:20:58 +02:00
Lars Ingebrigtsen
6a02ca0b8c Report progress during custom-make-dependencies instead of file count
* lisp/cus-dep.el (custom-make-dependencies): Rewrite to use
reporter to report progress instead of how many files we've
processed.

* lisp/emacs-lisp/byte-run.el (byte-compile-info-string): New function.
(byte-compile-info-message): Use it.
2019-06-18 15:24:10 +02:00
Lars Ingebrigtsen
a5269a7fcf Tweak implementation of byte-compile-info-message
* lisp/emacs-lisp/byte-run.el (byte-compile-info-message): Clean
up implementation.
2019-06-18 10:36:14 +02:00
Lars Ingebrigtsen
56a90c4234 Output progress messages when scraping autoloads during bootstrap
* lisp/emacs-lisp/byte-run.el (byte-compile-info-message): New
function to outout informational messages during byte compilation.

* lisp/emacs-lisp/autoload.el (update-directory-autoloads): Use it
to report progress when scraping autoloads during bootstrap (which
may take half a minute).
2019-06-18 01:05:58 +02:00
Lars Ingebrigtsen
aed6e2f7c6 Compilation work-around for obsolete eieio-object-set-name-string
* lisp/emacs-lisp/eieio-base.el (eieio-object-set-name-string):
Move the generic definition of this method to here from eieio.el
and place it after the cl-method definition.  This avoids a
warning about it being obsolete when doing macro expansion.
2019-06-17 21:53:22 +02:00
Lars Ingebrigtsen
f8efeee0e1 Work around warning from macroexpanding obsolete method
* lisp/emacs-lisp/eieio.el (object-print): Move method definition
to before generic definition because the generic definition
obsoletes the method, which will then output a warning from when
macroexpanding.
2019-06-17 21:40:12 +02:00
Lars Ingebrigtsen
c0b322e33c Change the eieio-declare-slots function into a macro
* lisp/emacs-lisp/eieio-core.el (eieio-declare-slots): Change into
a compile-only macro.
2019-06-17 15:48:39 +02:00
Lars Ingebrigtsen
1250a24f8e New function eieio-declare-slots
* lisp/emacs-lisp/eieio-core.el (eieio-declare-slots): New
function to suppress compiler warnings about unknown slots.
2019-06-17 15:46:09 +02:00
Lars Ingebrigtsen
0161a4ae09 Fix compilation warning by having ede-target inherit from eieio-named
* lisp/cedet/ede/base.el (ede-target): Inherit from eieio-named so
that if you're customizing objects via eieio-object-value-get, you
can set the name.

* lisp/emacs-lisp/eieio-custom.el (eieio-object-value-get): Don't
use obsolete function `eieio-object-set-name-string'.
2019-06-17 13:05:40 +02:00
Lars Ingebrigtsen
a7417ddf5e Suppress warning about object-print in eieio.el
* lisp/emacs-lisp/eieio.el (obsolete): Suppress warning about
object-print being obsolete, because there are no in-tree
definitions any more.
2019-06-17 12:12:48 +02:00
Lars Ingebrigtsen
3ccc0d623a Add check for enabled warning before issuing
* lisp/emacs-lisp/bytecomp.el (byte-compile-function-warn): Check
whether we want the `obsolete' warning before issuing it.
2019-06-17 12:09:18 +02:00
Lars Ingebrigtsen
3820b77c9e Suppress warning about object-print in eieio.el
* lisp/emacs-lisp/eieio.el (cl-print-object): Suppress the warning
about object-print being obsolete, since there are no in-tree
methods like that any more.
2019-06-17 11:42:03 +02:00
Lars Ingebrigtsen
5a35377fed Make with-suppressed-warnings work in cl-defmethod
* lisp/emacs-lisp/cl-generic.el (cl-defmethod): Pass the symbol
name on to `byte-compile-warning-enabled-p' to make
with-suppressed-warnings work in cl-defmethods, too.
2019-06-17 11:39:56 +02:00
Lars Ingebrigtsen
1dfd6b4042 Rewrite object-print methods in cedet to be cl-print-object methods
* lisp/cedet/semantic/db-el.el (object-print): Ditto.
(object-print): Ditto.

* lisp/cedet/semantic/db-global.el (object-print): Ditto.

* lisp/cedet/semantic/db.el (object-print): Remove; unused.
* lisp/cedet/semantic/db.el (semanticdb-debug-info): New method.
(object-print): Rewritten to be cl-print-object.

* lisp/emacs-lisp/eieio.el (eieio-object-name): Allow the EXTRA
argument to be a list of strings.
2019-06-17 11:25:34 +02:00