Commit graph

5109 commits

Author SHA1 Message Date
Vibhav Pant
19cb3985a3 * lisp/emacs-lisp/bytecomp.el:Use correct size for switch jump-table 2017-01-26 01:00:41 +05:30
Vibhav Pant
c52a9b6ddd * lisp/emacs-lisp/bytecomp.el: Simplify b-c-cond-valid-obj2-p 2017-01-26 00:58:36 +05:30
Vibhav Pant
8189b97e5c * lisp/emacs-lisp/bytecomp.el: Fix byte-switch codegen with symbols. 2017-01-26 00:57:10 +05:30
Vibhav Pant
0d3c57dcf3 * lisp/emacs-lisp/byte-opt.el: Add support for decompiling switch
* lisp/emacs-lisp/byte-opt.el: (byte-decompile-bytecode-1) When the
  constant encountered precedes a byte-switch op, replace all the
  addresses in the jump table with tags.
2017-01-26 00:54:59 +05:30
Vibhav Pant
23a130ee0d * lisp/emacs-lisp/bytecomp.el: Remove unused debugging statements. 2017-01-21 11:37:20 +05:30
Vibhav Pant
fbe6b90b0c * lisp/emacs-lisp/bytecomp.el: Fix errors with matching quoted forms
* lisp/emacs-lisp/bytecomp.el: (byte-compile-cond-jump-table-info)
  eval obj2 to avoid quoted forms being stored as is.
2017-01-19 23:13:53 +05:30
Vibhav Pant
5f3379b338 lisp/emacs-lisp/bytecomp.el: Use byte-switch only for quoted symbols 2017-01-19 23:13:13 +05:30
Vibhav Pant
46193d5209 * lisp/emacs-lisp/bytecomp.el: Add default-case for last cond clause.
* lisp/emacs-lisp/bytecomp.el: (byte-compile-cond-jump-table) Add
default-case for last cond clause.
2017-01-19 23:12:09 +05:30
Vibhav Pant
1fcbd352f8 Use byte-switch for all symbols.
* lisp/emacs-lisp/bytecomp.el: (byte-compile-cond-valid-obj2-p) Return
  t for all symbols (instead for just keywords)
2017-01-19 18:02:40 +05:30
Vibhav Pant
309b46420e * lisp/emacs-lisp/byte-opt.el: Optimize how tags are checked for use.
* byte-opt.el: (byte-optimize-lapcode): Return nil instantly on
  finding the tag in a jump table.
2017-01-15 21:38:31 +05:30
Vibhav Pant
8c0f326ea2 * lisp/emacs-lisp/bytecomp.el: Add documentation, remove code duplication 2017-01-15 19:36:26 +05:30
Vibhav Pant
88549ec38e Add new 'switch' byte-code.
'switch' takes two arguments from the stack: the variable to test, and
a jump table (implemented as a hash-table with the appropriate :test
function). By looking up the value of the variable in the hash table,
the interpreter can jump to the label pointed to by the value, if any.
This implementation can only be used for `cond' forms of the type
`(cond ((test x 'foo) 'bar) ...)`, such that the function `test` and
variable `x` is same for all clauses.

* lisp/emacs-lisp/bytecomp.el:

  * Add (byte-compile-cond-valid-obj2-p), (byte-compile-cond-vars),
    (byte-compile-cond-jump-table-info), (byte-compile-jump-table-add-tag),
    (byte-compile-cond-jump-table), byte-compile-jump-tables.

  * Add defcustom `byte-compile-cond-use-jump-table'.

  * (byte-compile-cond): Use them.

  * (byte-compile-lapcode): Patch tags present in jump tables, if any.

* lisp/emacs-lisp//byte-opt.el: (byte-optimize-lapcode): Add checks to
  some peephole optimizations to prevent them from messing up any code
  involving `byte-switch`.

* src/bytecode.c: (exec_byte_code): Add bytecode Bswitch.
2017-01-15 01:26:04 +05:30
Stefan Monnier
e28c99082a (cl-defstruct): Improve error message for slots w/o value (bug#25312)
* lisp/emacs-lisp/cl-macs.el (cl-defstruct): Don't signal an error but
emit a warning for those coders who forgot to put a default value in
their slot.
2017-01-03 16:07:44 -05:00
Paul Eggert
e6a782ee1a Update copyright year to 2017 in master
Run admin/update-copyright in the master branch.  This fixes files
that were not already fixed in the emacs-25 branch before it was
merged here.
2017-01-01 01:48:59 -08:00
Paul Eggert
bcf244ef9b Merge from origin/emacs-25
2e2a806 Fix copyright years by hand
5badc81 Update copyright year to 2017
2017-01-01 01:10:47 -08:00
Paul Eggert
4f7a90bf6c Merge from origin/emacs-25
9adb101 Document 'describe-fontset'
229315c ; Add missing symbol quoting.
3d94931 Repair desktop restoration on text terminals
43022f9 Ignore forward-sexp-function in js-mode indentation code
b19fb49 Improve documentation of 'define-coding-system'
467768f Fix Bug#25162
6db78ae Fix a typo in define-abbrev-table
5f7d906 Bump makeinfo requirement from 4.7 to 4.13
442e2f6 Fixes related to select-enable-clipboard
e4ac450 Define struct predicate before acccesors
08decbd Doc fix for vc-git
5531e75 Further improve make-dist checking
953bf67 Improve previous make-dist change
129645a Make make-dist --snapshot do some sanity checks

# Conflicts:
#	lisp/menu-bar.el
2017-01-01 01:02:45 -08:00
Alan Mackenzie
620e5a3cd4 Give eval-and-compile a correct edebug spec. Fixes bug #16184 properly.
* lisp/emacs-lisp/edebug.el (edebug_offset_indices): Revert abortive commit
from Thu Dec 29 09:22:36 2016 +0000 which didn't really fix the bug.

* lisp/emacs-lisp/byte-run.el (eval-and-compile): Change the edebug spec from
t to (&rest def-form).
2017-01-01 08:28:04 +00:00
Paul Eggert
2e2a806803 Fix copyright years by hand
These are dates that admin/update-copyright did not update, or
updated incorrectly.
2017-01-01 04:01:41 +00:00
Paul Eggert
5badc81c1c Update copyright year to 2017
Run admin/update-copyright.
2016-12-31 19:42:26 -08:00
Philipp Stephani
4bbd5424a2 Checkdoc: use syntax functions instead of regex
In checkdoc.el, get rid of the error-prone regex to find definition
forms, and use existing syntax-based navigation functions instead.
This fixes a corner case with one-argument `defvar' forms.

* lisp/emacs-lisp/checkdoc.el (checkdoc--next-docstring): New function.
(checkdoc-next-docstring, checkdoc-defun): Use it.
* test/lisp/emacs-lisp/checkdoc-tests.el (checkdoc-tests--next-docstring):
Add unit test.
2016-12-31 17:30:46 +01:00
Alan Mackenzie
0d19e69184 Initialize edebug-offset-indices to a cons, not nil. Fixes bug #16184.
This is because there are times when this variable is changed by setcar before
an atom is pushed onto it by debug-enter.  This happens, for example, whilst
instrumenting c-font-lock-declarations in .../lisp/progmodes/cc-fonts.el.

* lisp/emacs-lisp/edebug.el (edebug-offset-indices): initialize to '(0).
2016-12-29 09:22:36 +00:00
Stefan Monnier
af1b1026dd * lisp/emacs-lisp/inline.el: Fix apply-conversion (bug#25280)
(inline--dont-quote): Quote the function with #' when passing it to `apply'.
Cherry picked from commit e6161f6489.
2016-12-28 11:50:02 -05:00
Stefan Monnier
e6161f6489 * lisp/emacs-lisp/inline.el: Fix apply-conversion (bug#25280)
(inline--dont-quote): Quote the function with #' when passing it to `apply'.
2016-12-27 12:44:32 -05:00
Philipp Stephani
65b997b95e Checkdoc: Don't require a space before an arg list
See Bug#24998.

* lisp/emacs-lisp/checkdoc.el (checkdoc-defun-regexp): Don't require a
space before a argument list.
* test/lisp/emacs-lisp/checkdoc-tests.el (checkdoc-tests--bug-24998):
Add unit test.
2016-12-26 21:13:26 +01:00
Stefan Monnier
a6063ffe5a * src/data.c (Fmake_variable_frame_local): Remove
* src/lisp.h (struct Lisp_Buffer_Local_Value): Remove `frame_local'.

* src/data.c (swap_in_symval_forwarding, set_internal)
(set_symbol_trapped_write, make_blv, Fmake_variable_buffer_local)
(Fmake_local_variable, Fkill_local_variable, Flocal_variable_p):
Don't pay attention to ->frame_local any more.
(syms_of_data): Remove Qtrapping_frame_local and don't defsubr
Smake_variable_frame_local.

* etc/NEWS (Incompatible Lisp Changes in Emacs 26.1): Announce removal
of make-variable-frame-local.

* lisp/help-fns.el (describe-variable): Don't handle the now impossible
frame-local case.

* lisp/subr.el (make-variable-frame-local): Remove obsolescence data.

* src/frame.c (store_frame_param):
* src/eval.c (specbind): Don't pay attention to ->frame_local any more.

* src/widget.c (first_frame_p): Remove, unused.
2016-12-21 15:07:43 -05:00
Noam Postavsky
a7523ba955 Fix rx-any with range with ?\] and ?-
* lisp/emacs-lisp/rx.el: Make sure not to produce a circular
list (Bug#25123).
* test/lisp/emacs-lisp/rx-tests.el (rx-char-any): New test.
2016-12-18 08:44:45 -05:00
Nicolas Petton
fb2fdb1435 Make seq-into return the sequence when no conversion needed
* lisp/emacs-lisp/seq.el (seq-into): Do not convert the sequence when
  no conversion is needed.
* test/lisp/emacs-lisp/seq-tests.el (test-seq-into-and-identity): Add
  a regression test checking for identity.
2016-12-16 11:22:00 +01:00
Nicolas Petton
09a66ceb5e Fix circular list handling in seq-mapn
* lisp/emacs-lisp/seq.el (seq-mapn): Do not copy list arguments.
* test/lisp/emacs-lisp/seq-tests.el (test-seq-mapn-circular-lists):
  Add a regression test.
2016-12-15 10:26:11 +01:00
Phillip Lord
c27b645956 Replace ldefs-boot with a much smaller file
* Makefile.in (bootstrap-build,generate-ldefs-boot): New targets.
   (bootstrap): Depend on bootstrap-build.
 * admin/ldefs-clean.el: New file.
 * lisp/Makefile.in (compile-first): Depend on loaddefs.el
 * lisp/ldefs-boot.el: Remove.
 * lisp/ldefs-boot-auto.el: New file.
 * lisp/ldefs-boot-manual.el: New file.
 * lisp/loadup.el: Load ldefs-boot-manual.el.
 * src/emacs.c (generating_ldefs_boot): New variable.
   (main): Check whether we are generating ldefs.
 * src/eval.c (autoload-do-load): Dump autoload forms to stderr when
   requested.
 * src/lisp.h (generating_ldefs_boot): New variable.
 * admin/gitmerge.el, admin/make-tarball.txt, admin/notes/copyright,
   lisp/Makefile.in, lisp/cus-dep.el, lisp/emacs-lisp/elint.el,
   lisp/finder.el, lisp/loadup.el, msdos/mainmake.v2: Update reference to
   ldefs-boot.
 * admin/update_autogen: Alter mechanism for ldefs-boot generation.
2016-12-13 22:15:32 +00:00
Glenn Morris
8db7b65d66 Minor fix for define-derived-mode
* lisp/emacs-lisp/derived.el (define-derived-mode):
Do not let eg eval-defun reset the values of syntax or abbrev tables,
since they might have been defined externally.  (Bug#16160)
2016-12-12 20:03:20 -05:00
Clément Pit--Claudel
27cada035a Move backtrace to ELisp using a new mapbacktrace primitive
* src/eval.c (get_backtrace_starting_at, backtrace_frame_apply)
(Fmapbacktrace, Fbacktrace_frame_internal): New functions.
(get_backtrace_frame, Fbacktrace_debug): Use `get_backtrace_starting_at'.

* lisp/subr.el (backtrace--print-frame): New function.
(backtrace): Reimplement using `backtrace--print-frame' and `mapbacktrace'.
(backtrace-frame): Reimplement using `backtrace-frame--internal'.

* lisp/emacs-lisp/debug.el (debugger-setup-buffer): Pass a base to
`mapbacktrace' instead of searching for "(debug" in the output of
`backtrace'.

* test/lisp/subr-tests.el (subr-test-backtrace-simple-tests)
(subr-test-backtrace-integration-test): New tests.

* doc/lispref/debugging.texi (Internals of Debugger): Document
`mapbacktrace' and missing argument BASE of `backtrace-frame'.
2016-12-12 17:41:27 -05:00
Glenn Morris
61f8c2386c Minor advice.el fix
* lisp/emacs-lisp/advice.el (ad-preactivate-advice):
Avoid setting the function definition of nil.
This was happening during bootstrap of org-compat.el,
apparently due to eager macro expansion of code behind
a (featurep 'xemacs) test.
2016-12-12 15:20:39 -05:00
Glenn Morris
ba8e883fa3 Do not allow nil to be defined as a function
* lisp/emacs-lisp/byte-run.el (defun):
* src/data.c (Ffset): Do not allow "nil".  (Bug#25110)
2016-12-10 18:58:24 -08:00
Nicolas Richard
0107336165 Add some sanity checking of defun arglist
* lisp/emacs-lisp/byte-run.el (defun):
Check for malformed argument lists.  (Bug#15715)
2016-12-10 17:48:10 -08:00
Noam Postavsky
e4ac450796 Define struct predicate before acccesors
The accessor functions use the predicate function, which causes problems
when reloading after unload-feature: the compiler-macro property is
still present on the predicate symbol, and the compiler fails to find
the definition when trying to inline it into the accessor
function (Bug#25088).

* lisp/emacs-lisp/cl-macs.el (cl-defstruct): Move predicate definition
before field accessor definitions.
2016-12-10 16:00:01 -05:00
Glenn Morris
a6776f0823 Retain message logging in map-y-or-n-p
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
Stop disabling logging to Messages buffer.  (Bug#13326)
2016-12-07 20:25:36 -05:00
Paul Eggert
c102a84a48 Merge from origin/emacs-25
35ce3fb Don't assume window-point and point are the same
2016-12-07 12:41:05 -08:00
Philipp Stephani
da71c89ba3 * lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Fix docstring
so that it matches the actual implementation.
See https://lists.gnu.org/archive/html/help-gnu-emacs/2016-04/msg00071.html
2016-12-07 13:58:57 +01:00
Nicolas Petton
05e773a460
Docstring improvement for seq-some (bug#25129)
* lisp/emacs-lisp/seq.el (seq-some): Make the docstring less confusing
  regarding the returned value.
2016-12-07 13:32:46 +01:00
Noam Postavsky
35ce3fb141 Don't assume window-point and point are the same
The function `cursor-sensor--detect' calls `bobp' to decide whether to
check properties at (1- (window-point)).  However, (window-point) may be
at beginning of buffer, even if (point) is not.  In this case an
`args-out-of-range' error will be signaled (Bug#25104).

* lisp/emacs-lisp/cursor-sensor.el (cursor-sensor--detect): Check the
value of (window-point) against (point-min), rather than (bobp) to
decide if (1- (window-point)) is accessible.
2016-12-06 22:36:12 -05:00
Noam Postavsky
58e418d2ce Fix ert-tests when running compiled
* test/lisp/emacs-lisp/ert-tests.el (ert-test-deftest): Don't test for
specific macroexpansion, just check result of evaluation.
(ert-test-record-backtrace): Don't hardcode representation of closure in
expected backtrace, this lets the test succeed even when the test code
is compiled.

* lisp/emacs-lisp/ert.el (ert--expand-should-1): Also pass
`byte-compile-macro-environment' to `macroexpand', this allows the
`should' macro to properly handle macroexpansion of macros that were
defined in the same file when it's being compiled (Bug #17851).
2016-12-06 22:20:23 -05:00
Glenn Morris
c387127fee Fix markup in read-multiple-choice doc (Bug#25102)
* lisp/emacs-lisp/subr-x.el (read-multiple-choice): Doc fix.
2016-12-03 18:14:53 -08:00
Noam Postavsky
cfd2b9eae1 Add function to trigger debugger on variable write
* lisp/emacs-lisp/debug.el (debug-on-variable-change):
(debug--variable-list):
(cancel-debug-on-variable-change): New functions.
(debugger-setup-buffer): Add watchpoint clause.
2016-12-02 20:25:14 -05:00
Tino Calancha
acb5589fcd * lisp/emacs-lisp/subr-x.el (hash-table-keys, hash-table-values): Use cl-loop. 2016-11-26 12:03:25 +09:00
Mark Oteiza
fc01cfc82d Add "using" to cl-loop debug spec (Bug#24750)
* lisp/emacs-lisp/cl-macs.el (cl-loop): Add element to account for
"using" hash table clause.
2016-11-25 14:17:35 -05:00
Tino Calancha
27b754cb44 buff-menu: Add command to unmark all buffers
Bind 'U' in buff-menu, bs and electric-buff-menu to commands
to unmark all buffers (Bug#24880).
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-header-overlay-p):
New predicate; return non-nil if tabulated-list has a fake header.
* lisp/buff-menu.el (Buffer-menu-unmark-all-buffers):
New command; remove all flags that use a particular mark from all the lines.
Bind it to 'M-DEL'.
(Buffer-menu-unmark-all):
New command; remove all flags from all the lines.  Bind it to 'U'.
(Buffer-menu-marker-char, Buffer-menu-del-char): New variables.
(Buffer-menu-delete, Buffer-menu-mark): Use them.
(Buffer-menu-mode-map): Update menus.
(Buffer-menu-mode): Update mode doc.
* lisp/bs.el (bs-unmark-all, bs-unmark-previous): New commands.
(bs-mode-map): Bind them to 'U' and '<backspace>' respectively.
(bs-mode): Update mode doc.
* lisp/ebuff-menu.el (electric-buffer-menu-mode-map):
Bind Buffer-menu-unmark-all to 'U' and Buffer-menu-unmark-all-buffers
to 'M-DEL'.
(bs--down, bs-down, bs--up, bs-up, bs-unmark-current, bs-mark-current):
Use point instead of cursor in doc string.
(electric-buffer-list): Update mode doc.
* doc/emacs/buffers.texi (Several Buffers): Mention Buffer-menu-unmark-all
and Buffer-menu-unmark-all-buffers.
; * etc/NEWS: Add an entry per each new feature.
2016-11-22 15:23:50 +09:00
Paul Eggert
c61ee94959 Merge from origin/emacs-25
4af5981 Add a comment in generated refcards about the source
ef880a5 ; * etc/refcards/calccard.tex: Remove obsolete comment.
4887e7c js-mode: Fix indent problem after a regexp
e992ac0 Fix sluggish display of symbols in UTF-8 language environment
1fc101b Don't confuse how Texinfo outputs @var with the input
91aa5d1 * doc/lispref/display.texi (Scroll Bars): * doc/lispref/frame...
f758fcd * doc/emacs/cmdargs.texi (Initial Options): Copyedit for --da...
5b0cddd More fixes in copyright notices in etc/refcards/
f994c20 Update copyright text in refcards
9ad2ae7 Fix Outline command names
26c3554 Send text received by bracketed paste to process
db0b58d Correct the statement about programming modes always running ...
78aece4 Improve documentation of 'occur'
eb364fd Do call debugger on failed cl-assert
3ef4ee8 Avoid infloop in python
8da810f Don't refer to obsolete FEATURE-unload-hook
4f478ca Improve documentation of dabbrevs
7272e5d * lisp/chistory.el (list-command-history): Doc fix.  (Bug#24890)
89b7482 * lisp/simple.el (set-mark-command): Doc fix.  (Bug#24890)
3b199f7 Improve documentation of some Help commands
93d3a0e Fix documentation of yes-or-no prompts
af04919 Fix documentation of partial completion style
ed80184 Fix documentation of the mode line on emacsclient frames
e6be855 Fix description of 'C-z' in User manual
16f7007 Improve and clarify documentation of Outline Mode
31d93aa Add Emacs version number to nt/README.W32
0b6b815 Fix python-mode hideshow regexp
dc152c5 Modernize usage of 'macOS' in doc and comments
84c5343 Prefer comments /* like this */ in C code
bb61e50 * doc/lispref/loading.texi (Autoload): Better link (Bug#24845).
3ef86fd Clarify documentation of face attribute functions
de51d59 ; * nt/README.W32: Minor copyedits.
db436e9 Don't call debug on failed cl-assert

# Conflicts:
#	doc/emacs/cmdargs.texi
#	etc/NEWS
#	etc/PROBLEMS
#	lisp/auth-source.el
#	lisp/net/tramp-sh.el
2016-11-19 14:31:05 -08:00
Philipp Stephani
0d913da15c Prevent dubious argument lists
See Bug#24912 and Bug#24913.

* src/eval.c (funcall_lambda): Detect more dubious argument lists.
* lisp/emacs-lisp/bytecomp.el (byte-compile-check-lambda-list): Detect
more dubious argument lists.
* test/src/eval-tests.el (eval-tests--bugs-24912-and-24913): Add unit
test.
2016-11-18 18:02:57 +01:00
Glenn Morris
67df076793 ; Replace "25.2" with "26.1" where appropriate, which is almost everywhere
Ref:
http://lists.gnu.org/archive/html/emacs-devel/2016-09/msg00692.html
http://lists.gnu.org/archive/html/emacs-devel/2016-01/msg01215.html
2016-11-17 22:50:40 -08:00
Tino Calancha
5ffdbe0a5e Update parameter :version to 26.1 in several defcustom
Following defcustom where added or modified for 25.2 release.
In fact all these changes belong to 26.1 release.
* lisp/battery.el (battery-linux-sysfs-regexp)
* lisp/comint.el (comint-password-prompt-regexp)
* lisp/dired.el (dired-always-read-filesystem)
* lisp/image.el (image-scaling-factor)
* lisp/ibuf-ext.el (ibuffer-never-search-content-name)
(ibuffer-never-search-content-mode)
* lisp/mouse.el (mouse-select-region-move-to-beginning)
* lisp/net/net-utils.el (iwconfig-program, iwconfig-program-options)
(netstat-program, route-program, route-program-options)
* lisp/net/sieve-manage.el (sieve-manage-default-stream)
* lisp/progmodes/grep.el (grep-save-buffers)
* lisp/vc/add-log.el (change-log-directory-files)
* lisp/url/url-vars.el (url-user-agent)
* lisp/vc/vc-hg.el (vc-hg-symbolic-revision-styles)
(vc-hg-use-file-version-for-mode-line-version)
(vc-hg-parse-hg-data-structures)
* lisp/wdired.el (wdired-create-parent-directories)
* lisp/faces.el (homoglyph, nobreak-hyphen, read-multiple-choice-face)
* lisp/gnus/gnus-art.el (gnus-article-encrypt-protocol)
(gnus-button-url-regexp)
* lisp/window.el (switch-to-buffer-preserve-window-point)
* lisp/ibuffer.el (ibuffer-formats, ibuffer-locked-char)
(ibuffer-locked-buffer)
* lisp/textmodes/flyspell.el (flyspell-sort-corrections-function)
* lisp/emacs-lisp/edebug.el (edebug-sit-on-break)
* lisp/gnus/message.el (message-user-fqdn)
* lisp/simple.el (shell-command-dont-erase-buffer)
(extended-command-suggest-shorter)
* lisp/net/shr.el (shr-use-fonts)
* lisp/files.el (mounted-file-systems, kill-emacs-query-functions)
2016-11-17 00:39:43 +09:00