Commit graph

5847 commits

Author SHA1 Message Date
Lars Ingebrigtsen
a1508e8d2d Fix compilation warning about gv-setter in cl-generic
* lisp/emacs-lisp/cl-generic.el (gv-setter): Declare to avoid a
compilation warning.
2019-06-16 17:58:35 +02:00
Lars Ingebrigtsen
98ba1c6b52 Fix compilation warning i eieio-base
* lisp/emacs-lisp/eieio-base.el (clone): Use eieio-object-class
instead of obsolete function class-of.
2019-06-16 16:48:34 +02:00
Lars Ingebrigtsen
bf8c80be7d Compilation fix for previous change to eieio-opt
* lisp/emacs-lisp/eieio-opt.el (cl-extra): Require for
cl--describe-class.
2019-06-16 16:04:51 +02:00
Lars Ingebrigtsen
303637930c Fix compilation warning in eieio-opt
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor): Don't
use obsolete function eieio-help-class.
2019-06-16 16:02:42 +02:00
Lars Ingebrigtsen
0c2b747d26 Avoid "unknown slot" compilation warning in eieio-custom
* lisp/emacs-lisp/eieio-custom.el
(eieio-read-customization-group): Slot `name' may not exist in all
classes, so protect against that (and avoid a compilation warning
about it).
2019-06-16 15:53:03 +02:00
Lars Ingebrigtsen
0c01734a32 Fix byte compilation warning in bindat.el
* lisp/emacs-lisp/bindat.el (bindat--unpack-item): Avoid a byte
compilation warning by using unibyte-string instead of concat +
string-make-unibyte.
2019-06-15 16:33:20 +02:00
Lars Ingebrigtsen
7486b8f4eb Avoid compilation warning in byte-run
* lisp/emacs-lisp/byte-run.el (macro-declaration-function): Avoid
compilation warning by not using `symbol-function'.
2019-06-14 13:24:47 +02:00
Lars Ingebrigtsen
a6191e060b Remove outdated FIXME
* lisp/emacs-lisp/eieio-core.el (eieio--slot-name-index): Remove
comment about issuing a byte compilation warning about accessing
slots via :initarg -- it was implemented a few months later.
2019-06-13 17:19:32 +02:00
Pip Cet
bfec493efe Escape newlines when printing functions in timer list
* timer-list.el (list-timers): Bind `print-escape-newlines' to avoid
newlines in printed representation (bug#36187).
2019-06-13 14:11:39 +02:00
Lars Ingebrigtsen
f660616f82 Compilation fix for previous change 2019-06-13 13:56:16 +02:00
Lars Ingebrigtsen
bb5641d3cc Compilation warning fix for disass.el
* lisp/emacs-lisp/disass.el (disassemble-1): Remove a
string-as-unibyte that probably doesn't do anything, because the
string in question should be unibyte anyway.  If the assert fails,
revert the patch.
2019-06-13 13:54:53 +02:00
Glenn Morris
fb69593f60 Revert "Compilation warning fix for byte-run.el"
* lisp/emacs-lisp/byte-run.el (macro-declaration-function):
Revert change that causes a bootstrap failure.

; Ref eg https://hydra.nixos.org/build/94678649
2019-06-12 17:20:50 -07:00
Lars Ingebrigtsen
e4636297c6 Compilation warning fix for byte-run.el
* lisp/emacs-lisp/byte-run.el (macro-declaration-function):
Suppress warning about obsolete function used by obsolete variable.
2019-06-13 01:14:47 +02:00
Lars Ingebrigtsen
48178edeed (beginning-of-defun-raw): Suppress warning about syntax-begin-function
* lisp/emacs-lisp/lisp.el (beginning-of-defun-raw):
font-lock-compile-keywords also suppresses warnings about the
obsolete syntax-begin-function variable, so suppress the only
other use not in syntax.el.
2019-06-12 17:46:06 +02:00
Lars Ingebrigtsen
e4fd2cfc72 Suppress warning about pi not having a prefix
* lisp/emacs-lisp/float-sup.el (pi): Suppress warning about this
obsolete variable not having a prefix.
2019-06-12 17:46:06 +02:00
Lars Ingebrigtsen
f2071b6de4 Add the new macro with-suppressed-warnings
* lisp/emacs-lisp/byte-run.el (with-suppressed-warnings): New macro.

* doc/lispref/compile.texi (Compiler Errors): Document
with-suppressed-warnings and deemphasise with-no-warnings
slightly.

* lisp/emacs-lisp/bytecomp.el (byte-compile--suppressed-warnings):
New internal variable.
(byte-compile-warning-enabled-p): Heed
byte-compile--suppressed-warnings, bound via with-suppressed-warnings.
(byte-compile-initial-macro-environment): Provide a macro
expansion of with-suppressed-warnings.
(byte-compile-file-form-with-suppressed-warnings): New byte hunk
handler for the suppressed symbol machinery.
(byte-compile-suppressed-warnings): Ditto for the byteop.
(byte-compile-file-form-defmumble): Ditto.
(byte-compile-form, byte-compile-normal-call)
(byte-compile-normal-call, byte-compile-variable-ref)
(byte-compile-set-default, byte-compile-variable-set)
(byte-compile-function-form, byte-compile-set-default)
(byte-compile-warn-obsolete, byte-compile--declare-var): Pass the
symbol being warned in to byte-compile-warning-enabled-p.

* test/lisp/emacs-lisp/bytecomp-tests.el (test-suppression): New
function.
(bytecomp-test--with-suppressed-warnings): Tests.
2019-06-12 15:59:19 +02:00
Noam Postavsky
0026d0bf9f Don't keep warning about unescaped literals (Bug#36068)
* lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Restore lost
let-binding of lread--unescaped-character-literals, so that unescaped
literals warning will only apply to the form just read.
* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp-tests--unescaped-char-literals): Expand test to check that
we don't keep warning about old unescaped literals.
2019-06-10 18:27:22 -04:00
Stefan Kangas
1af27a1784 Use lexical-binding in password-cache.el and add tests
* lisp/password-cache.el: Use lexical-binding.
* test/lisp/password-cache-tests.el: New file.
2019-06-09 10:08:36 -07:00
Glenn Morris
5e1e1e71cc Merge from origin/emacs-26
2860285 Allow macros autoloaded as functions during bytecomp (Bug#36022)
2019-06-07 07:50:48 -07:00
Dario Gjorgjevski
dec148939a Do not use syntax-ppss-table in syntax-propertize when nil (Bug#36095)
* lisp/emacs-lisp/syntax.el (syntax-propertize): Use (syntax-table)
instead of syntax-ppss-table when the latter is nil.
2019-06-05 07:29:23 -04:00
Stefan Monnier
0b3982b1a3 * lisp/emacs-lisp/syntax.el: Use syntax-ppss-table for syntax-propertize.
`syntax-ppss` uses `syntax-ppss-table` while parsing the buffer as well
as when it calls `syntax-propertize`, but `syntax-propertize` can also
be called directly rather than via `syntax-ppss` so it needs to explicitly
use `syntax-ppss-table` as well in order to avoid using sometimes one
table and sometimes another.

(syntax-ppss-table): Move before new use.
(syntax-propertize): Use it.
2019-06-04 21:48:06 -04:00
Stefan Monnier
f4d3253831 * lisp/emacs-lisp/thunk.el (thunk-delay): Fix memory leak
Get rid of references to the free variables of `body` once the thunk has
been forced (bug#30626).
2019-06-04 12:55:53 -04:00
Paul Eggert
741d04a879 Adjust comments/debug to match C bignum code
* doc/lispintro/emacs-lisp-intro.texi (Digression into C):
Adjust to match current C code.
* lisp/emacs-lisp/ert.el (ert--force-message-log-buffer-truncation):
Simplify.
* src/.gdbinit (Lisp_Object_Printer.to_string): Return
a string that says "make_fixnum", not "make_number".
2019-06-04 08:34:16 -07:00
Paul Eggert
bee3cc604d Tune cl-assoc
* lisp/emacs-lisp/cl-seq.el (cl-assoc):	Use assq for fixnums.
2019-06-01 18:13:00 -07:00
Mattias Engdegård
b5e41e8ba3 Fix cl-member' and cl-assoc' for bignums
* lisp/emacs-lisp/cl-seq.el (cl-member, cl-assoc): Work with bignums.
* test/lisp/emacs-lisp/cl-seq-tests.el (cl-seq-bignum-eql): New.
2019-06-01 18:13:00 -07:00
Noam Postavsky
2860285621 Allow macros autoloaded as functions during bytecomp (Bug#36022)
* lisp/emacs-lisp/bytecomp.el (byte-compile-callargs-warn): Don't pass
symbols which don't have a known definition to
byte-compile--function-signature, it fails to compile code which
previously compiled successfully (for example, gnus.el until
2019-06-01 "* lisp/gnus/gnus.el: Mark autoloaded macros as such" which
autoloads some macros as if they were functions).
2019-06-01 17:48:43 -04:00
Glenn Morris
7e911d007d Merge from origin/emacs-26
134edc1 Warn about wrong number of args for subrs (Bug#35767)
5f01af6 Use plain symbols for eieio type descriptors (Bug#29220)
4b24b01 Pacify GCC 9 -Wredundant-decls
2019-06-01 12:04:42 -07:00
Stefan Monnier
b3df372959 * lisp/emacs-lisp/package.el: Obey buffer-file-coding-system (bug#35739)
`url-insert-file-contents` saves in buffer-file-coding-system
the coding-system used to decode the contents.  Preserve this
as the contents is moved from buffer to string to buffer, and use
it when saving the contents to file, so as to try and better preserve
the original byte sequence.

(package--buffer-string, package--cs): New functions.
(package--check-signature): Encode `string` if a coding-system
was specified in buffer-file-coding-system.
(package--download-one-archive, package-install-from-archive):
Obey and preserve the buffer-file-coding-system if specified.

Do not merge.
2019-05-31 00:54:05 -04:00
Noam Postavsky
134edc1036 Warn about wrong number of args for subrs (Bug#35767)
* lisp/emacs-lisp/bytecomp.el (byte-compile-callargs-warn): Don't
assume byte-compile-fdefinition will return non-nil.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-warn-wrong-args)
(bytecomp-warn-wrong-args-subr): New tests.
2019-05-30 18:46:07 -04:00
Noam Postavsky
5f01af6c8e Use plain symbols for eieio type descriptors (Bug#29220)
Since Emacs 26, eieio objects use a class record (with circular
references) as the type descriptor of the object record.  This causes
problems when reading back an object from a string, because the class
record is not `eq' to the canonical one (which means that read objects
don't satisfy the foo-p predicate).
* lisp/emacs-lisp/eieio.el (make-instance): As a (partial) fix, set
the record's type descriptor to a plain symbol for the type descriptor
when eieio-backward-compatibility is non-nil (the default).
* lisp/emacs-lisp/eieio-core.el (eieio--object-class): Call
eieio--class-object on the type tag when eieio-backward-compatibility
is non-nil.
(eieio-object-p): Use eieio--object-class instead of
eieio--object-class-tag.
* test/lisp/emacs-lisp/eieio-tests/eieio-test-persist.el
(eieio-test-persist-hash-and-vector)
(eieio-test-persist-interior-lists): Make into functions.
(eieio-persist-hash-and-vector-backward-compatibility)
(eieio-persist-hash-and-vector-no-backward-compatibility)
(eieio-test-persist-interior-lists-backward-compatibility)
(eieio-test-persist-interior-lists-no-backward-compatibility): New
tests which call them, eieio-backward-compatibility let-bound.
2019-05-30 18:46:07 -04:00
Stefan Monnier
fe0cb43fb8 * lisp/subr.el (add-hook): Turn append into depth (bug#35508)
Make it possible to control the relative ordering of functions on hooks by
specifying `depth` in the same was as was possible with `add-function`.

* lisp/electric.el (electric--sort-post-self-insertion-hook):
Delete function.
(electric-indent-mode, electric-layout-mode, electric-quote-mode):
* lisp/elec-pair.el (electric-pair-mode): Use new `depth` arg instead of
electric--sort-post-self-insertion-hook.

* lisp/emacs-lisp/syntax.el (syntax-propertize, syntax-ppss):
Use new `depth` arg to make sure noone accidentally gets added
after syntax-ppss-flush-cache.

* doc/lispref/modes.texi (Setting Hooks): Document new `depth` arg.

* test/lisp/subr-tests.el (subr-tests-add-hook-depth): New test.
2019-05-29 15:56:14 -04:00
Mattias Engdegård
68b374a62d Correctly eliminate duplicate cases in switch compilation
Fix code mistakes that prevented the correct elimination of duplicated
cases when compiling a `cond' form to a switch bytecode, as in

  (cond ((eq x 'a) 1)
        ((eq x 'b) 2)
        ((eq x 'a) 3)   ; should be elided
        ((eq x 'c) 4))

Sometimes, this caused the bytecode to use the wrong branch (bug#35770).

* lisp/emacs-lisp/bytecomp.el (byte-compile-cond-vars): Return obj2 eval'ed.
(byte-compile-cond-jump-table-info):
Discard redundant condition.  Use `obj2' as evaluated.
Discard duplicated cases instead of failing the table generation.
* test/lisp/emacs-lisp/bytecomp-tests.el (toplevel): Require subr-x.
(byte-opt-testsuite-arith-data, bytecomp-test--switch-duplicates): Test.
2019-05-27 13:25:27 +02:00
Noam Postavsky
c4d4dcf17e Avoid infloop in read-multiple-choice (Bug#32257)
* lisp/emacs-lisp/rmc.el (read-multiple-choice): When `read-char'
signals an error "Non-character input-event", call `read-event' to
take the non-character event out of the queue.  Don't merge to master,
we just use `read-event' directly there, rather than this solution
which relies a particular error message.
2019-05-26 08:46:30 -04:00
Noam Postavsky
3f03f6284a Avoid infloop in read-multiple-choice (Bug#32257)
* lisp/emacs-lisp/rmc.el (read-multiple-choice): Use `read-event'
which won't get stuck (return the same event over and over again) for
non-character events, unlike `read-char'.
2019-05-26 08:16:23 -04:00
Paul Eggert
852d281769 Update author/maintainer info
Update email addresses and fix spellings of some author and
maintainer names.
2019-05-26 01:00:16 -07:00
Paul Eggert
797ee5871e Remove Maintainer: when it duplicates Author:
The convention is that a file with Author: but not Maintainer:
means the author is a maintainer, which makes it confusing
when a file lists the same person as author and maintainer.
Avoid the confusion by removing the duplicate Maintainer: line.
2019-05-26 01:00:15 -07:00
Paul Eggert
f744797af1 Go back to "Maintainer: emacs-devel@gnu.org"
Restore lines saying "Maintainer: emacs-devel@gnu.org" when there is
no special maintainer for a file.  Although this wasn't documented
it was common practice and removing the lines didn't have consensus.
2019-05-25 14:25:18 -07:00
Stefan Monnier
35f305652c * lisp/emacs-lisp/package.el (package-install-from-archive): Fix last change
Don't place the unibyte content of of the downloaded file into
a multibyte buffer.
2019-05-24 12:26:40 -04:00
Michael Heerdegen
a564d6e8bb * lisp/emacs-lisp/cl-macs.el (cl-callf): Tweak in docstring
Say that lambdas are also allowed as FUNC argument.
2019-05-24 00:51:46 +02:00
Mattias Engdegård
afdc20d73c Allow zero-argument rx or' and seq' forms
Make the rx `or' and `seq' forms accept zero arguments to produce a
never-matching regexp and an empty string, respectively.

* lisp/emacs-lisp/rx.el: Require cl-extra.
(rx-constituents, rx-or): Permit zero args.
(rx): Amend doc string for `or' and `seq'.
* test/lisp/emacs-lisp/rx-tests.el (rx-or, rx-seq): Test the change.
* etc/NEWS (Changes in Specialized Modes and Packages): Mention the change.
2019-05-20 17:56:40 +02:00
Mattias Engdegård
c2cda3ff40 Revert "Allow zero-argument rx or' and seq' forms"
This reverts commit b552fc05c2.
It caused a bootstrapping failure which I have yet to resolve - sorry.
2019-05-20 17:38:03 +02:00
Mattias Engdegård
b552fc05c2 Allow zero-argument rx or' and seq' forms
Make the rx `or' and `seq' forms accept zero arguments to produce a
never-matching regexp and an empty string, respectively.

* lisp/emacs-lisp/rx.el (rx-constituents, rx-or): Permit zero args.
(rx): Amend doc string for `or' and `seq'.
* test/lisp/emacs-lisp/rx-tests.el (rx-or, rx-seq): Test the change.
* etc/NEWS (Changes in Specialized Modes and Packages): Mention the change.
2019-05-20 11:39:46 +02:00
Paul Eggert
bef1be8730 Fixes for "Maintainer:" and related lines
Mostly, this just removes "Maintainer: emacs-devel@gnu.org" lines,
which are not that useful.  It also cleans up and regularizes a
few similar lines.
2019-05-19 21:34:27 -07:00
Lars Ingebrigtsen
1b2b136a17 cus-edit.el: Remove XEmacs compat code
* lisp/cus-edit.el (custom-browse-insert-prefix): Remove XEmacs
compat code and make obsolete.
(custom-group-value-create): Use `insert' directly.

* lisp/emacs-lisp/elint.el (elint-check-conditional-form): Don't
refer to function that doesn't have an if any more.
2019-05-19 20:50:54 +02:00
Stefan Monnier
5f9671e57e * lisp/emacs-lisp/package.el: Fix decoding of downloaded files
This is a different fix for bug#34909, which should also fix bug#35739.

Our downloading code used to automatically decode the result according
to the usual heuristics for files.  This caused problems when we later
needed to save the data in a file that needed to be byte-for-byte
equal to the original in order to pass the signature verification,
especially because we didn't keep track of which coding-system was
used to decode the data.

(package--unless-error): New macro extracted from
package--with-response-buffer-1, so that we can specify edebug and
indent specs.
(package--with-response-buffer-1): Use it.  More importantly, change
code so it runs `body` in a unibyte buffer with undecoded data.
(package--download-one-archive): Don't encode with utf-8 since the data
is not decoded yet.
(describe-package-1): Explicitly decode the readem.txt files here.

* lisp/url/url-handlers.el (url-insert-file-contents): Use it.
(url-insert): Don't decode if buffer is unibyte.

* lisp/url/url-http.el (url-http--insert-file-helper): New function,
extracted from url-insert-file-contents.
2019-05-18 18:32:47 -04:00
Stefan Monnier
2a5705761e * lisp/emacs-lisp/package.el: Reduce macrology in ...with-response-buffer
(package--with-response-buffer-1): New function, extracted from
package--with-response-buffer.
(package--with-response-buffer): Use it.
2019-05-18 17:40:21 -04:00
Stefan Monnier
2e8f6ad287 * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Fix docstring of accessors. 2019-05-16 22:00:57 -04:00
Paul Pogonyshev
8d3fff6bd6 Make `package' not "uninhibit" messages (Bug#34037)
* lisp/emacs-lisp/package.el: Don't let-bind inhibit-message to a
different value if it was non-nil.
2019-05-16 20:08:27 -04:00
Stefan Monnier
37c41c6ef0 * lisp/emacs-lisp/cl-macs.el (cl--sm-macroexpand) <setq>: Rewrite
The previous code had 2 problems:
- It converted `setq` to `setf` in unrelated cases such as
  (cl-symbol-macrolet ((x 1)) (setq (car foo) bar))
- It macroexpanded places before `setf` had a chance to see if they
  have a gv-expander.
2019-05-16 15:29:36 -04:00
Mattias Engdegård
26f735ff19 Add standard unmatchable regexp
Add `regexp-unmatchable' as a standard unmatchable regexp, defined as
"\\`a\\`".  Use it where such a regexp is needed, replacing slower
expressions in several places.
From a suggestion by Philippe Schnoebelen.

* lisp/subr.el (regexp-unmatchable): New defconst.
* etc/NEWS (Lisp Changes): Mention `regexp-unmatchable'.
* doc/lispref/searching.texi (Regexp Functions): Document it.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt)
* lisp/progmodes/cc-defs.el (cc-conditional-require-after-load)
(c-make-keywords-re)
* lisp/progmodes/cc-engine.el (c-beginning-of-statement-1)
(c-forward-<>-arglist-recur, c-forward-decl-or-cast-1)
(c-looking-at-decl-block)
* lisp/progmodes/cc-fonts.el (c-doc-line-join-re)
(c-doc-bright-comment-start-re)
* lisp/progmodes/cc-langs.el (c-populate-syntax-table)
(c-assignment-op-regexp)
(c-block-comment-ender-regexp, c-font-lock-comment-end-skip)
(c-block-comment-start-regexp, c-line-comment-start-regexp)
(c-doc-comment-start-regexp, c-decl-start-colon-kwd-re)
(c-type-decl-prefix-key, c-type-decl-operator-prefix-key)
(c-pre-id-bracelist-key, c-enum-clause-introduction-re)
(c-nonlabel-token-2-key)
* lisp/progmodes/cc-mode.el (c-doc-fl-decl-start, c-doc-fl-decl-end)
* lisp/progmodes/cc-vars.el (c-noise-macro-with-parens-name-re)
(c-noise-macro-name-re, c-make-noise-macro-regexps)
* lisp/progmodes/octave.el (octave-help-mode)
* lisp/vc/vc-bzr.el (vc-bzr-log-view-mode, vc-bzr-revision-completion-table)
* lisp/vc/vc-git.el (vc-git-log-view-mode)
* lisp/vc/vc-hg.el (vc-hg-log-view-mode)
* lisp/vc/vc-mtn.el (vc-mtn-log-view-mode):
Use `regexp-unmatchable'.
* lisp/textmodes/ispell.el (ispell-non-empty-string):
Use `regexp-unmatchable', fixing a broken never-match regexp.
2019-05-15 18:55:27 +02:00