Commit graph

5204 commits

Author SHA1 Message Date
Mark Oteiza
fd4b83ca7c Adjust the edebug spec of if-let*
This was fixed in Bug#24748, but now looking more closely, using gate in
the spec seems correct.  See (info "(elisp) Backtracking").
* lisp/emacs-lisp/subr-x.el (if-let*): Use gate in edebug spec.
2017-04-08 11:36:56 -04:00
Paul Eggert
a2b3fea957 Deprecate copy-record in favor of copy-sequence
Since copy-sequence seems to be needed anyway for records, have it
work on records, and remove copy-record as being superfluous.
* doc/lispref/records.texi (Records, Record Functions):
* lisp/emacs-lisp/cl-macs.el (cl-defstruct):
* lisp/emacs-lisp/eieio.el (make-instance, clone):
* test/src/alloc-tests.el (record-3):
Use copy-sequence, not copy-record, to copy records.
* doc/lispref/sequences.texi (Sequence Functions)
(Array Functions): Document that aref and copy-sequence
work on records.
* etc/NEWS: Omit copy-record.
* src/alloc.c (Fcopy_record): Remove.
* src/data.c (Faref): Document that arg can be a record.
* src/fns.c (Fcopy_sequence): Copy records, too.
2017-04-07 18:54:40 -07:00
Tom Tromey
473a42010c make smie.el respect prog-first-column
* lisp/emacs-lisp/smie.el (smie-indent-bob): Call prog-first-column.
2017-04-05 15:53:39 -06:00
Glenn Morris
ab0a27517c ; * lisp/emacs-lisp/package.el (describe-package-1): Tweak recent. 2017-04-04 20:19:24 -04:00
Glenn Morris
f981c611e2 Advertise https for homepage of gnu.org packages
* lisp/emacs-lisp/package.el (describe-package-1):
Use https, if supported, for the homepage of packages on gnu.org.
2017-04-04 19:39:57 -04:00
Glenn Morris
048133d488 Default to https for elpa.gnu.org if gnutls available
* lisp/emacs-lisp/package.el (package-archives):
Default to https for elpa.gnu.org if gnutls is available.  Ref:
http://lists.gnu.org/archive/html/emacs-devel/2015-05/msg00130.html
2017-04-04 19:04:52 -04:00
Stefan Monnier
2c68192c6b Backward compatibility with pre-existing struct instances.
* lisp/emacs-lisp/cl-lib.el (cl--old-struct-type-of): New function.
(cl-old-struct-compat-mode): New minor mode.

* lisp/emacs-lisp/cl-macs.el (cl-defstruct): Pass `record' to
cl-struct-define to signal use of record objects.

* lisp/emacs-lisp/cl-preloaded.el (cl--struct-get-class,
cl-struct-define): Enable legacy defstruct compatibility.

* test/lisp/emacs-lisp/cl-lib-tests.el (cl-lib-old-struct,
old-struct): New tests.

* doc/lispref/elisp.texi, doc/lispref/records.texi: Document
`old-struct-compat'.
2017-04-04 08:23:46 +02:00
Stefan Monnier
8e6f204f44 Make EIEIO use records.
* lisp/emacs-lisp/eieio-compat.el
(eieio--generic-static-object-generalizer): Adjust to new tags.

* lisp/emacs-lisp/eieio-core.el: Use records, and place the class object
directly as tag.
(eieio--object-class): Adjust to new tag representation.
(eieio-object-p): Rewrite, and adapt to new `type-of' behavior.
(eieio-defclass-internal): Use `make-record'.
(eieio--generic-generalizer): Adjust generalizer code accordingly.

* lisp/emacs-lisp/eieio.el (make-instance, clone): Use copy-record.

* lisp/emacs-lisp/pcase.el (pcase-mutually-exclusive-predicates):
Add `recordp'.

* doc/lispref/records.texi, doc/misc/eieio.texi: Update for records.
2017-04-04 08:23:46 +02:00
Lars Brinkhoff
0565482838 Make cl-defstruct use records.
* lisp/emacs-lisp/cl-extra.el (cl--describe-class)
(cl--describe-class-slots): Use the new `type-of'.

* lisp/emacs-lisp/cl-generic.el (cl--generic-struct-tag): Use type-of.
(cl--generic-struct-specializers): Adjust to new tag.

* lisp/emacs-lisp/cl-macs.el (cl-defstruct): When type is nil, use records.
Use the type symbol as the tag.  Use copy-record to copy structs.
(cl--defstruct-predicate): New function.
(cl--pcase-mutually-exclusive-p): Use it.
(cl-struct-sequence-type): Can now return `record'.

* lisp/emacs-lisp/cl-preloaded.el (cl--make-slot-desc): Adjust ad-hoc
code to new format.
(cl--struct-register-child): Work with records.
(cl-struct-define): Don't touch the tag's symbol-value and
symbol-function slots when we use the type as tag.

* lisp/emacs-lisp/cl-print.el (cl-print-object): Adjust to new tag.

* test/lisp/emacs-lisp/cl-lib-tests.el (cl-lib-defstruct-record):
New test.

* doc/lispref/records.texi, doc/misc/cl.texi: Update for records.
2017-04-04 08:23:46 +02:00
Noam Postavsky
7d27f5d8f4 * lisp/emacs-lisp/ert.el (ert-run-tests): Make INTERACTIVE arg optional. 2017-03-28 09:44:24 -04:00
Paul Eggert
55086ef651 Fix obsolete ‘test/automated’ references
* Makefile.in (mostlyclean, clean, maybeclean_dirs, distclean)
(bootstrap-clean, maintainer-clean):
Clean ‘test’, not ‘test/automated’.  Test for existence of
subdirectory only for ‘test’, not for directories that should
always exist.
* admin/MAINTAINERS, etc/TODO, lisp/emacs-lisp/bytecomp.el:
* lisp/emacs-lisp/seq.el, lisp/emacs-lisp/thunk.el:
* lisp/man.el (Man-parse-man-k):
* lisp/url/url-domsuf.el, make-dist:
* test/file-organization.org:
Fix obsolete references to test/automated.
2017-03-27 11:30:08 -07:00
Paul Pogonyshev
9278d904af * lisp/emacs-lisp/pcase.el (pcase): Comment debug message (Bug#26177). 2017-03-25 19:28:22 -04:00
Jens Uwe Schmidt
5f6ef7cba8 Stop edebug getting stuck on backquote (Bug#23651)
* lisp/emacs-lisp/edebug.el (edebug-read-sexp): Move forward after
reading backquote or comma.

Copyright-paperwork-exempt: yes
2017-03-25 14:38:29 -04:00
Helmut Eller
ef44346782 Make it easier to abort a series of tests with C-g
* emacs-lisp/ert.el (ert-run-tests): Add "interactively" arg.  If
interactively is true and a test was aborted then ask if the remaining
tests should be aborted too.
(ert-run-tests-batch, ert-run-tests-interactively): Pass in
interactively arg.
2017-03-24 20:13:17 -04:00
Stefan Monnier
e69a5f5e45 * lisp/emacs-lisp/lisp-mode.el: Don't highlight \( at BOL
(elisp--font-lock-backslash): Extract from lisp-el-font-lock-keywords-2.
Don't highlight \ at BOL.  Don't assume syntax-ppss preserves match-data.
2017-03-24 09:39:34 -04:00
Graham Dobbins
bcb6c7b7cd * lisp/emacs-lisp/lisp-mode.el (indent-sexp): Fix null endpos case
Copyright-paperwork-exempt: yes
2017-03-21 20:45:31 -04:00
Paul Eggert
e6fd84d2d5 Merge from origin/emacs-25
ab0a60a ; * CONTRIBUTE (Generating ChangeLog entries): Drop duplicate...
7e02a47 Index byte-compile-debug
7c1e598 Document `byte-compile-debug' in the ELisp manual
4d81eb4 Document variable `byte-compile-debug'
72ef710 Fix call to debugger on assertion failure
ae8264c Call modification hooks in org-src fontify buffers
b3139da ; Fix last change in doc/lispref/strings.texi
c331f39 Improve documentation of 'format' conversions
9f52f67 Remove stale functions from ert manual
c416b14 Fix a typo in Eshell manual
06695a0 ; Fix a typo in ediff-merg.el
954e9e9 Improve documentation of hooks related to saving buffers
9fcab85 Improve documentation of auto-save-visited-file-name
2236c53 fix typo in mailcap-mime-extensions
85a3e4e Fix typos in flymake.el
a1ef10e More NEWS checking for admin.el's set-version

# Conflicts:
#	lisp/emacs-lisp/bytecomp.el
2017-03-19 12:29:06 -07:00
Paul Eggert
59ced4521e Merge from origin/emacs-25
5569e64 ; Spelling fixes
24a5f57 * lisp/net/eww.el (eww-tag-meta): Handle single quoted URLs (...
9b89896 * lisp/progmodes/sql.el (sql-product-alist): Doc tweak
69b50f5 * lisp/progmodes/sql.el (sql-product-alist): Doc fix.  (Bug#2...
42eae54 Improve documentation of dabbrevs
b0ade0d Clarify that easy-menu-add is a nop (Bug#25382)
3c69f2c * lisp/textmodes/rst.el (rst-package-emacs-version-alist): Fi...

# Conflicts:
#	lisp/textmodes/rst.el
2017-03-19 12:27:55 -07:00
Paul Pogonyshev
0d112c00ba Fix bug in generator function with pcase (Bug#26068)
* lisp/emacs-lisp/cl-macs.el (cl--sm-macroexpand): Remove some calls
to symbol-name.
2017-03-19 15:03:35 -04:00
Stefan Monnier
06a7963986 Remove unused vars in cl-extra.el and tramp.el.
* lisp/emacs-lisp/cl-extra.el (cl--print-table): Remove unused vars.

* lisp/net/tramp.el (tramp-dissect-file-name): Remove unused `match'.
(outline-regexp, ls-lisp-use-insert-directory-program): Declare.
(tramp-find-foreign-file-name-handler): Mark unused arg, remove unused `v`.
2017-03-18 22:32:23 -04:00
Stefan Monnier
32bb5a945a Improve describe-symbol's layout of slots when describing types
* lisp/emacs-lisp/cl-extra.el (cl--print-table): New function.
(cl--describe-class-slots): Use it.
2017-03-18 21:24:39 -04:00
Stefan Monnier
94b59f7dd1 * lisp/emacs-lisp/cl-print.el (cl-print-compiled): New variable
(cl-print-object) <compiled-function>: Print the docstring and
interactive form.  Obey cl-print-compiled.
2017-03-12 22:09:02 -04:00
Noam Postavsky
cf670b49a7 Fix indent-sexp when called from inside a string (Bug#21343)
* lisp/emacs-lisp/lisp-mode.el (indent-sexp): Get initial syntax parse
state from `syntax-ppss'.
2017-03-12 20:08:32 -04:00
Noam Postavsky
3ee3995d10 * lisp/emacs-lisp/lisp-mode.el (indent-sexp): Simplify.
* test/lisp/emacs-lisp/lisp-mode-tests.el (indent-sexp):
(indent-subsexp, indent-sexp-in-string): New tests.
2017-03-12 20:08:32 -04:00
Stefan Monnier
1b42453367 Use switch on pseudovector types; plus cleanups along the way
* src/lisp.h (PSEUDOVECTOR_TYPE): New function, extracted from mark_object.
(PSEUDOVECTOR_TYPEP): Change type of `code'.

* src/alloc.c (sweep_vectors): Remove out-of-date assertion.
(mark_object): Use PSEUDOVECTOR_TYPE.

* src/data.c (Ftype_of): Use switch on pvec type.

* src/print.c (print_object): Use switch on pvec type.

* lisp/emacs-lisp/cl-generic.el (cl--generic-typeof-types):
Add recently added types.
2017-03-12 17:44:13 -04:00
Stefan Monnier
46fcaf3361 Improve last change
* lisp/emacs-lisp/lisp-mode.el (lisp-el-font-lock-keywords-2):
Use ppss to check escaping and add help-echo.
2017-03-11 16:36:23 -05:00
Stefan Monnier
4086d850dc Highlight useless backslashes in Elisp strings
* lisp/emacs-lisp/lisp-mode.el (lisp-el-font-lock-keywords-2):
Put warning face on backslashes that have no effect.
2017-03-11 11:35:14 -05:00
Vibhav Pant
092071345f Byte compile cond clauses without any bodies correctly.
* lisp/emacs-lisp/bytecomp.el (byte-compile-cond-jump-table): When a
cond clause has no body, push t on to the stack.
2017-03-10 00:22:35 +05:30
Stefan Monnier
1a6597660a * lisp/emacs-lisp/cl-print.el (cl-print-object): Use #f(..) for functions. 2017-03-07 20:35:40 -05:00
Phillip Lord
542a763281 Revert "Replace ldefs-boot with a much smaller file"
This reverts commit c27b645956.

This commit has been reverted because the new mechanism was too
sensitive to changes in the lisp source, generation of new ldefs-boot
files was platform specific and resulted in warnings about undefined
variables.

See also 11436e2890d.
2017-03-07 13:49:48 +00:00
Paul Eggert
788a5b8447 ; Spelling fixes 2017-03-05 08:19:06 -08:00
Tino Calancha
244de7b0ed Use lexical binding in benchmark.el
* lisp/emacs-lisp/benchmark.el: Enable lexical binding.
(benchmark-elapse): Use 'declare'.
* test/lisp/emacs-lisp/benchmark-tests.el: Add test suite.
2017-03-03 18:26:30 +09:00
Noam Postavsky
f5388ba8a7 Switch pp.el to lexical binding
Additionally, do some minor code cleanup.

* lisp/emacs-lisp/pp.el: Set lexical-binding.
(pp-buffer): Use skip-syntax-forward.
(pp-eval-expression): Use push.
(pp-last-sexp): Use with-syntax-table.
* test/lisp/emacs-lisp/pp-tests.el: New tests.
2017-03-02 23:03:20 -05:00
Chunyang Xu
55c0c3e31b Fix completing-read call in reb-change-syntax
* lisp/emacs-lisp/re-builder.el (reb-change-syntax): Use 'default' arg
of completing-read.

Copyright-paperwork-exempt: yes
2017-03-02 19:01:18 -05:00
Glenn Morris
dacafa8c30 Ert commands to error if no test at point (bug#25931)
* lisp/emacs-lisp/ert.el (ert-results-mode-menu):
Deactivate some items if no test at point.
(ert--results-test-at-point-no-redefinition):
Add option to signal an error rather than return nil.
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-results-describe-test-at-point): Error if no test at point.
2017-03-02 15:40:15 -05:00
Tino Calancha
4daca38d5c Prevent for consing in cl-mapc and cl-mapl
* lisp/emacs-lisp/cl-extra.el (cl--mapcar-many): Add optional arg ACC;
If non-nil, accumulate values in the result (Bug#25826).
(cl-mapc): Do computations inside function instead of call cl-map.
(cl-mapl): Do computations inside function instead of call cl-maplist.
* lisp/emacs-lisp/cl-lib.el (mapcar): Add autoload cookie.
Call cl--mapcar-many with non-nil 3rd argument.
* test/lisp/emacs-lisp/cl-extra-tests.el (cl-extra-test-map)
(cl-extra-test-mapc, cl-extra-test-mapcar, cl-extra-test-mapl)
(cl-extra-test-maplist): New tests.
2017-02-27 16:32:10 +09:00
Noam Postavsky
6b6cc56e72 Don't call package--ensure-init-file if initialized during startup
* lisp/emacs-lisp/package.el (package-initialize): Check
`after-init-time' rather than `load-file-name' to decide if
`package--ensure-init-file' should be called.  Depending on
`load-file-name' will fail if the user calls `pacakge-initialize' in
file which is loaded from the init file (Bug#24643, Bug#25819).
2017-02-26 11:11:40 -05:00
Stefan Monnier
91932fff1d Use cl-print for Edebug and EIEIO
* lisp/emacs-lisp/edebug.el (edebug-prin1-to-string): Use cl-print.
(edebug-prin1, edebug-print): Remove.

* lisp/emacs-lisp/eieio.el (object-print): Declare obsolete.
(cl-print-object): Add a method for EIEIO objects.
(eieio-edebug-prin1-to-string): Delete.
(edebug-prin1-to-string): Don't advise any more.

* lisp/emacs-lisp/eieio-datadebug.el (data-debug-insert-object-button):
Replace `object-print' -> `cl-prin1-to-string'.
2017-02-23 22:39:53 -05:00
Stefan Monnier
407e650413 * lisp/emacs-lisp/cl-print.el: New file
* lisp/emacs-lisp/nadvice.el (advice--where): New function.
(advice--make-docstring): Use it.

* src/print.c (print_number_index): Don't declare here any more.
(Fprint_preprocess): New function.

* test/lisp/emacs-lisp/cl-print-tests.el: New file.
2017-02-23 21:06:54 -05:00
Gemini Lasswell
8b912ab47b Support read syntax for circular objects in Edebug (Bug#23660)
* lisp/emacs-lisp/edebug.el (edebug-read-special): New name
for edebug-read-function. Handle the read syntax for circular
objects.
(edebug-read-objects): New variable.
(edebug-read-and-maybe-wrap-form1): Reset edebug-read-objects.

* src/lread.c (Fsubstitute_object_in_subtree): Make
substitute_object_in_subtree into a Lisp primitive.
2017-02-23 20:21:11 -05:00
Stefan Monnier
fb997d30af * lisp/emacs-lisp/cl-generic.el (cl--generic-typeof-types): Add `atom'
remove entries whose car can't be returned by type-of.
(cl--generic-all-builtin-types): New var.
(cl-generic-generalizers): Use it to avoid requiring
extra entries in cl--generic-typeof-types.
2017-02-21 21:47:10 -05:00
Stefan Monnier
3f1cd957ff * lisp/emacs-lisp/cl-generic.el (cl-defgeneric): Fix last change 2017-02-21 21:32:27 -05:00
Stefan Monnier
bac7de05e2 * lisp/emacs-lisp/autoload.el (make-autoload): Support cl-defgeneric
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric): Tweak for autoloading.
2017-02-21 13:51:12 -05:00
Stefan Monnier
e785c74d3a * lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): Fix duplication
which resulted in incomplete list of parents in one copy of the
cl-structure-class class.
2017-02-21 13:48:30 -05:00
Noam Postavsky
2f53c0c468 Simplify cl-get using `plist-member'
* lisp/emacs-lisp/cl-extra.el (cl-get, cl-getf, cl--set-getf): Use
`plist-member' instead of explicit loop.
* test/lisp/emacs-lisp/cl-extra-tests.el: New tests.
2017-02-20 16:53:14 -05:00
Mark Oteiza
edadd31bf4 Turn on lexical-binding in elint.el
* lisp/emacs-lisp/elint.el: Quote entry point commands in commentary.
(elint-running, elint-current-pos): Move these dynamic vars to toward
the top of the file.
(elint-check-quote-form): Ignore unused argument.
(elint-check-conditional-form): Remove unused binding.
2017-02-17 18:52:12 -05:00
Gemini Lasswell
5401820672 * lisp/emacs-lisp/subr-x.el (if-let*): Fix Edebug spec (Bug#24748) 2017-02-17 18:47:50 -05:00
Paul Eggert
cb70725584 ; Spelling, punctuation and minor wording fixes 2017-02-16 09:18:21 -08:00
Vibhav Pant
501ad54626 bytecomp.el: Avoid unnecessary calculation for jump table addresses.
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode): Don't do
  redundant operations while calculating the correct jump addresses
  from TAGs in jump tables.
2017-02-16 20:30:04 +05:30
Mark Oteiza
1b4442bee9 Don't expand body inside a let-binding when there are no bindings
* lisp/emacs-lisp/pcase.el (pcase-codegen): Only let-bind if VARS
is non-nil.
2017-02-15 20:40:46 -05:00