Stefan Monnier [Fri, 24 Feb 2017 03:39:53 +0000 (22:39 -0500)]
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.
Stefan Monnier [Fri, 24 Feb 2017 02:17:04 +0000 (21:17 -0500)]
Minor redisplay optimisations
* src/frame.c (Ficonify_frame): No need to redisplay everything.
* src/xdisp.c (overlay_arrows_changed_p): Add `set_redisplay' argument.
(redisplay_internal): Use it to avoid redisplaying everything.
(try_window_id): Use it keep the same behavior as before.
Gemini Lasswell [Fri, 17 Feb 2017 06:08:03 +0000 (22:08 -0800)]
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.
Mark Oteiza [Thu, 23 Feb 2017 18:14:44 +0000 (13:14 -0500)]
Declare dun-line and dun-line-list
Previously, there were free variables 'line' and 'line-list'.
* lisp/play/dunnet.el (dun-line, dun-line-list): New variables.
(dun-press, dun-vparse, dun-parse2, dun-unix-parse, dun-batch-parse):
(dun-batch-parse2, dun-batch-loop, dun-batch-dos-interface):
(dun-batch-unix-interface): Use them.
Paul Eggert [Thu, 23 Feb 2017 16:58:39 +0000 (08:58 -0800)]
hexl: handle large files and I/O errors
* lib-src/hexl.c: Include inttypes.h, for PRIxMAX etc.
Do not include ctype.h, as the code no longer uses isdigit.
(DEFAULT_GROUPING, un_flag, iso_flag, group_by): Now local to ‘main’.
(DEFAULT_BASE, endian): Remove; was not really used.
(usage): Remove; now done by ‘main’, as that’s simpler.
(progname): Now static.
(output_error, hexchar): New functions.
(main): Use them. Simplify. Remove "-oct", "-big-endian", and
"-little-endian" options, as they did not work and were not used.
Use SET_BINARY only on stdin, and fopen with "rb" otherwise.
Use SET_BINARY only once on stdout.
Do not assume file offsets fit in ‘long’.
If an I/O error occurs, report it and exit with nonzero status.
Eli Zaretskii [Thu, 23 Feb 2017 16:15:05 +0000 (18:15 +0200)]
Avoid quitting inside a critical section on MS-Windows
* src/w32uniscribe.c (uniscribe_list_family):
* src/w32font.c (w32font_list_family, w32font_text_extents)
(w32font_list_internal, w32font_match_internal)
(list_all_matching_fonts): Prevent quitting while these functions
cons lists of fonts, to avoid leaving the critical section taken
by the main thread, which will then cause any other thread
attempting to enter the critical section to hang. (Bug#25279)
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.
Noam Postavsky [Wed, 22 Feb 2017 02:31:24 +0000 (21:31 -0500)]
Find macro binding for symbol-bound macros too (Bug#6848)
There are 2 ways to bind a macro: with global-set-key or
kmacro-bind-to-key. The former binds a key to a symbol, while the
latter binds to a lambda. In 2010-03-03 "Fix keyboard macro key
lookup (Bug#5481)", `insert-kbd-macro' was fixed to detect the lambda
case, but broke the symbol case.
* lisp/macros.el (insert-kbd-macro): Also check for bindings of
MACRONAME.
Paul Eggert [Tue, 21 Feb 2017 23:31:29 +0000 (15:31 -0800)]
Minor weak hash table performance tweaks
* src/fns.c (make_hash_table): Omit unnecessary assignment to
h->next_weak when the hash table is not weak.
(copy_hash_table): Put the copy next to the original in the
weak_hash_tables list, as this should have better locality
when scanning the weak hash tables.
Paul Eggert [Tue, 21 Feb 2017 23:31:29 +0000 (15:31 -0800)]
Use float instead of Lisp_Object for rehash_size
* src/alloc.c (purecopy_hash_table):
* src/fns.c (maybe_resize_hash_table, Fmake_hash_table):
(Fhash_table_rehash_size):
* src/lisp.h (struct Lisp_Hash_Table.rehash_size):
The rehash_size member of struct Lisp_Hash_Table is now a
float, not a Lisp_Object.
* src/alloc.c (purecopy_hash_table): Assign members in order.
* src/fns.c (make_hash_table): Use EMACS_INT for size and
float for rehash_size, instead of Lisp_Object for both.
All callers changed.
* src/lisp.h (DEFAULT_REHASH_SIZE): Now float, not double,
and 1 smaller.
* src/print.c (print_object): Simplify by calling
Fhash_table_rehash_size and Fhash_table_rehash_threshold.
Avoid unnecessary NILP.
Paul Eggert [Tue, 21 Feb 2017 23:31:29 +0000 (15:31 -0800)]
Use ptrdiff_t instead of Lisp_Object for collision
* src/alloc.c (purecopy_hash_table): Assign, don’t purecopy.
* src/fns.c (set_hash_next_slot, set_hash_index_slot): Hash index
arg is now ptrdiff_t index (or -1 if empty), not Lisp_Object
integer (or Qnil if empty). All callers changed.
(larger_vecalloc): New static function.
(larger_vector): Use it.
(HASH_NEXT, HASH_INDEX): Move here from lisp.h. Return ptrdiff_t
index (or -1) not Lisp_Object integer (or Qnil). All callers changed.
* src/fns.c (make_hash_table, maybe_resize_hash_table, hash_lookup)
(hash_put, hash_remove_from_table, hash_clear, sweep_weak_table):
* src/profiler.c (evict_lower_half, record_backtrace):
-1, not nil, is now the convention for end of collision list.
* src/fns.c (maybe_resize_hash_table): Avoid double-initialization
of the free list. Reallocate H->next last, in case other
reallocations exhaust memory.
* src/lisp.h (struct Lisp_Hash_Table): ‘next_free’ is now
ptrdiff_t, not Lisp_Object. Adjust commentary for ‘next’ and
‘index’, which no longer contain nil.
(HASH_NEXT, HASH_INDEX): Move to src/fns.c.
Paul Eggert [Tue, 21 Feb 2017 23:31:29 +0000 (15:31 -0800)]
Hash table threshold is now float, not double
Change default from 0.8 to 0.8125 so it fits in float without
rounding glitches.
* doc/lispref/hash.texi (Creating Hash):
* doc/lispref/objects.texi (Hash Table Type):
* etc/NEWS:
Document change.
* src/fns.c (make_hash_table, maybe_resize_hash_table)
(Fmake_hash_table): Threshold is now float, not double.
Be consistent about how this is rounded.
* src/lisp.h (struct Lisp_Hash_Table.rehash_threshold):
Change back to float, now that the other code rounds consistently.
(DEFAULT_REHASH_THRESHOLD): Now float 0.8125 instead of double 0.8.
Juri Linkov [Tue, 21 Feb 2017 23:22:18 +0000 (01:22 +0200)]
Avoid flicker in lazy-highlight by doing all updates without redisplay.
* lisp/isearch.el (lazy-highlight-max-at-a-time):
Change default value from 20 to nil to not trigger redisplay
between updating iterations.
(lazy-highlight-cleanup): New arg ‘procrastinate’ to not remove
overlays when non-nil.
(isearch-lazy-highlight-new-loop): Call lazy-highlight-cleanup
with non-nil second arg when the search string is not empty.
Run timer with isearch-lazy-highlight-start instead of
isearch-lazy-highlight-update.
(isearch-lazy-highlight-start): New function. (Bug#25751)
Mark Oteiza [Tue, 21 Feb 2017 02:00:32 +0000 (21:00 -0500)]
Make dunnet insertion functions n-ary
* lisp/play/dunnet.el (dun-mprinc, dun-mprincl, dun-minsert):
(dun-minsertl, dun-batch-mprinc, dun-batch-mprincl): Change to accept
any number of arguments.
(dun-parse, dun-describe-room, dun-quit, dun-inven, dun-shake):
(dun-take, dun-go, dun-move, dun-press, dun-score):
(dun-compile-save-out, dun-do-logfile): Collect arguments from
multiple insertion calls into less calls with more args.
Noam Postavsky [Fri, 5 Aug 2016 23:59:52 +0000 (19:59 -0400)]
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.
Paul Eggert [Mon, 20 Feb 2017 16:53:50 +0000 (08:53 -0800)]
Port xwidget to -DCHECK_LISP_OBJECT_TYPE
* src/xwidget.c (webkit_javascript_finished_cb)
(Fxwidget_webkit_execute_script): Don't assume Lisp_Object is an
integer. This fix is just a hack; I’ll file a bug report about
the underlying problem.
Mark Oteiza [Mon, 20 Feb 2017 02:31:22 +0000 (21:31 -0500)]
Replace nested ifs with cond
* lisp/play/dunnet.el (dun-messages, dun-describe-room, dun-examine):
(dun-eat, dun-put-objs, dun-turn, dun-press, dun-ls, dun-cd): Use when
and cond where appropriate.
(dun-sauna-heat): Accept sauna level as an argument. Use cond.
(dun-take): Use null and dun-mprincl.
(dun-inven-weight, dun-load-d): Reformat.
(dun-remove-obj-from-inven, dun-remove-obj-from-room): Nix setq to nil.
Paul Eggert [Sun, 19 Feb 2017 20:22:33 +0000 (12:22 -0800)]
Fix glitches in recent hash table changes
* src/fns.c (Fmake_hash_table): Simplify the machine code slightly
by using 0 rather than -1.
* src/lisp.h (struct Lisp_Hash_Table.pure): Now bool rather
than a bitfield, for speed (the bitfield did not save space).
(struct Lisp_Hash_Table.rehash_threshold): Now double rather than
float, since the float caused unwanted rounding errors, e.g.,
(hash-table-rehash-threshold (make-hash-table)) yielded
0.800000011920929 instead of the correct 0.8.
Eli Zaretskii [Sun, 19 Feb 2017 16:32:51 +0000 (18:32 +0200)]
Avoid aborts during loadup
* src/emacs-module.c (syms_of_module):
* src/image.c (xpm_make_color_table_h): Update calls to
make_hash_table to adjust to a recent change in fns.c.
* src/fns.c (make_hash_table):
* src/lisp.h (make_hash_table): 4th arg is now of type double.
Mark Oteiza [Wed, 18 Jan 2017 03:05:48 +0000 (22:05 -0500)]
Replace movement variables with an alist and accessor
* lisp/play/dunnet.el (north, south, east, west, northeast, southeast):
(northwest, southwest, up, down, in, out): Remove.
(dun-movement-alist): New constant.
(dun-movement): New function.
(dun-n, dun-s, dun-e, dun-w, dun-ne, dun-se, dun-nw, dun-sw, dun-up):
(dun-down, dun-in, dun-out): Use a symbol for indicating movement.
(dun-move, dun-special-move): Translate movement symbol to an
enumeration.
Stefan Monnier [Sun, 19 Feb 2017 03:37:05 +0000 (22:37 -0500)]
Change type of `rehash_threshold' and `pure' fields in hash-tables
* src/lisp.h (struct Lisp_Hash_Table): Change type of
`rehash_threshold' and `pure' fields and move them after `count'.
* src/fns.c (make_hash_table): Change type of `rehash_threshold' and `pure'.
(Fmake_hash_table, Fhash_table_rehash_threshold):
* src/category.c (hash_get_category_set):
* src/xterm.c (syms_of_xterm):
* src/profiler.c (make_log):
* src/print.c (print_object):
* src/alloc.c (purecopy_hash_table, purecopy): Adjust accordingly.
Eli Zaretskii [Sat, 18 Feb 2017 12:49:30 +0000 (14:49 +0200)]
Automatically regenerate emacs.1 and *.rc files
* Makefile.in (CONFIG_STATUS_FILES_IN): New variable, lists
non-Makefile files produced by config.status.
($(MAKEFILE_NAME)): Depend on $(CONFIG_STATUS_FILES_IN), so that
their targets are regenerated when the source changes.
Rami Ylimäki [Sat, 18 Feb 2017 11:04:55 +0000 (13:04 +0200)]
Support 24-bit direct colors on text terminals
* src/term.c (init_tty): Use 24-bit terminal colors if corresponding
foreground and background functions are present in terminal type
definition.
* src/tparam.h: Define prototype for tigetstr.
* lisp/term/tty-colors.el (tty-color-define): Convert color palette
index to pixel value on 16.7M color terminals.
(tty-color-24bit): New function to convert color palette index to
pixel value on 16.7M color terminals.
(tty-color-desc): Don't approximate colors on 16.7M color terminals.
* lisp/term/xterm.el (xterm-register-default-colors): Define all named
TTY colors on 16.7M color terminals.
* doc/misc/efaq.texi (Colors on a TTY): Add instructions on how to
enable direct color TTY mode.
* etc/NEWS: Mention direct color TTY mode and point to FAQ.
Rami Ylimäki [Sat, 18 Feb 2017 10:56:12 +0000 (12:56 +0200)]
Remove unused TN_max_pairs field
* src/termchar.h (tty_display_info): Remove TN_max_pairs field,
describing maximum number of terminal background/foreground color pairs.
* src/term.c (tty_default_color_capabilities, tty_setup_colors)
(init_tty): Remove references to TN_max_pairs.
Glenn Morris [Sat, 18 Feb 2017 00:06:15 +0000 (19:06 -0500)]
Ensure that user-mail-address always has a value
* lisp/startup.el (user-mail-address): Initialize in the normal way.
(command-line): Reset user-mail-address if needed using
standard custom machinery.
* lisp/mail/feedmail.el (feedmail-fiddle-from):
* lisp/mail/rmail.el (rmail-unknown-mail-followup-to):
* lisp/mail/rmailsum.el (rmail-header-summary):
Simplify now that user-mail-address is always set.
; * doc/lispref/os.texi (System Environment): Remove fixme comment.
Mark Oteiza [Sat, 18 Feb 2017 00:01:11 +0000 (19:01 -0500)]
Turn on lexical-binding in ruby-mode
* lisp/progmodes/ruby-mode.el: Turn on lexical-binding.
(ruby-font-lock-syntax-table): Use make-syntax-table.
(ruby-mode): 'define-derived-mode' writes the keys for us.
Mark Oteiza [Fri, 17 Feb 2017 23:52:12 +0000 (18:52 -0500)]
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.
Fix build failure caused by ‘Generate upcase and downcase tables from Unicode’
The [5ec3a584: Generate upcase and downcase tables from Unicode data]
commit broke bootstrap from a truly clean tree (e.g. a fresh clone or
one created with ‘make extraclean’), see
<http://hydra.nixos.org/build/48774928>.
The failure was caused by characters.el trying to read Unicode
property tables which aren’t available so early in the build process.
Wrap the part that requires Unicode property tables in a condition
checking if those are available. If they aren’t they case and syntax
tables won’t be fully set but later on, the characters.el file will be
evaluated again and this time with Unicode properties available so
final Emacs ends up with the exact same case and syntax tables.
Katsumi Yamaoka [Fri, 17 Feb 2017 09:52:09 +0000 (09:52 +0000)]
mm-shr: Prefer charset specified in html meta tag
* lisp/gnus/mm-decode.el (mm-shr): Prefer charset specified in html
meta tag than mail-parse-charset in the case there is no charset spec
in MIME header.
Vibhav Pant [Thu, 16 Feb 2017 14:48:55 +0000 (20:18 +0530)]
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.
Mark Oteiza [Thu, 16 Feb 2017 01:43:55 +0000 (20:43 -0500)]
Minor changes in json.el
* lisp/json.el (json-advance): Simpler docstring.
(json-read-escaped-char): Use xdigit subform in rx expression.
(json-read-string): Just use = for char comparison.
Glenn Morris [Thu, 16 Feb 2017 01:23:07 +0000 (20:23 -0500)]
Handle user-mail-address being the empty string
* lisp/mail/feedmail.el (feedmail-fiddle-from):
* lisp/mail/rmail.el (rmail-unknown-mail-followup-to):
* lisp/mail/rmailsum.el (rmail-header-summary):
Belated update for 2002-09-29 startup.el change, 680ebfa, where
the value of user-mail-address during initialization was changed
from nil to the empty string.