summaryrefslogtreecommitdiff
path: root/src/xselect.c
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright year to 2018Paul Eggert2018-01-011-1/+1
| | | | Run admin/update-copyright.
* Prefer HTTPS to FTP and HTTP in documentationPaul Eggert2017-09-131-1/+1
| | | | | | | | | | | | | Most of this change is to boilerplate commentary such as license URLs. This change was prompted by ftp://ftp.gnu.org's going-away party, planned for November. Change these FTP URLs to https://ftp.gnu.org instead. Make similar changes for URLs to other organizations moving away from FTP. Also, change HTTP to HTTPS for URLs to gnu.org and fsf.org when this works, as this will further help defend against man-in-the-middle attacks (for this part I omitted the MS-DOS and MS-Windows sources and the test tarballs to keep the workload down). HTTPS is not fully working to lists.gnu.org so I left those URLs alone for now.
* Replace QUIT with maybe_quitPaul Eggert2017-01-251-2/+2
| | | | | | | | There’s no longer need to have QUIT stand for a slug of C statements. Use the more-obvious function-call syntax instead. Also, use true and false when setting immediate_quit. These changes should not affect the generated machine code. * src/lisp.h (QUIT): Remove. All uses replaced by maybe_quit.
* Merge from origin/emacs-25Paul Eggert2017-01-011-1/+1
|\ | | | | | | | | 2e2a806 Fix copyright years by hand 5badc81 Update copyright year to 2017
| * Update copyright year to 2017Paul Eggert2016-12-311-1/+1
| | | | | | | | Run admin/update-copyright.
* | Merge from origin/emacs-25Paul Eggert2016-11-191-3/+4
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Prefer comments /* like this */ in C codePaul Eggert2016-11-051-3/+4
| | | | | | | | | | | | | | Emacs C code assumes C99 features, but has long used traditional comments /* like this */ instead of C99-style comments // like this. Stick with traditional comments for now, partly for style, partly as it may be safer with compilers that are not fully in C99 mode.
* | Prefer now-standard int width macrosPaul Eggert2016-09-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/data.c (ULL_WIDTH): * src/lisp.h (EMACS_INT_WIDTH, BITS_PER_BITS_WORD): * src/lread.c (read_integer): * src/term.c (produce_glyphless_glyph): * src/xterm.c (x_send_scroll_bar_event): Use *_WIDTH macros instead of CHAR_BIT * sizeof. * src/data.c (ULL_WIDTH): Rename from BITS_PER_ULL for consistency with the *_WIDTH standard macros. All uses changed. * src/gmalloc.c (INT_BIT): Remove. All uses replaced with INT_WIDTH. * src/lisp.h (EMACS_INT_WIDTH): Rename from BITS_PER_EMACS_INT for consistency with the *_WIDTH standard macros. All uses changed. (BITS_PER_CHAR): Remove; all uses replaced by CHAR_BIT. This must be the same as CHAR_WIDTH and avoids confusion with Elisp char-width, which counts columns not bits. (BITS_PER_SHORT): Remove; all uses replaced by SHRT_WIDTH. (BITS_PER_LONG): Remove; all uses replaced by LONG_WIDTH. * src/lread.c: Do not include limits.h since CHAR_BIT is no longer used directly.
* | Fix interpretation of signed vs unsigned values when retrieving XNoah Friedman2016-08-211-12/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Window properties, and make sure the full value is returned when not parsed. New subr to export type and format information about X Window properties to lisp. * src/xselect.c (selection_data_to_lisp_data): Treat any data as unsigned unless its actual type is INTEGER. CARDINALs, in particular, are unsigned. * src/xfns.c (Fx_change_window_property): If value is a string, ignore any provided format and force to 8. (x_window_property_intern): If returning value as a string, the length is actual_size times the actual format of each element, which is not necessarily bytes. (Fx_window_property_attributes): New subr. (syms_of_xfns): Declare it.
* | Minor text-quoting-style fixesPaul Eggert2016-08-211-2/+2
| | | | | | | | | | | | | | * src/charset.c (check_iso_charset_parameter): * src/frame.c (store_frame_param): * src/xselect.c (x_fill_property_data): Use grave accent for left single quote in ‘error’ format strings.
* | Rename C names to match Lisp symbols betterPaul Eggert2016-03-271-3/+3
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was inspired by commit e65c3079c65595d95749348366af9811fafff062, which fixed a bug where the C name for a symbol disagreed with the symbol name itself. Fix other instances of disagreements that I found. Although this doesn’t fix a bug, it should make code easier to follow. The remaining disagreements are idiosyncratic: Qminus, Qplus, Qsans__serif, Qbackquote, Qcomma, Qcomma_at, Qcomma_dot. All uses changed. * src/alloc.c (QAutomatic_GC): Rename from Qautomatic_gc. * src/dbusbind.c (QCsystem): Rename from QCdbus_system_bus. (QCsession): Rename from QCdbus_session_bus. (QCtimeout): Rename from QCdbus_timeout. (QCbyte): Rename from QCdbus_type_byte. (QCboolean): Rename from QCdbus_type_boolean. (QCint16): Rename from QCdbus_type_int16. (QCuint16): Rename from QCdbus_type_uint16. (QCint32): Rename from QCdbus_type_int32. (QCuint32): Rename from QCdbus_type_uint32. (QCint64): Rename from QCdbus_type_int64. (QCuint64): Rename from QCdbus_type_uint64. (QCdouble): Rename from QCdbus_type_double. (QCstring): Rename from QCdbus_type_string. (QCobject_path): Rename from QCdbus_type_object_path. (QCsignature): Rename from QCdbus_type_signature. (QCunix_fd): Rename from QCdbus_type_unix_fd. (QCarray): Rename from QCdbus_type_array. (QCvariant): Rename from QCdbus_type_variant. (QCstruct): Rename from QCdbus_type_struct. (QCdict_entry): Rename from QCdbus_type_dict_entry. (QCserial): Rename from QCdbus_registered_serial. (QCmethod): Rename from QCdbus_registered_method. (QCsignal): Rename from QCdbus_registered_signal. * src/emacs-module.c (Qinternal__module_call): Rename from Qinternal_module_call. * src/frame.c (Qwindow__pixel_to_total): Rename from Qwindow_pixel_to_total. * src/gnutls.c (QChostname): Rename from QCgnutls_bootprop_hostname. (QCpriority): Rename from QCgnutls_bootprop_priority. (QCtrustfiles): Rename from QCgnutls_bootprop_trustfiles. (QCkeylist): Rename from QCgnutls_bootprop_keylist. (QCcrlfiles): Rename from QCgnutls_bootprop_crlfiles. (QCmin_prime_bits): Rename from QCgnutls_bootprop_min_prime_bits. (QCloglevel): Rename from QCgnutls_bootprop_loglevel. (QCcomplete_negotiation): Rename from QCgnutls_complete_negotiation. (QCverify_flags): Rename from QCgnutls_bootprop_verify_flags. (QCverify_error): Rename from QCgnutls_bootprop_verify_error. * src/w32fns.c (Qfont_parameter): Rename from Qfont_param. (Qgnutls): Rename from Qgnutls_dll. (Qlibxml2): Rename from Qlibxml2_dll. (Qzlib): Rename from Qzlib_dll. * src/w32select.c (Qutf_16le_dos): Rename from QUNICODE. * src/window.c (Qwindow__resize_root_window): Rename from Qwindow_resize_root_window. (Qwindow__resize_root_window_vertically): Rename from Qwindow_resize_root_window_vertically. (Qwindow__sanitize_window_sizes): Rename from Qwindow_sanitize_window_sizes. (Qwindow__pixel_to_total): Rename from Qwindow_pixel_to_total. * src/xdisp.c (Qredisplay_internal_xC_functionx): Rename from Qredisplay_internal. * src/xfns.c (Qfont_parameter): Rename from Qfont_param. * src/xselect.c (Q_EMACS_TMP_): Rename from QEMACS_TMP.
* Rework C source files to avoid ^(Paul Eggert2016-03-101-8/+8
| | | | | | | | Work around Bug#22884 by rewording comments and strings to avoid ‘(’ at the start of a line unless it starts a function. This change is a short-term hack; in the longer run we plan to fix cc-mode’s performance for C files that have ‘(’ at the start of a line in a comment or string.
* Update copyright year to 2016Paul Eggert2016-01-011-1/+1
| | | | Run admin/update-copyright.
* Use INT_ADD_WRAPV etc. to check integer overflowPaul Eggert2015-11-081-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/alloc.c (xnmalloc, xnrealloc, xpalloc, Fmake_string): * src/buffer.c (record_overlay_string, overlay_strings): * src/casefiddle.c (casify_object): * src/ccl.c (Fccl_execute_on_string): * src/character.c (char_width, c_string_width, lisp_string_width) (count_size_as_multibyte, string_escape_byte8): * src/coding.c (coding_alloc_by_realloc, produce_chars): * src/data.c (arith_driver): * src/dispnew.c (realloc_glyph_pool, init_display): * src/editfns.c (styled_format): * src/fns.c (Ffillarray): * src/ftfont.c (ftfont_shape_by_flt): * src/gnutls.c (gnutls_hex_string): * src/gtkutil.c (get_utf8_string): * src/image.c (x_to_xcolors, x_detect_edges, png_load_body): * src/keymap.c (Fkey_description): * src/lisp.h (SAFE_ALLOCA_LISP): * src/term.c (encode_terminal_code): * src/tparam.c (tparam1): * src/xselect.c (x_property_data_to_lisp): * src/xsmfns.c (smc_save_yourself_CB): * src/xterm.c (x_term_init): When checking for integer overflow, prefer INT_MULTIPLY_WRAPV to more-complicated code involving division and/or INT_MULTIPLY_OVERFLOW, and similarly for INT_ADD_WRAPV and subtraction and/or INT_ADD_OVERFLOW. * src/casefiddle.c (casify_object): Simplify multibyte size check. * src/character.c: Remove some obsolete ‘#ifdef emacs’s. * src/data.c (arith_driver): Also check for division overflow, as that’s now possible given that the accumulator can now contain any Emacs integer. * src/lisp.h (lisp_word_count): Remove; no longer used.
* Include-file cleanup for src directoryPaul Eggert2015-10-201-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Omit ‘#include "foo.h"’ unless the file needs foo.h (Bug#21707). In a few cases, add ‘#include "foo.h"’ if the file needs foo.h but does not include it directly. As a general rule, a source file should include foo.h if it needs the interfaces that foo.h defines. * src/alloc.c: Don’t include process.h. Include dispextern.h, systime.h. * src/atimer.c: Don’t include blockinput.h. * src/buffer.c: Include coding.h, systime.h. Don’t include keyboard.h, coding.h. * src/callint.c: Don’t include commands.h, keymap.h. * src/callproc.c: Don’t include character.h, ccl.h, composite.h, systty.h, termhooks.h. * src/casetab.c: Don’t include character.h. * src/category.c: Don’t include charset.h, keymap.h. * src/ccl.h: Don’t include character.h. * src/character.c: Don’t include charset.h. * src/charset.c: Don’t include disptab.h. * src/chartab.c: Don’t include ccl.h. * src/cm.c: Don’t include frame.h, termhooks.h. * src/cmds.c: Don’t include window.h, dispextern.h. * src/coding.c: Don’t include window.h, frame.h. * src/composite.c: Include composite.h. Don’t include window.h, font.h. * src/data.c: Don’t include syssignal.h, termhooks.h, font.h. * src/dbusbind.c: Don’t include frame.h. * src/decompress.c: Don’t include character.h. * src/dired.c: Don’t include character.h, commands.h, charset.h. * src/dispnew.c: Don’t include character.h, indent.h, intervals.h, process.h, timespec.h. Include systime.h. * src/doc.c: Include coding.h. Don’t include keyboard.h. * src/editfns.c: Include composite.h. Don’t include frame.h. * src/emacs.c: Include fcntl.h, coding.h. Don’t include commands.h, systty.h.. * src/fileio.c: Don’t include intervals.h, dispextern.h. Include composite.h. * src/filelock.c: Don’t include character.h, systime.h. * src/fns.c: Don’t include time.h, commands.h, keyboard.h, keymap.h, frame.h, blockinput.h, xterm.h. Include composite.h. * src/font.c: Include termhooks.h. * src/font.h: Don’t include ccl.h, frame.h. Add forward decls of struct composition_it, struct face, struct glyph_string. * src/fontset.c: Don’t include buffer.h, ccl.h, keyboard.h, intervals.h, window.h, termhooks.h. * src/frame.c: Don’t include character.h, commands.h, font.h. * src/frame.h: Don’t include dispextern.h. * src/fringe.c: Don’t include character.h. * src/ftcrfont.c: Don’t include dispextern.h, frame.h, character.h, charset.h, fontset.h. * src/ftfont.c: Don’t include frame.h, blockinput.h, coding.h, fontset.h. * src/ftxfont.c: Don’t include dispextern.h, character.h, charset.h, fontset.h. * src/gfilenotify.c: Don’t include frame.h, process.h. * src/gtkutil.c: Include dispextern.h, frame.h, systime.h. Don’t include syssignal.h, buffer.h, charset.h, font.h. * src/gtkutil.h: Don’t include frame.h. * src/image.c: Include fcntl.h and stdio.h instead of sysstdio.h. Don’t include character.h. * src/indent.c: Don’t include keyboard.h, termchar.h. * src/inotify.c: Don’t include character.h, frame.h. * src/insdel.c: Include composite.h. Don’t include blockinput.h. * src/intervals.c: Don’t include character.h, keyboard.h. * src/intervals.h: Don’t include dispextern.h, composite.h. * src/keyboard.c: Don’t include sysstdio.h, disptab.h, puresize.h. Include coding.h. * src/keyboard.h: Don’t incldue systime.h. * src/keymap.c: Don’t include charset.h, frame.h. * src/lread.c: Include dispextern.h and systime.h. Don’t include frame.h. Include systime.h. * src/macros.c: Don’t include commands.h, character.h, buffer.h. * src/menu.c: Include character.h, coding.h. Don’t include dispextern.h. * src/menu.h: Don’t include systime.h. * src/minibuf.c: Don’t include commands.h, dispextern.h, syntax.h, intervals.h, termhooks.h. * src/print.c: Include coding.h. Don’t include keyboard.h, window.h, dispextern.h, termchar.h, termhooks.h, font.h. Add forward decl of struct terminal. * src/process.c: Don’t include termhooks.h, commands.h, dispextern.h, composite.h. * src/region-cache.c: Don’t include character.h. * src/scroll.c: Don’t include keyboard.h, window.h. * src/search.c: Don’t include category.h, commands.h. * src/sound.c: Don’t include dispextern.h. * src/syntax.c: Don’t include command.h, keymap.h. * src/sysdep.c: Don’t include window.h, dispextern.h. * src/systime.h: Use ‘#ifdef emacs’, not ‘#ifdef EMACS_LISP_H’, * src/term.c: Don’t include systty.h, intervals.h, xterm.h. * src/terminal.c: Include character.h. Don’t include charset.h, coding.h. * src/textprop.c: Don’t include character.h. * src/undo.c: Don’t include character.h, commands.h, window.h. * src/unexsol.c: Don’t include character.h, charset.h. * src/widget.c: Include widget.h. Don’t include keyboard.h, window.h, dispextern.h, blockinput.h, character.h, font.h. * src/widgetprv.h: Don’t include widget.h. * src/window.c: Don’t include character.h, menu.h, intervals.h. * src/xdisp.c: Include composite.h, systime.h. Don’t include macros.h, process.h. * src/xfaces.c: Don’t include charset.h, keyboard.h, termhooks.h, intervals.h. * src/xfns.c: Don’t include menu.h, character.h, intervals.h, epaths.h, fontset.h, systime.h, atimer.h, termchar.h. * src/xfont.c: Don’t include dispextern.h, fontset.h, ccl.h. * src/xftfont.c: Don’t include dispextern.h, character.h, fontset.h. * src/xgselect.c: Don’t include timespec.h, frame.h. Include systime.h. * src/xgselect.h: Don’t include time.h. Use a forward decl to struct timespec instead. * src/xmenu.c: Don’t include keymap.h, character.h, charset.h, dispextern.h. Include systime.h. * src/xml.c: Don’t include character.h. * src/xrdb.c [USE_MOTIF]: Don’t include keyboard.h. * src/xselect.c: Don’t include dispextern.h, character.h, buffer.h, process.h. * src/xsmfns.c: Don’t include systime.h, sysselect.h. * src/xterm.c: Don’t include syssignal.h, charset.h, disptab.h, intervals.h process.h, keymap.h, xgselect.h. Include composite.h.
* Introduce x_uncatch_errors_after_check to reduce XSync calls.Ken Raeburn2015-10-111-3/+3
| | | | | | | | | | | | | | | Both x_had_errors_p and x_check_errors call XSync, so if they're immediately followed by x_uncatch_errors, its XSync call will be redundant, resulting in a wasted round trip to the X server. * src/xterm.c (x_uncatch_errors_after_check): New routine; a copy of x_uncatch_errors without the XSync call. (XTmouse_position, x_wm_supports): * src/xfns.c (x_set_mouse_color): * src/xmenu.c (Fx_menu_bar_open_internal): * src/xselect.c (x_own_selection, x_get_foreign_selection): (Fx_get_atom_name): Call it instead of x_uncatch_errors. * src/xterm.h (x_uncatch_errors_after_check): Declare.
* Omit unnecessary \ before paren in C docstringsPaul Eggert2015-09-161-6/+6
| | | | | | | | | Although \( is needed in docstrings in Elisp code, it is not needed in docstrings in C code, since C function definitiions do not start with a parenthesis. The backslashes made the docstrings a bit harder to read and to format in columns. Also, some C docstrings had ( in column 1 and this did not appear to be causing any problems. So, simplify C docstrings by replacing \( with ( and \) with ).
* Prefer NUMBERP to spelling it outPaul Eggert2015-09-101-2/+2
| | | | | | | | | | | | | * src/editfns.c (styled_format): * src/frame.h (NUMVAL): * src/image.c (parse_image_spec): * src/lisp.h (CHECK_NUMBER_OR_FLOAT) (CHECK_NUMBER_OR_FLOAT_COERCE_MARKER): * src/process.c (Fsignal_process): * src/xdisp.c (calc_pixel_width_or_height, on_hot_spot_p): * src/xfaces.c (check_lface_attrs): * src/xselect.c (x_fill_property_data, x_send_client_event): Use NUMBERP rather than INTEGERP || FLOATP.
* Assume GC_MARK_STACK == GC_MAKE_GCPROS_NOOPSPaul Eggert2015-08-261-14/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This removes the need for GCPRO1 etc. Suggested by Stefan Monnier in: http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00918.html * doc/lispref/internals.texi (Writing Emacs Primitives): * etc/NEWS: Document the change. * src/alloc.c (gcprolist, dump_zombies, MAX_ZOMBIES, zombies) (nzombies, ngcs, avg_zombies, max_live, max_zombies, avg_live) (Fgc_status, check_gcpros, relocatable_string_data_p, gc-precise): * src/bytecode.c (mark_byte_stack) [BYTE_MARK_STACK]: * src/eval.c (gcpro_level) [DEBUG_GCPRO]: * src/lisp.h (struct handler.gcpro, struct gcpro, GC_MARK_STACK) (GC_USE_GCPROS_AS_BEFORE, GC_MAKE_GCPROS_NOOPS) (GC_MARK_STACK_CHECK_GCPROS, GC_USE_GCPROS_CHECK_ZOMBIES) (BYTE_MARK_STACK, GCPRO1, GCPRO2, GCPRO3, GCPRO4, GCPRO5, GCPRO6) (GCPRO7, UNGCPRO, RETURN_UNGCPRO): Remove. All uses removed. The code now assumes GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS. * src/bytecode.c (relocate_byte_stack): Rename from unmark_byte_stack, since it now only relocates. All callers changed. * src/frame.c (make_frame): Add an IF_LINT to pacify GCC 5.2 with GCPROs removed. * src/systime.h: Use EMACS_LISP_H as the canary instead of GCPRO1. * test/automated/finalizer-tests.el (finalizer-basic) (finalizer-circular-reference, finalizer-cross-reference) (finalizer-error): * test/automated/generator-tests.el (cps-test-iter-close-finalizer): Remove tests, as they depend on gc-precise.
* format-message now curves ` and 'Paul Eggert2015-08-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | That way, the caller doesn’t have to use curved quotes to get diagnostics that match the text-quoting-style preferences. Suggested by Dmitry Gutov in: http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00893.html This means we no longer need %qs, so remove that format. While we’re at it, fix an unlikely bug and lessen the pressure on the garbage collector by processing the string once rather than twice in the usual case. * doc/lispref/strings.texi (Formatting Strings): * etc/NEWS: Document this. * lisp/subr.el (format-message): Remove; now done in C. * src/callint.c (Fcall_interactively): * src/editfns.c (Fmessage, Fmessage_box): Use Fformat_message instead of Finternal__text_restyle followed by Fformat. * src/doc.c (LSQM, RSQM): Remove; all uses changed to use uLSQM and uRSQM. (Fsubstitute_command_keys): Prefer AUTO_STRING to build_string when pure ASCII now suffices. Fix unlikely bug when parsing unibyte string containing non-ASCII bytes. Use inline code rather than memcpy, as it’s a tiny number of bytes. (Finternal__text_restyle): Remove; no longer used. (syms_of_doc): Don’t declare it. * src/editfns.c (Fformat): Rewrite in terms of new function ‘styled_format’. (Fformat_message): New function, moved here from subr.el. (styled_format): New function, with the old guts of Fformat, except it now optionally transliterates quotes, and it transliterates traditional grave accent and apostrophe quoting as well. Remove recently-added q flag; no longer needed or used. (syms_of_editfns): Define format-message. * src/lisp.h (uLSQM0, uLSQM1, uLSQM2, uRSQM0, uRSQM1, uRSQM2): Remove; no longer need to be global symbols. * src/xdisp.c (vadd_to_log): Use Fformat_message, not Fformat, so that callers can use `%s'. * src/image.c (image_size_error, xbm_load_image, xbm_load) (xpm_load, pbm_load, png_load_body, jpeg_load_body, tiff_load) (gif_load, imagemagick_load_image, imagemagick_load, svg_load) (svg_load_image, gs_load, x_kill_gs_process): * src/lread.c (load_warn_old_style_backquotes): * src/xfaces.c (load_pixmap): * src/xselect.c (x_clipboard_manager_error_1): Use `%s' instead of %qs in formats.
* Use new q ‘format’ flag when fixing quotes in CPaul Eggert2015-08-181-7/+6
| | | | | | | | | | | | | | | | | | | | | * src/image.c (image_size_error): New function. All uses of image_error with "Invalid image size ..." changed to use it. * src/image.c (image_size_error, xbm_load_image, xbm_load) (xpm_load, xpm_load_image, xpm_load, pbm_load, png_load_body) (jpeg_load_body, tiff_load, gif_load, imagemagick_load_image) (imagemagick_load, svg_load, svg_load_image, gs_load) (x_kill_gs_process): * src/lread.c (load_warn_old_style_backquotes): * src/xfaces.c (load_pixmap): * src/xselect.c (x_clipboard_manager_error_1): Use %qs, not uLSQM and uRSQM. * src/syntax.c (Finternal_describe_syntax_value): Prefer Fsubstitute_command_keys to Fformat, as this lets us use AUTO_STRING. * src/xdisp.c (vadd_to_log): Use AUTO_STRING on the format argument, as it's now guaranteed to be ASCII. * src/xselect.c (x_clipboard_manager_error_2): Avoid grave accent in low-level stderr diagnostic.
* Fix quoting in Fformat callsPaul Eggert2015-08-151-2/+4
| | | | | | | | | | | | | * src/image.c (xbm_read_bitmap_data, xbm_load_image, xbm_load) (xpm_load, xpm_load_image, pbm_load, png_load_body) (jpeg_load_body, tiff_load, gif_load, imagemagick_load_image) (imagemagick_load, svg_load, svg_load_image, gs_load) (x_kill_gs_process): * src/lread.c (load_warn_old_style_backquotes): * src/xfaces.c (load_pixmap): * src/xselect.c (x_clipboard_manager_error_1): Quote diagnostics according to user preference when calling Fformat or its derivatives.
* Fix bug that munged selection infoPaul Eggert2015-06-231-23/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On some optimizing C compilers, copying a structure did not copy the padding bytes between elements, and the type punning between struct input_data and struct selection_input_data did not work. Change the C code to use a proper union type instead. Problem reported by YAMAMOTO Mitsuharu (Bug#20756). * src/keyboard.c (kbd_buffer, kbd_fetch_ptr, kbd_store_ptr) (readable_events, discard_mouse_events, kbd_buffer_events_waiting) (kbd_buffer_get_event, process_special_events, stuff_buffered_input) (mark_kboards): Use union buffered_input_event, not struct input_event. (clear_event, deliver_input_available_signal, process_special_events): Remove unnecessary forward decls. (kbd_buffer_store_buffered_event): New function, mostly just the old kbd_buffer_store_event_hold, except its argument is of type union buffered_input_event, not struct input_event. (kbd_buffer_unget_event): Define only if HAVE_X11, since it's not needed otherwise. Argument is now of type struct selection_input_event *, not struct input_event *. All callers changed. (clear_event): Arg is now of type union buffered_input_event *, not struct input_event *. All callers changed. * src/keyboard.h [HAVE_X11]: Include "xterm.h". (union buffered_input_event): New type. (kbd_buffer_store_event_hold): Now an inline function, defined here. * src/termhooks.h (EVENT_KIND_WIDTH): New constant. (struct input_event): Use it. * src/xselect.c (struct selection_event_queue): Make elements be of type struct selection_input_event, not struct input_event. (selection_input_event_equal): New static function. (x_queue_event): Use it. (x_queue_event, x_decline_selection_request) (x_selection_current_request, x_reply_selection_request) (x_handle_selection_request, x_handle_selection_clear) (x_handle_selection_event): Use struct selection_input_event, not struct input_event. All callers changed. (x_convert_selection): Omit unused first arg. All callers changed. (Fx_disown_selection_internal): Omit unnecessary union. * src/xterm.c (handle_one_xevent): Use new union buffered_input_event rather than rolling our own equivalent. Prefer sie.kind when setting up that kind of structure. Call kbd_buffer_store_buffered_event, not kbd_buffer_store_event_hold. * src/xterm.h (struct selection_input_event: Use EVENT_KIND_WIDTH. (SELECTION_EVENT_DISPLAY, SELECTION_EVENT_DPYINFO) (SELECTION_EVENT_REQUESTOR, SELECTION_EVENT_SELECTION) (SELECTION_EVENT_TARGET, SELECTION_EVENT_PROPERTY) (SELECTION_EVENT_TIME, x_handle_selection_event): Arg is now of type struct selection_input_event *) not struct input_event *. All callers changed.
* Remove unused DEFSYMsPaul Eggert2015-05-311-2/+0
| | | | | | | | | | | | | Remove DEFSYMs that aren't used at the C level. Also: * src/decompress.c (Qzlib_dll): * src/font.c (Qunicode_sip): * src/frame.c (Qtip_frame): * src/ftfont.c (Qserif): * src/gnutls.c (Qgnutls_dll): * src/xml.c (Qlibxml2_dll): Move from here ... * src/w32fns.c (syms_of_w32fns): ... to here, as these are used only on MS-Windows.
* Don't misencode C-generated messagesPaul Eggert2015-05-301-2/+1
| | | | | | | | | | | | | | | | | | Also, be more consistent about calls to 'Fmessage' vs 'message'. * src/alloc.c (Fgc_status): Prefer AUTO_STRING to build_string for Fmessage call. * src/data.c (Fmake_variable_buffer_local) (Fmake_local_variable, Fmake_variable_frame_local): * src/doc.c (store_function_docstring): Use Fmessage, not message, since the argument can contain non-ASCII characters, and this can cause the resulting message to be incorrectly encoded for the current environment. * src/fns.c (maybe_resize_hash_table): * src/xselect.c (x_clipboard_manager_save_all): Use message, not Fmessage, since Fmessage's power isn't needed here. * src/process.c (Fmake_network_process): Reword message to avoid %s. * src/xdisp.c (vmessage): Document restrictions on message contents. (message_nolog) [false]: Remove unused code.
* Close a timing hole in selections.Jan D2015-04-041-5/+23
| | | | | | | | | | | Fixes: debbugs:16737 * src/xselect.c (x_reply_selection_request) (receive_incremental_selection): Call set_property_change_object inside block_input. (wait_for_property_change): Move set property_change_reply(_object) outside of this function. (set_property_change_object): New function.
* Count MANY function args more reliablyPaul Eggert2015-01-251-23/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * alloc.c (Fgc_status, purecopy, unbind_to, garbage_collect_1): * buffer.c (Fbuffer_list, Fkill_buffer): * callint.c (read_file_name, Fcall_interactively): * charset.c (Fset_charset_priority, syms_of_charset): * chartab.c (uniprop_encode_value_numeric): * coding.c (syms_of_coding): * composite.c (syms_of_composite): * data.c (wrong_range): * dbusbind.c (syms_of_dbusbind): * dired.c (file_attributes): * editfns.c (Fdecode_time, update_buffer_properties, format2): * eval.c (run_hook_with_args_2, apply1, call1, call2, call3) (call4, call5, call6, call7): * fileio.c (Finsert_file_contents, choose_write_coding_system) (Fcar_less_than_car, build_annotations, auto_save_error): * filelock.c (get_boot_time): * fns.c (internal_equal, nconc2, Fyes_or_no_p, Fwidget_apply): (maybe_resize_hash_table, secure_hash): * font.c (font_style_to_value, font_open_by_name, Flist_fonts): * fontset.c (fontset_add, Fset_fontset_font): * ftfont.c (ftfont_lookup_cache): * gtkutil.c (xg_get_font): * insdel.c (signal_before_change, signal_after_change): * keymap.c (append_key): * lread.c (load_warn_old_style_backquotes, Fload, init_lread): * minibuf.c (Fread_buffer): * print.c (print_preprocess): * process.c (Fformat_network_address, Fmake_network_process) (server_accept_connection): * sound.c (Fplay_sound_internal): * term.c (Fsuspend_tty, Fresume_tty): * window.c (window_list): * xdisp.c (run_redisplay_end_trigger_hook, add_to_log) (message_with_string): * xfaces.c (Fx_list_fonts): * xfont.c (syms_of_xfont): * xselect.c (x_handle_selection_request) (x_handle_selection_clear, x_clear_frame_selections) (x_clipboard_manager_error_1): Prefer CALLMANY and CALLN to counting args by hand. * doc.c (reread_doc_file): Remove unused code. * fns.c (concat2, concat3): Redo to avoid need for local-var vector. (cmpfn_user_defined, hashfn_user_defined, Fmaphash): Prefer call1 and call2 to Ffuncall. * keyboard.c (safe_run_hook_funcall, safe_run_hooks): Use struct literal rather than a local var, for simplicity. * keymap.c (where_is_internal): Use NULL rather than a pointer to unused args. * lisp.h (CALLMANY, CALLN): New macros. * sound.c (Fplay_sound_internal): Coalesce duplicate code. Fixes: bug#19634
* Compute C decls for DEFSYMs automaticallyPaul Eggert2015-01-051-13/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes Bug#15880. This patch also makes Q constants (e.g., Qnil) constant addresses from the C point of view. * make-docfile.c: Revamp to generate table of symbols, too. Include <stdbool.h>. (xstrdup): New function. (main): Don't process the same file twice. (SYMBOL): New constant in enum global_type. (struct symbol): Turn 'value' member into a union, either v.value for int or v.svalue for string. All uses changed. (add_global): New arg svalue, which overrides value, so that globals can have a string value. (close_emacs_global): New arg num_symbols; all uses changed. Output lispsym decl. (write_globals): Output symbol globals too. Output more ATTRIBUTE_CONST, now that Qnil etc. are C constants. Output defsym_name table. (scan_c_file): Move most of guts into ... (scan_c_stream): ... new function. Scan for DEFSYMs and record symbols found. Don't read past EOF if file doesn't end in newline. * alloc.c, bidi.c, buffer.c, bytecode.c, callint.c, casefiddle: * casetab.c, category.c, ccl.c, charset.c, chartab.c, cmds.c, coding.c: * composite.c, data.c, dbusbind.c, decompress.c, dired.c, dispnew.c: * doc.c, editfns.c, emacs.c, eval.c, fileio.c, fns.c, font.c, fontset.c: * frame.c, fringe.c, ftfont.c, ftxfont.c, gfilenotify.c, gnutls.c: * image.c, inotify.c, insdel.c, keyboard.c, keymap.c, lread.c: * macfont.m, macros.c, minibuf.c, nsfns.m, nsfont.m, nsimage.m: * nsmenu.m, nsselect.m, nsterm.m, print.c, process.c, profiler.c: * search.c, sound.c, syntax.c, term.c, terminal.c, textprop.c, undo.c: * window.c, xdisp.c, xfaces.c, xfns.c, xftfont.c, xmenu.c, xml.c: * xselect.c, xsettings.c, xterm.c: Remove Q vars that represent symbols (e.g., Qnil, Qt, Qemacs). These names are now defined automatically by make-docfile. * alloc.c (init_symbol): New function. (Fmake_symbol): Use it. (c_symbol_p): New function. (valid_lisp_object_p, purecopy): Use it. * alloc.c (marked_pinned_symbols): Use make_lisp_symbol instead of make_lisp_ptr. (garbage_collect_1): Mark lispsym symbols. (CHECK_ALLOCATED_AND_LIVE_SYMBOL): New macro. (mark_object): Use it. (sweep_symbols): Sweep lispsym symbols. (symbol_uses_obj): New function. (which_symbols): Use it. Work for lispsym symbols, too. (init_alloc_once): Initialize Vpurify_flag here; no need to wait, since Qt's address is already known now. (syms_of_alloc): Add lispsym count to symbols_consed. * buffer.c (init_buffer_once): Compare to Qnil, not to make_number (0), when testing whether storage is all bits zero. * dispextern (struct image_type): * font.c (font_property_table): * frame.c (struct frame_parm_table, frame_parms): * keyboard.c (scroll_bar_parts, struct event_head): * xdisp.c (struct props): Use XSYMBOL_INIT (Qfoo) and struct Lisp_Symbol * rather than &Qfoo and Lisp_Object *, since Qfoo is no longer an object whose address can be taken. All uses changed. * eval.c (run_hook): New function. Most uses of Frun_hooks changed to use it, so that they no longer need to take the address of a Lisp sym. (syms_of_eval): Don't use DEFSYM on Vrun_hooks, as it's a variable. * frame.c (syms_of_frame): Add defsyms for the frame_parms table. * keyboard.c (syms_of_keyboard): Don't DEFSYM Qmenu_bar here. DEFSYM Qdeactivate_mark before the corresponding var. * keymap.c (syms_of_keymap): Use DEFSYM for Qmenu_bar and Qmode_line instead of interning their symbols; this avoids duplicates. (LISP_INITIALLY, TAG_PTR) (DEFINE_LISP_SYMBOL_BEGIN, DEFINE_LISP_SYMBOL_END, XSYMBOL_INIT): New macros. (LISP_INITIALLY_ZERO): Use it. (enum symbol_interned, enum symbol_redirect, struct Lisp_Symbol) (EXFUN, DEFUN_ARGS_MANY, DEFUN_ARGS_UNEVALLED, DEFUN_ARGS_*): Move decls up, to avoid forward uses. Include globals.h earlier, too. (make_lisp_symbol): New function. (XSETSYMBOL): Use it. (DEFSYM): Now just a placeholder for make-docfile. * lread.c (DEFINE_SYMBOLS): Define, for globals.h. (intern_sym): New function, with body taken from old intern_driver. (intern_driver): Use it. Last arg is now Lisp integer, not ptrdiff_t. All uses changed. (define_symbol): New function. (init_obarray): Define the C symbols taken from lispsym. Use plain DEFSYM for Qt and Qnil. * syntax.c (init_syntax_once): No need to worry about Qchar_table_extra_slots.
* Update copyright year to 2015Paul Eggert2015-01-011-1/+1
| | | | Run admin/update-copyright.
* Use bool for boolean in xselect.c, xsettings.cPaul Eggert2014-12-261-49/+46
| | | | | | | | | | | | | | | | | | | | | | | * xselect.c (x_get_local_selection, struct selection_data) (x_selection_request_lisp_error, struct prop_location) (x_handle_selection_request, x_convert_selection) (waiting_for_other_props_on_window, expect_property_change) (wait_for_property_change, x_handle_property_notify) (x_get_foreign_selection, x_get_window_property) (receive_incremental_selection) (x_get_window_property_as_lisp_data) (lisp_data_to_selection_data, Fx_get_selection_internal) (x_send_client_event): * xselect.c, xterm.h (x_handle_dnd_message): * xsettings.c (dpyinfo_valid, parse_settings, read_settings) (apply_xft_settings, read_and_apply_settings) (xft_settings_event, init_gsettings, init_xsettings) (syms_of_xsettings): Use bool for boolean. * xselect.c (x_get_window_property): Omit last arg, which was an unused boolean. * xsettings.c (apply_xft_settings): Remove 2nd arg, which was always true. All callers changed.
* Cleanup terminal handling code.Dmitry Antipov2014-10-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * dispextern.h (get_named_tty): Remove prototype but... * termhooks.h (get_named_terminal): ...resurrect it under more meaningful name. (get_terminal): Likewise, but with... (decode_live_terminal): ...this name. (decode_tty_terminal): Add prototype. * term.c (get_tty_terminal): Remove. (get_named_tty): Remove. (Ftty_display_color_p, Ftty_display_color_cells, Ftty_type) (Fcontrolling_tty_p, Fsuspend_tty, Fresume_tty): Use decode_tty_terminal. (Ftty_no_underline, Ftty_top_frame): Use decode_live_terminal. * terminal.c (get_terminal): Refactor to... (decode_terminal, decode_live_terminal): ...new functions. (decode_tty_terminal): Replacement for get_tty_terminal. (get_named_terminal): Likewise for get_named_tty. * coding.c (Fset_terminal_coding_system_internal) (Fterminal_coding_system, Fset_keyboard_coding_system_internal): (Fkeyboard_coding_system): * composite.c (Fcomposition_get_gstring): * dispnew.c (Fsend_string_to_terminal): * frame.c (Fmake_terminal_frame): * nsfns.m (check_ns_display_info): * w32fns.c, xfns.c (check_x_display_info): * xselect.c (frame_for_x_selection): Use decode_live_terminal. * keyboard.c (handle_interrupt_signal, handle_interrupt) (Fset_quit_char): Use get_named_terminal. (Fset_output_flow_control, Fset_input_meta_mode): Use decode_tty_terminal.
* Fix x-focus-frame bug with "Not an in-range integer".Paul Eggert2014-10-021-22/+13
| | | | | | | | | | | | * xselect.c (X_SHRT_MAX, X_SHRT_MIN, X_LONG_MAX, X_LONG_MIN) (X_ULONG_MAX): Move these macros to xterm.h. (x_fill_property_data): Be more generous about allowing either signed or unsigned data of the appropriate width. * xterm.h (x_display_set_last_user_time): New function. All setters of last_user_time changd to use this function. If ENABLE_CHECKING, check that the times are in range. Fixes: debbugs:18586
* Consolidate x-select-text.Stefan Monnier2014-10-011-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/frame.el (gui-method, gui-method-define, gui-method-declare) (gui-call): New macros. (gui-method--name): New function. (frame-creation-function-alist): Use gui-method-declare. (make-frame): Use gui-method. * lisp/select.el (gui-select-enable-clipboard): Rename from x-select-enable-clipboard and move here. (x-select-enable-clipboard): Define as obsolete alias. (gui-last-selected-text): New var, to replace x-last-selected-text. (gui-select-text): New GUI method. (gui-select-text): New function. (x-select-text): Define as obsolete alias. * lisp/term/common-win.el (x-select-enable-clipboard, x-select-text): Move to select.el. * lisp/simple.el (interprogram-cut-function): Change default to x-select-text. (interprogram-paste-function): Change default to `ignore'. * lisp/w32-common-fns.el (interprogram-cut-function): Don't modify. * lisp/term/x-win.el (interprogram-cut-function): Don't modify. (gui-select-text): Add method for x. * lisp/term/w32-win.el (gui-select-text): Add method for w32. * lisp/term/pc-win.el (x-last-selected-text): Remove, use gui-last-selected-text instead. (msdos-initialize-window-system): Don't set interprogram-cut-function. (gui-select-text): Add method for pc. * lisp/term/ns-win.el (ns-last-selected-text): Remove, use gui-last-selected-text instead. (gui-select-text): Add method for ns. (x-setup-function-keys): Don't change interprogram-cut-function. * lisp/loadup.el ("startup"): Load after "frame". * lisp/subr.el (package--builtin-versions, package--description-file): Move from startup.el. * lisp/startup.el (package--builtin-versions, package--description-file): Move to subr.el. (handle-args-function-alist, window-system-initialization-alist): Use gui-method-declare. (command-line): Use gui-method. * src/xselect.c (selection-converter-alist): Fix docstring.
* Use AUTO_CONS instead of SCOPED_CONS, etc.Paul Eggert2014-09-301-7/+5
| | | | | | | | | | | | | | | | | | | * doc/lispref/internals.texi (Stack-allocated Objects): Adjust to match the revised, less error-prone macros. * src/frame.h (AUTO_FRAME_ARG): Rename from FRAME_PARAMETER. * src/lisp.h (AUTO_CONS): Rename from scoped_cons. (AUTO_LIST1): Rename from scoped_list1. (AUTO_LIST2): Rename from scoped_list2. (AUTO_LIST3): Rename from scoped_list3. (AUTO_LIST4): Rename from scoped_list4. (AUTO_STRING): Rename from SCOPED_STRING. * src/frame.h (AUTO_FRAME_ARG): * src/lisp.h (AUTO_CONS, AUTO_LIST1, AUTO_LIST2, AUTO_LIST3) (AUTO_LIST4, AUTO_STRING): Prepend a new argument 'name'. Declare a variable instead of yielding a value. All uses changed. * src/lisp.h (STACK_CONS, AUTO_CONS_EXPR): New internal macros.
* Simplify stack-allocated Lisp objects, and make them more portable.Paul Eggert2014-09-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The build_local_string macro was used in two ways: (1) string literals for which scoped allocation suffices, and (2) file name components, where it's not safe in general to assume bounded-size ASCII data. Simplify by defining a new macro SCOPED_STRING that allocates a block-scope string, and by using SCOPED_STRING for (1) and build_string for (2). Furthermore, actually use stack allocation only for objects known to have sufficient alignment. This simpler implementation means Emacs can make USE_STACK_LISP_OBJECTS the default unless GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS. * lisp.h (GCALIGNED): Align even if !USE_STACK_LISP_OBJECTS, for fewer differences among implementations. (struct Lisp_String): Now GCALIGNED. (USE_STACK_LISP_OBJECTS): Default to true, since the implementation no longer insists on a nonempty GCALIGNED. But make it false if GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS. (SCOPED_CONS_INITIALIZER): Remove, since it's no longer needed separately. Move definiens to scoped_cons. The old definition was incorrect when GCALIGNED was defined to be empty. (union Aligned_String): New type. (USE_STACK_CONS, USE_STACK_STRING): New constants, so that the implementation ports to compilers that don't align strictly enough. Don't worry about the union sizes; it's not worth bothering about. (scoped_cons, scoped_list1, scoped_list3, scoped_list4): Rewrite using USE_STACK_CONS. (scoped_cons): Assume the use of union Aligned_Cons. (lisp_string_size, make_local_string, build_local_string): Remove. Unless otherwise specified, all callers of build_local_string changed to use SCOPED_STRING. (SCOPED_STRING): New macro. * data.c (wrong_choice): * menu.c (single_menu_item): * process.c (Fformat_network_address): Hoist use of SCOPED_STRING out of a scope, so that its returned object lives long enough. * fileio.c (Fexpand_file_name): Use build_string, not SCOPED_STRING, as the string might be long or might not be ASCII.
* Keep stack-allocated Lisp objects fast rather than versatile.Dmitry Antipov2014-09-291-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac (HAVE_STATEMENT_EXPRESSIONS): Remove. For USE_STACK_LISP_OBJECTS, we always assume __GNUC__. * lisp.h (union Aligned_Cons) [!GCALIGNED]: Define as such. (SCOPED_CONS_INITIALIZER): New macro. (scoped_cons) [USE_STACK_LISP_OBJECTS]: Use it. (USE_LOCAL_ALLOCA): Remove. (local_cons, local_list1, local_list2, local_list3, local_list4): Remove. Stack overflow checking makes them too slow. (make_local_vector): Likewise. Also we just don't have enough users for it. (enum LISP_STRING_OVERHEAD): Remove. (local_string_init, local_vector_init): Remove prototypes. (make_local_string, build_local_string): Redesign to target short compile-time string constants, fall back to regular string allocation where appropriate. (lisp_string_size): New function. (verify_ascii) [ENABLE_CHECKING]: Add prototype. * alloc.c (local_string_init, local_vector_init): Remove. (verify_ascii) [ENABLE_CHECKING]: New function. * buffer.c, charset.c, chartab.c, data.c, editfns.c, emacs.c, fileio.c: * fns.c, font.c, fontset.c, frame.c, keyboard.c, keymap.c, lread.c: * menu.c, minibuf.c, process.c, textprop.c, xdisp.c, xfns.c, xfont.c: * xselect.c, xterm.c: All related users changed.
* Fix local_cons etc. to not exhaust the stack when in a loop.Paul Eggert2014-09-241-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem reported in: http://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00696.html * buffer.c (Fother_buffer, other_buffer_safely, init_buffer): * charset.c (load_charset_map_from_file, Ffind_charset_region) (Ffind_charset_string): * chartab.c (uniprop_encode_value_numeric, uniprop_table): * data.c (wrong_range): * editfns.c (Fpropertize, format2): * emacs.c (init_cmdargs, decode_env_path): * fileio.c (auto_save_error): * fns.c (Fyes_or_no_p): * font.c (font_style_to_value, font_parse_xlfd) (font_parse_family_registry, font_delete_unmatched) (font_add_log): * fontset.c (Fset_fontset_font): * frame.c (x_get_arg): * keyboard.c (echo_dash, safe_run_hooks_error, parse_menu_item) (read_char_minibuf_menu_prompt): * keymap.c (silly_event_symbol_error, describe_vector): * lread.c (load_warn_old_style_backquotes): * menu.c (single_menu_item): * minibuf.c (Fread_buffer): * process.c (status_message, Fformat_network_address) (server_accept_connection): * textprop.c (copy_text_properties): * xdisp.c (Fcurrent_bidi_paragraph_direction): * xfns.c (x_default_scroll_bar_color_parameter): * xfont.c (xfont_open): * xselect.c (x_clipboard_manager_error_1): * xterm.c (x_term_init): Put USE_LOCAL_ALLOCA at the start of the function. * fns.c (maybe_resize_hash_table): Use build_string instead of build_local_string, since we'd otherwise need a conditional USE_LOCAL_ALLOCA here, but this is just debugging output and is not worth the bother of optimization. * font.c (font_delete_unmatched): Remove by-hand code that observed MAX_ALLOCA limit, since it's now done automatically. * keymap.c (Fsingle_key_description): Put USE_SAFE_ALLOCA at top, since build_local_string needs its sa_alloc. * lisp.h (lisp_word_count): New function. (SAFE_ALLOCA_LISP): Use it. (USE_LOCAL_ALLOCA): New macro. (local_cons, make_local_vector, make_local_string): Observe the MAX_ALLOCA limit. (LISP_STRING_OVERHEAD): New constant. (make_local_string): Use it.
* If USE_LOCAL_ALLOCATORS, allocate even more Lisp objects on stack.Dmitry Antipov2014-09-161-9/+7
| | | | | | | | | | | | | | | | | * charset.c (load_charset_map_from_file): Use scoped_list2 and build_local_string. * buffer.c (Fother_buffer, other_buffer_safely, init_buffer): * emacs.c (init_cmdargs, decode_env_path): * fileio.c (Fexpand_file_name): * fns.c (maybe_resize_hash_table) [ENABLE_CHECKING]: * frame.c (x_get_arg): * keyboard.c (safe_run_hooks_error): * lread.c (load_warn_old_style_backquotes): * xdisp.c (Fcurrent_bidi_paragraph_direction): * xfns.c (x_default_scroll_bar_color_parameter, select_visual): * xselect.c (x_clipboard_manager_error_1) (x_clipboard_manager_save_all): * xterm.c (x_term_init): Use build_local_string.
* Adjust drag-and-drop fix when window is above top.Paul Eggert2014-09-071-11/+9
| | | | | | | | * xselect.c (x_fill_property_data): Don't let sign bit of negative XCDR bleed into XCAR's encoded value. Improve checks for out-of-range data while we're at it. Fixes: debbugs:18383
* * xselect.c (x_fill_property_data): Handle negative XCDR when dataJan Djärv2014-09-071-1/+18
| | | | | | is CONSP. Fixes: debbugs:18303
* Prefer 'x_display_info *' to 'Display *' in X selection code.Dmitry Antipov2014-07-181-85/+74
| | | | | | | | | | | | | | | | This helps to avoid unneeded calls to x_display_info_for_display. * xterm.h (struct selection_input_event): Record 'x_display_info *' instead of 'Display *'. (SELECTION_EVENT_DPYINFO): New macro. (SELECTION_EVENT_DISPLAY): Now inline function to prohibit using it as an lvalue. Mention this in comment. * xterm.c (handle_one_xevent): Use SELECTION_EVENT_DPYINFO. * xselect.c (x_get_window_property_as_lisp_data, x_atom_to_symbol) (selection_data_to_lisp_data, receive_incremental_selection): Convert to use 'x_display_info *'. Adjust users where appropriate. (lisp_data_to_selection_data): Likewise. Also pass 'struct selection data *' as last arg to not return values in args. (unexpect_property_change): Use common removal technique.
* Minor fixups related to usage of the 'long' type.Paul Eggert2014-07-071-5/+5
| | | | | | | | | | | | | | | | * gnutls.c (emacs_gnutls_handshake): * xfaces.c (dump_realized_face): Work even if 'long' is narrower than 'void *'. * termcap.c (scan_file): * xselect.c (x_decline_selection_request) (x_reply_selection_request, x_get_window_property): * xterm.c (x_set_frame_alpha): Remove unnecessary 'L' suffixes of integer constants. * xfns.c (hack_wm_protocols): * xselect.c (x_fill_property_data): * xterm.c (x_set_offset, x_set_window_size_1, x_make_frame_invisible): Remove unnecessary casts to 'long'. (set_machine_and_pid_properties): Don't assume pid_t fits in 32 bits.
* * font.h (struct font_driver): Remove get_outline and free_outline;Dmitry Antipov2014-07-041-12/+4
| | | | | | | | | | | | not used by any font driver. * ftfont.c (ftfont_driver): * macfont.m (macfont_driver): * nsfont.m (nsfont_driver): * w32font.c (w32font_driver): * w32uniscribe.c (uniscribe_font_driver): * xfont.c (xfont_driver): Related users changed. * xselect.c (x_get_window_property): Use convenient xmalloc. Call to xfree only if some data was really allocated.
* * xmenu.c (mouse_position_for_popup):Dmitry Antipov2014-06-221-38/+1
| | | | | | | | | | | * xselect.c (mouse_position_for_drop): Do not duplicate ... * xfns.c (x_relative_mouse_position): ... and prefer this function. * menu.c (Fx_popup_menu): * xselect.c (x_handle_dnd_message): Adjust users. * menu.h (mouse_position_for_popup): Remove prototype. * xterm.h (x_relative_mouse_position): Add prototype. * xterm.c (x_find_topmost_parent): Break from the loop and do not call XFree if XQueryTree returns zero.
* Update copyright year to 2014 by running admin/update-copyright.Paul Eggert2014-01-011-1/+1
|
* * src/xdisp.c (prepare_menu_bars): Mark static.Stefan Monnier2013-11-051-1/+0
| | | | | | * src/lisp.h (prepare_menu_bars): Don't declare. * src/xselect.c (x_handle_selection_clear): * src/callproc.c (call_process): Remove redundant call to prepare_menu_bars.
* Prefer 'unsigned long' to 'long unsigned int' and 'unsigned long int'.Dmitry Antipov2013-10-291-1/+1
| | | | | | | | | | | | | | * ftxfont.c (ftxfont_get_gcs): * gtkutil.c (xg_set_widget_bg, xg_set_background_color): * xfaces.c (x_free_colors, x_free_dpy_colors) (x_create_gc, unload_color): * xselect.c (x_property_data_to_lisp): * xsettings.c (parse_settings): * xterm.c (x_copy_color, x_alloc_lighter_color, x_setup_relief_color) (get_bits_and_offset): Adjust definition. * frame.c (XParseGeometry): Adjust locals. * lisp.h (toplevel): Adjust EMACS_UINT type definition. * regex.h (toplevel): Likewise for reg_syntax_t.
* * keyboard.c (last_event_timestamp): Remove. For X selection andDmitry Antipov2013-10-101-3/+3
| | | | | | | | | | | | | GTK popup menus, it may be obtained from per-frame X display info. (kbd_buffer_store_event_hold, kbd_buffer_get_event) (process_special_events): Adjust users. * keyboard.h (last_event_timestamp): Remove declaration. * xmenu.c (xmenu_show, create_and_show_popup_menu): Lost last arg. Use FRAME_DISPLAY_INFO (f)->last_user_time for gtk_menu_popup. * menu.h (xmenu_show): Adjust prototype. * menu.c (Fx_popup_menu): Adjust user. * xselect.c (x_own_selection, x_get_foreign_selection) (Fx_disown_selection_internal): Use dpyinfo->last_user_time.
* Don't overuse 'const' in types of locals.Paul Eggert2013-09-171-3/+3
| | | | | | | | | | | | | | | | | | | | * bidi.c (bidi_count_bytes): * gtkutil.c, gtkutil.h (xg_event_is_for_menubar) (xg_event_is_for_scrollbar): * xselect.c (x_handle_property_notify) (x_handle_selection_notify, x_handle_dnd_message): * xsettings.c, xsettings.h (xft_settings_event): * xterm.c (x_handle_net_wm_state, handle_one_event) (x_menubar_window_to_frame, x_detect_focus_change) (construct_mouse_click, note_mouse_movement) (x_scroll_bar_to_input_event, x_scroll_bar_expose) (x_scroll_bar_handle_click, x_scroll_bar_note_movement) (handle_one_xevent, x_handle_net_wm_state): * xterm.h (x_handle_property_notify, x_handle_selection_notify) (x_handle_dnd_message): Avoid unnecessary 'const', typically the second 'const' in 'const foo * const arg', a 'const' that does not affect the API and doesn't significantly help the human reader.
* Do not copy X event in handle_one_xevent except KeyPress case.Dmitry Antipov2013-09-161-3/+3
| | | | | | | | | | | | | | | | | | | | Wnen XEvent is processed, it is unlikely to be changed except KeyPress case, so we can avoid copying and use const pointer to const data to make sure that an event is not changed elsewhere. * xterm.c (handle_one_xevent): Change 2nd arg to 'const XEvent * const' and do not create local copy except for the KeyPress event. Use casts to avoid a few glitches. Adjust formatting. Add comments. (SET_SAVED_BUTTON_EVENT): Remove and move the code to the only user. (x_handle_net_wm_state, x_menubar_window_to_frame) (x_detect_focus_change, construct_mouse_click, note_mouse_movement) (x_scroll_bar_to_input_event, x_scroll_bar_expose) (x_scroll_bar_handle_click, x_scroll_bar_note_movement): * gtkutil.c (xg_event_is_for_menubar, xg_event_is_for_scrollbar): * xselect.c (x_handle_property_notify, x_handle_selection_notify) (x_handle_dnd_message): * xsettings.c (xft_settings_event): Use 'const XEvent * const' where appropriate. * xterm.h, gtkutil.h, xsettngs.h: Adjust related prototypes.