summaryrefslogtreecommitdiff
path: root/src/casefiddle.c
Commit message (Collapse)AuthorAge
* ; Add 2023 to copyright years.Eli Zaretskii2023-01-01
|
* ; * src/casefiddle.c (casify_region): Stylistic change.Yuan Fu2022-11-22
|
* Fix treesit_record_change in casify_regionYuan Fu2022-11-22
| | | | | | This fixes bug#59455. * src/casefiddle.c: Always record changes.
* ; Rename ts_* symbols in treesit.cEli Zaretskii2022-10-17
| | | | | * src/treesit.c: Rename all ts_* functions and variables to treesit_*; all references changed. Fix whitespace.
* Add tree-sitter intergrationYuan Fu2022-05-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac (HAVE_TREE_SITTER, TREE_SITTER_OBJ): New variables. (DYNAMIC_LIB_SUFFIX): new variable, I copied code from MODULES_SUFFIX so the diff looks this way. * doc/lispref/elisp.texi (Top): Add tree-sitter manual. * doc/lispref/modes.texi (Font Lock Mode): mention tree-sitter. (Parser-based Font Lock): New section. (Auto-Indentation): Mention tree-sitter. (Parser-based Indentation): New section. * doc/lispref/parsing.texi (Parsing Program Source): New chapter. * lisp/emacs-lisp/cl-preloaded.el (cl--typeof-types): Add treesit-parser and treesit-node type. * lisp/treesit.el: New file. * src/Makefile.in (TREE_SITTER_LIBS, TREE_SITTER_FLAGS, TREE_SITTER_OBJ): New variables. * src/alloc.c: (cleanup_vector): Add cleanup code for treesit-parser and treesit-node. * src/casefiddle.c (casify_region): Notify tree-sitter parser of buffer change. * src/data.c (Ftype_of): Add treesit-parser and treesit-node type (Qtreesit_parser, Qtreesit_node): New symbol. * src/emacs.c (main): Add symbols in treesit.c. * src/eval.c (define_error): Move the function to here. * src/insdel.c (insert_1_both, insert_from_string_1, insert_from_gap, insert_from_buffer_1, replace_range, del_range_2): Notify tree-sitter parser of buffer change. * src/json.c (define_error): Move this function out. * src/lisp.h (DEFINE_GDB_SYMBOL_BEGIN): Add treesit-parser and treesit-node. * src/lread.c (Vdynamic_library_suffixes): New variable. * src/print.c (print_vectorlike): Add code for printing treesit-parser and treesit-node. * src/treesit.c: New file. * src/treesit.h: New file. * test/src/treesit-tests.el: New file.
* Merge from origin/emacs-28Eli Zaretskii2022-01-01
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 836be7a112 ; * etc/refcards/ru-refcard.tex: Update Copyright year. 86cbc6ee4a * lisp/net/tramp-sh.el: Adapt copyright year ebe8772f65 ; Minor fixes related to copyright years 23c1ee6989 ; * test/manual/etags/ETAGS.good_N: Adjust to copyright ye... 8d3fc7ec89 * src/xfaces.c (face_for_font): Make 'hash' be uintptr_t. 19dcb237b5 ; Add 2022 to copyright years. # Conflicts: # etc/NEWS # etc/refcards/ru-refcard.tex # lib/cdefs.h # lisp/erc/erc-dcc.el # lisp/erc/erc-imenu.el # lisp/erc/erc-replace.el # lisp/image-dired.el # lisp/progmodes/xref.el # m4/alloca.m4 # m4/byteswap.m4 # m4/errno_h.m4 # m4/getopt.m4 # m4/gnulib-common.m4 # m4/inttypes.m4 # m4/stddef_h.m4 # m4/stdint.m4 # m4/sys_socket_h.m4
| * ; Add 2022 to copyright years.Eli Zaretskii2022-01-01
| |
* | Further fixes for Turkish case changes in unibyte stringsLars Ingebrigtsen2021-10-20
| | | | | | | | | | | | | | * src/casefiddle.c (struct casing_context): Add new slot to keep track of what the previous operation was. (case_character_impl): Set it. (do_casify_unibyte_string): Use it to handle Turkish correctly.
* | Make downcasing unibyte strings in Turkish less wrongLars Ingebrigtsen2021-10-19
|/ | | | | | | | | | | * src/casefiddle.c (ascii_casify_character): New function. (do_casify_unibyte_string): Use it to make downcasing tr_TR.UTF-8 "I" less wrong. (Fdowncase): Mention caveats. (Fupcase): (Fcapitalize): (Fupcase_initials): Refer to details in `downcase'. (syms_of_casefiddle): Define more symbols.
* * lisp/subr.el (esc-map): Initialize inside declarationStefan Monnier2021-01-04
| | | | | | | | | | | | | | | | * src/commands.h (meta_map): * src/keymap.c (meta_map): Delete variable. (syms_of_keymap): Don't initialize esc-map here. (initial_define_key): * src/keymap.h (initial_define_key): Delete function. * src/keyboard.c (keys_of_keyboard): Don't initialize esc-map here. * src/window.h (keys_of_window): * src/window.c (keys_of_window): Delete function. * src/lisp.h (keys_of_casefiddle): * src/casefiddle.c (keys_of_casefiddle): Delete function. * src/emacs.c (main): Don't call them.
* * lisp/subr.el (ctl-x-map): Initialize inside the declaration.Stefan Monnier2021-01-04
| | | | | | | | | | | | | | * src/command.h (control_x_map): * src/keymap.c (control_x_map): Delete variable. (syms_of_keymap): * src/keyboard.c (keys_of_keyboard): * src/casefiddle.c (keys_of_casefiddle): * src/window.c (keys_of_window): Move initialization of ctl-x-map to subr.el. * src/lisp.h (syms_of_buffer): * src/buffer.c (keys_of_buffer): Delete function. * src/emacs.c (main): Don't call it.
* Update copyright year to 2021Paul Eggert2021-01-01
| | | | Run "TZ=UTC0 admin/update-copyright".
* Inline a couple of functions that were macrosPaul Eggert2020-04-25
| | | | | | | | This reclaims a bit of performance when compiling with gcc -Og. These functions were macros until I changed them in 2020-04-17T14:57:25Z!eggert@cs.ucla.edu. * src/casefiddle.c (make_char_unibyte): * src/ccl.c (GET_TRANSLATION_TABLE): Now inline.
* Prefer more inline functions in character.hPaul Eggert2020-04-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/buffer.h (fetch_char_advance, fetch_char_advance_no_check) (buf_next_char_len, next_char_len, buf_prev_char_len) (prev_char_len, inc_both, dec_both): New inline functions, replacing the old character.h macros FETCH_CHAR_ADVANCE, FETCH_CHAR_ADVANCE_NO_CHECK, BUF_INC_POS, INC_POS, BUF_DEC_POS, DEC_POS, INC_BOTH, DEC_BOTH respectively. All callers changed. These new functions all assume buffer primitives and so need to be here rather than in character.h. * src/casefiddle.c (make_char_unibyte): New static function, replacing the old MAKE_CHAR_UNIBYTE macro. All callers changed. (do_casify_unibyte_string): Use SINGLE_BYTE_CHAR_P instead of open-coding it. * src/ccl.c (GET_TRANSLATION_TABLE): New static function, replacing the old macro of the same name. * src/character.c (string_char): Omit 2nd arg. 3rd arg can no longer be NULL. All callers changed. * src/character.h (SINGLE_BYTE_CHAR_P): Move up. (MAKE_CHAR_UNIBYTE, MAKE_CHAR_MULTIBYTE, PREV_CHAR_BOUNDARY) (STRING_CHAR_AND_LENGTH, STRING_CHAR_ADVANCE) (FETCH_STRING_CHAR_ADVANCE) (FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE) (FETCH_STRING_CHAR_ADVANCE_NO_CHECK, FETCH_CHAR_ADVANCE) (FETCH_CHAR_ADVANCE_NO_CHECK, INC_POS, DEC_POS, INC_BOTH) (DEC_BOTH, BUF_INC_POS, BUF_DEC_POS): Remove. (make_char_multibyte): New static function, replacing the old macro MAKE_CHAR_MULTIBYTE. All callers changed. (CHAR_STRING_ADVANCE): Remove; all callers changed to use CHAR_STRING. (NEXT_CHAR_BOUNDARY): Remove; it was unused. (raw_prev_char_len): New inline function, replacing the old PREV_CHAR_BOUNDARY macro. All callers changed. (string_char_and_length): New inline function, replacing the old STRING_CHAR_AND_LENGTH macro. All callers changed. (STRING_CHAR): Rewrite in terms of string_char_and_length. (string_char_advance): New inline function, replacing the old STRING_CHAR_ADVANCE macro. All callers changed. (fetch_string_char_advance): New inline function, replacing the old FETCH_STRING_CHAR_ADVANCE macro. All callers changed. (fetch_string_char_as_multibyte_advance): New inline function, replacing the old FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE macro. All callers changed. (fetch_string_char_advance_no_check): New inline function, replacing the old FETCH_STRING_CHAR_ADVANCE_NO_CHECK macro. All callers changed. * src/regex-emacs.c (HEAD_ADDR_VSTRING): Remove; no longer used. * src/syntax.c (scan_lists): Use dec_bytepos instead of open-coding it. * src/xdisp.c (string_char_and_length): Rename from string_char_and_length to avoid name conflict with new function in character.h. All callers changed.
* Remove UNSIGNED_CMPPaul Eggert2020-04-11
| | | | | | | | | | | | | | | | | | | | | | I added this macro in 2011 to fix some signedness comparison bugs. However, it’s a weird macro and the bugs can be fixed in a more-straightforward way. This helps performance slightly (0.5%) on my platform (Fedora 31 x86-64, GCC 9.3.1 with -O2). * src/casefiddle.c (do_casify_natnum): Use simple comparison instead of UNSIGNED_CMP. * src/character.h (CHAR_VALID_P, SINGLE_BYTE_CHAR_P, CHAR_STRING): * src/composite.h (COMPOSITION_ENCODE_RULE_VALID): * src/lisp.h (ASCII_CHAR_P): Now an inline function, and uses simple comparison instead of UNSIGNED_CMP. * src/dispextern.h (FACE_FROM_ID, FACE_FROM_ID_OR_NULL) (IMAGE_FROM_ID, IMAGE_OPT_FROM_ID): Move these to ... * src/frame.h (FACE_FROM_ID, FACE_FROM_ID_OR_NULL) (IMAGE_FROM_ID, IMAGE_OPT_FROM_ID): ... here, and make them inline functions that no longer use UNSIGNED_CMP. * src/keyboard.c (read_char): UNSIGNED_CMP is not needed here since XFIXNAT always returns a nonnegative value. * src/lisp.h (UNSIGNED_CMP): Remove; no longer used.
* Update copyright year to 2020Paul Eggert2020-01-01
| | | | Run "TZ=UTC0 admin/update-copyright $(git ls-files)".
* Avoid crashes when casifying noncontiguous regionsPaul Eggert2019-09-22
| | | | | | | | | | | | | | | | | | | | This is a followon fix for Bug#37477. * lisp/simple.el (region-extract-function): Use setq here, since the var is now defined in C code. * src/casefiddle.c (casify_pnc_region): New function. (Fupcase_region, Fdowncase_region, Fcapitalize_region) (Fupcase_initials_region): Use it. (Fupcase_initials_region): Add region-noncontiguous-p flag for consistency with the others. All uses changed. (syms_of_casefiddle): Define Qbounds, Vregion_extract_function. * src/insdel.c (prepare_to_modify_buffer_1): * src/keyboard.c (command_loop_1): Use Vregion_extraction_function. * src/insdel.c (syms_of_insdel): No need to define Qregion_extract_function. * test/src/casefiddle-tests.el (casefiddle-oldfunc): New var. (casefiddle-loopfunc, casefiddle-badfunc): New functions. (casefiddle-invalid-region-extract-function): New test.
* Support rectangular regions in capitalize-region and capitalize-dwim.Juri Linkov2019-09-22
| | | | | | | | | | * lisp/simple.el (capitalize-dwim): Add arg region-noncontiguous-p in capitalize-region call. * src/casefiddle.c (Fcapitalize_region): Add arg region-noncontiguous-p. If non-nil, operate on multiple chunks. (Bug#37477) (Fdowncase_region): Use builtin symbol Qregion_extract_function rather than calling intern.
* Remove INT_ADD_WRAPV bug workaroundsPaul Eggert2019-08-14
| | | | | | | | | * src/alloc.c (free_cons): * src/casefiddle.c (do_casify_multibyte_string): * src/editfns.c (styled_format): * src/image.c (png_load_body): Remove recent workarounds for INT_ADD_WRAPV bugs since the bugs have been fixed (Bug#37006).
* ; Add commentary to recent changesEli Zaretskii2019-08-12
| | | | | | | | * src/image.c (png_load_body): * src/editfns.c (styled_format): * src/casefiddle.c (do_casify_multibyte_string): * src/alloc.c (free_cons): Comment why we use a signed temporary integer variable. (Bug#37006)
* Prefer signed when testing for signed overflowPaul Eggert2019-08-11
| | | | | | | | | | * src/alloc.c (free_cons): * src/casefiddle.c (do_casify_multibyte_string): * src/editfns.c (styled_format): * src/image.c (png_load_body): Use signed arguments to INT_MULTIPLY_WRAPV etc. This doesn’t fix any bugs, but GCC emits better code when all args are signed. Also, this removes the need for an if in free_cons (Bug#37006).
* Avoid intern calls for builtin symsPaul Eggert2019-07-31
| | | | | | * src/casefiddle.c (Fdowncase_region): * src/eval.c (Fdefvaralias): Use builtin symbol rather than calling intern.
* Merge from origin/emacs-26Paul Eggert2018-12-31
|\ | | | | | | | | | | 2fcf2df Fix copyright years by hand 26bed8b Update copyright year to 2019 2814292 Fix value of default frame height. (Bug#33921)
| * Update copyright year to 2019Paul Eggert2019-01-01
| | | | | | | | Run 'TZ=UTC0 admin/update-copyright $(git ls-files)'.
* | More macro renamings for bignumTom Tromey2018-08-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/alloc.c, src/bidi.c, src/buffer.c, src/buffer.h, src/bytecode.c, src/callint.c, src/callproc.c, src/casefiddle.c, src/casetab.c, src/category.c, src/ccl.c, src/character.c, src/character.h, src/charset.c, src/charset.h, src/chartab.c, src/cmds.c, src/coding.c, src/composite.c, src/composite.h, src/data.c, src/dbusbind.c, src/decompress.c, src/dired.c, src/dispextern.h, src/dispnew.c, src/disptab.h, src/doc.c, src/dosfns.c, src/editfns.c, src/emacs-module.c, src/emacs.c, src/eval.c, src/fileio.c, src/floatfns.c, src/fns.c, src/font.c, src/font.h, src/fontset.c, src/frame.c, src/frame.h, src/fringe.c, src/ftcrfont.c, src/ftfont.c, src/gfilenotify.c, src/gnutls.c, src/gtkutil.c, src/image.c, src/indent.c, src/insdel.c, src/intervals.c, src/json.c, src/keyboard.c, src/keymap.c, src/kqueue.c, src/lcms.c, src/lisp.h, src/lread.c, src/macros.c, src/marker.c, src/menu.c, src/minibuf.c, src/msdos.c, src/print.c, src/process.c, src/profiler.c, src/search.c, src/sound.c, src/syntax.c, src/syntax.h, src/sysdep.c, src/term.c, src/termhooks.h, src/textprop.c, src/undo.c, src/w32.c, src/w32console.c, src/w32fns.c, src/w32font.c, src/w32inevt.c, src/w32proc.c, src/w32select.c, src/w32term.c, src/w32term.h, src/w32uniscribe.c, src/window.c, src/xdisp.c, src/xfaces.c, src/xfns.c, src/xfont.c, src/xftfont.c, src/xmenu.c, src/xml.c, src/xrdb.c, src/xselect.c, src/xsettings.c, src/xterm.c, src/xwidget.c Rename XINT->XFIXNUM, XFASTINT->XFIXNAT, XUINT->XUFIXNUM.
* | Rename integerp->fixnum, etc, in preparation for bignumsTom Tromey2018-07-12
|/ | | | | | | | | | | | | | | | | * src/json.c, src/keyboard.c, src/keyboard.h, src/keymap.c, src/kqueue.c, src/lcms.c, src/lisp.h, src/lread.c, src/macros.c, src/marker.c, src/menu.c, src/minibuf.c, src/msdos.c, src/print.c, src/process.c, src/profiler.c, src/search.c, src/sound.c, src/syntax.c, src/sysdep.c, src/term.c, src/terminal.c, src/textprop.c, src/undo.c, src/w16select.c, src/w32.c, src/w32console.c, src/w32cygwinx.c, src/w32fns.c, src/w32font.c, src/w32inevt.c, src/w32proc.c, src/w32select.c, src/w32term.c, src/w32uniscribe.c, src/widget.c, src/window.c, src/xdisp.c, src/xfaces.c, src/xfns.c, src/xfont.c, src/xftfont.c, src/xmenu.c, src/xrdb.c, src/xselect.c, src/xterm.c, src/xwidget.c: Rename INTEGERP->FIXNUM, make_number->make_fixnum, CHECK_NUMBER->CHECK_FIXNUM, make_natnum->make_fixed_natum, NUMBERP->FIXED_OR_FLOATP, NATNUMP->FIXNATP, CHECK_NATNUM->CHECK_FIXNAT.
* Update copyright year to 2018Paul Eggert2018-01-01
| | | | Run admin/update-copyright.
* Use alignas to fix GCALIGN-related bugsPaul Eggert2017-11-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use alignas and unions to specify alignments of objects needing addresses that are at least a multiple of GCALIGNMENT. Using these standard C facilities should be safer than relying on ad hoc and poorly-understood features like GCC’s __attribute__ ((aligned (N))), the root cause for recent porting bugs like Bug#29040. The alignas macro was standardized by C11 and Gnulib supports alignas for pre-C11 platforms. I have tested this on Sun Studio 12 sparc (2007) and GCC 4.4.7 x86-64 (2012) as well as on more recent platforms like GCC 7.2.1 (2017) on Fedora 26 (both x86-64 and x86). * lib-src/make-docfile.c (close_emacs_globals): lispsym is now just an array of struct Lisp_Symbol, since struct Lisp_Symbol is now properly aligned. All uses changed. * src/alloc.c (NEXT_FREE_LISP_STRING): Just use the new u.next member; this is simpler and safer than casting a pointer that might not be aligned properly. (aligned_Lisp_Symbol): Remove. No longer needed, now that struct Lisp_Symbol is aligned properly. All uses replaced with struct Lisp_Symbol. * src/lisp.h (GCALIGNED): Remove, as it does not work as expected: it can cause the natural alignment to be ignored. All uses replaced by unions with a ‘char alignas (GCALIGNMENT)’ member as described below. (struct Lisp_Symbol, struct Lisp_Cons, struct Lisp_String): Change definition from ‘struct TAG { MEMBERS };’ to ‘struct TAG { union { struct { MEMBERS } s; char alignas (GCALIGNMENT) gcaligned; } u; };’. This guarantees ‘struct TAG’ to have an alignment that at least max (GCALIGNMENT, N) where N is its old alignment. All uses like ‘PTR->MEMBER’ changed to ‘PTR->u.s.MEMBER’; these uses were supposed to be mostly private anyway. Verify that the resulting ‘struct TAG’ is properly aligned for Emacs. (union vectorlike_header): New member ‘gcaligned’ to guarantee that this type, and its containing types like ‘struct Lisp_Subr’, ‘struct buffer’ and ‘struct thread_state’, are all properly aligned for Emacs. (struct Lisp_String): New union member ‘next’, for the benefit of NEXT_FREE_LISP_STRING. (union Aligned_Cons, union Aligned_String): Remove. All uses replaced by struct Lisp_Cons and struct Lisp_String, since they are now properly aligned. (USE_STACK_CONS, USE_STACK_STRING): Simplify now that we can assume struct Lisp_Cons and struct Lisp_String are properly aligned.
* Prefer HTTPS to FTP and HTTP in documentationPaul Eggert2017-09-13
| | | | | | | | | | | | | 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.
* More casefiddle minor fixesPaul Eggert2017-04-06
| | | | | | * src/casefiddle.c (case_character_impl): Omit unnecessary casts. (case_character_impl): Avoid reevaluation of CHAR_TABLE_REF. (GREEK_CAPITAL_LETTER_SIGMA): Fix typo in my previous change.
* Fix ‘!NILP (Vpurify_flag)’ assertion failure during temacs bootstrapNoam Postavsky2017-04-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The recent changes to src/casefiddle.c cause build failure as seen below: Starting program: /home/npostavs/src/emacs/emacs-bootstrapping/src/temacs --batch --load loadup bootstrap [Thread debugging using libthread_db enabled] Using host libthread_db library "/usr/lib/libthread_db.so.1". Loading loadup.el (source)... Using load-path (/home/npostavs/src/emacs/emacs-bootstrapping/lisp /home/npostavs/src/emacs/emacs-bootstrapping/lisp/emacs-lisp /home/npostavs/src/emacs/emacs-bootstrapping/lisp/language /home/npostavs/src/emacs/emacs-bootstrapping/lisp/international /home/npostavs/src/emacs/emacs-bootstrapping/lisp/textmodes /home/npostavs/src/emacs/emacs-bootstrapping/lisp/vc) Loading emacs-lisp/byte-run (source)... Loading emacs-lisp/backquote (source)... Loading subr (source)... Loading version (source)... Loading widget (source)... Loading custom (source)... Loading emacs-lisp/map-ynp (source)... Loading international/mule (source)... Loading international/mule-conf (source)... lread.c:3914: Emacs fatal error: assertion failed: !NILP (Vpurify_flag) Breakpoint 1, terminate_due_to_signal at emacs.c:363 363 signal (sig, SIG_DFL); (gdb) bt #0 0x0000000000579826 in terminate_due_to_signal at emacs.c:363 #1 0x000000000060ec33 in die at alloc.c:7352 #2 0x000000000066db40 in intern_c_string_1 at lread.c:3914 #3 0x0000000000576884 in intern_c_string at lisp.h:3790 #4 0x00000000005dc84f in prepare_casing_context at casefiddle.c:69 #5 0x00000000005dd37f in casify_object at casefiddle.c:311 #6 0x00000000005dd47f in Fcapitalize at casefiddle.c:356 #7 0x00000000006325ac in eval_sub at eval.c:2219 #8 0x0000000000632368 in eval_sub at eval.c:2184 #9 0x000000000063446c in apply_lambda at eval.c:2875 #10 0x00000000006329af in eval_sub at eval.c:2294 #11 0x000000000062d462 in Fprogn at eval.c:449 #12 0x000000000062d4cf in prog_ignore at eval.c:461 #13 0x000000000062f19c in Fwhile at eval.c:982 #14 0x00000000006321f4 in eval_sub at eval.c:2172 #15 0x000000000062d462 in Fprogn at eval.c:449 #16 0x000000000062f0c4 in Flet at eval.c:963 #17 0x00000000006321f4 in eval_sub at eval.c:2172 #18 0x0000000000632963 in eval_sub at eval.c:2290 #19 0x000000000062d462 in Fprogn at eval.c:449 #20 0x000000000062f0c4 in Flet at eval.c:963 #21 0x00000000006321f4 in eval_sub at eval.c:2172 #22 0x0000000000668caa in readevalloop at lread.c:1927 #23 0x0000000000667253 in Fload at lread.c:1332 #24 0x0000000000632683 in eval_sub at eval.c:2233 #25 0x0000000000668caa in readevalloop at lread.c:1927 #26 0x0000000000667253 in Fload at lread.c:1332 #27 0x0000000000632683 in eval_sub at eval.c:2233 #28 0x0000000000631be5 in Feval at eval.c:2041 #29 0x000000000057e1af in top_level_2 at keyboard.c:1121 #30 0x000000000062ffc7 in internal_condition_case at eval.c:1324 #31 0x000000000057e1f0 in top_level_1 at keyboard.c:1129 #32 0x000000000062f51e in internal_catch at eval.c:1091 #33 0x000000000057e0ea in command_loop at keyboard.c:1090 #34 0x000000000057d6d5 in recursive_edit_1 at keyboard.c:697 #35 0x000000000057d8b4 in Frecursive_edit at keyboard.c:768 #36 0x000000000057b55b in main at emacs.c:1687 Lisp Backtrace: "capitalize" (0xffffcf70) "format" (0xffffd130) "define-charset" (0xffffd370) "while" (0xffffd560) "let" (0xffffd7c0) "dolist" (0xffffd910) "let" (0xffffdb70) "load" (0xffffdfe0) "load" (0xffffe4a0) * src/casefiddle.c (syms_of_casefiddle): Declare four new symbols: Qtitlecase, Qspecial_uppercase, Qspecial_lowercase and Qspecial_titlecase. (prepare_casing_context): Use aforementioned symbols.
* Minor casefiddle.c cleanupsPaul Eggert2017-04-06
| | | | | | | | | | | | | * src/casefiddle.c: Redo recent changes to match GNU style, and prefer C99-style decls within blocks. (GREEK_CAPITAL_LETTER_SIGMA): Rename from CAPITAL_SIGMA, so that we are merely using the Unicode name, and make it a constant rather than a macro. All uses changed. (SMALL_SIGMA): Remove; unused. (GREEK_SMALL_LETTER_FINAL_SIGMA): Rename from SMALL_FINAL_SIGMA, and make it a constant rather than a macro. All uses changed. (do_casify_multibyte_string): Use ‘verify’ rather than an unportable static_assertion local.
* Implement special sigma casing rule (bug#24603)Michal Nazarewicz2017-04-06
| | | | | | | | | | | | | | | | | | In Greek, a sigma character has two lower case forms which depend on their position in the word. Implement logic determining it. * src/casefiddle.c (struct casing_context, case_character_impl): Don’t assume inword is true when flag is CASE_UP and false when flag is CASE_DOWN. For final sigma detection we need this information tracked reliably;. (CAPITAL_SIGMA, SMALL_SIGMA, SMALL_FINAL_SIGMA): New macros defining Unicode code point of different forms of sigma letter. (case_character): Implement support for final sigma casing. (do_casify_multibyte_string, do_casify_multibyte_region): Update after changes to case_character. * test/src/casefiddle-tests.el (casefiddle-tests-casing): Add test cases for final sigma.
* Support casing characters which map into multiple code points (bug#24603)Michal Nazarewicz2017-04-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement unconditional special casing rules defined in Unicode standard. Among other things, they deal with cases when a single code point is replaced by multiple ones because single character does not exist (e.g. ‘fi’ ligature turning into ‘FL’) or is not commonly used (e.g. ß turning into SS). * admin/unidata/SpecialCasing.txt: New data file pulled from Unicode standard distribution. * admin/unidata/README: Mention SpecialCasing.txt. * admin/unidata/unidata-get.el (unidata-gen-table-special-casing, unidata-gen-table-special-casing--do-load): New functions generating ‘special-uppercase’, ‘special-lowercase’ and ‘special-titlecase’ character Unicode properties built from the SpecialCasing.txt Unicode data file. * src/casefiddle.c (struct casing_str_buf): New structure for representing short strings used to handle one-to-many character mappings. (case_character_imlp): New function which can handle one-to-many character mappings. (case_character, case_single_character): Wrappers for the above functions. The former may map one character to multiple (or no) code points while the latter does what the former used to do (i.e. handles one-to-one mappings only). (do_casify_natnum, do_casify_unibyte_string, do_casify_unibyte_region): Use case_single_character. (do_casify_multibyte_string, do_casify_multibyte_region): Support new features of case_character. * (do_casify_region): Updated to reflact do_casify_multibyte_string changes. (casify_word): Handle situation when one character-length of a word can change affecting where end of the word is. (upcase, capitalize, upcase-initials): Update documentation to mention limitations when working on characters. * test/src/casefiddle-tests.el (casefiddle-tests-char-properties): Add test cases for the newly introduced character properties. (casefiddle-tests-casing): Update test cases which are now passing. * test/lisp/char-fold-tests.el (char-fold--ascii-upcase, char-fold--ascii-downcase): New functions which behave like old ‘upcase’ and ‘downcase’. (char-fold--test-match-exactly): Use the new functions. This is needed because otherwise fi and similar characters are turned into their multi- -character representation. * doc/lispref/strings.texi: Describe issue with casing characters versus strings. * doc/lispref/nonascii.texi: Describe the new character properties.
* Split up casify_region function (bug#24603)Michal Nazarewicz2017-04-06
| | | | | | | | | | No functional changes at this time but splitting casify_region into a function dealing with multibyte and another dealing with unibyte buffers will make future code changes slightly easier. * src/casefiddle.c (casify_region): Move most of the code into two new functions: (do_casify_multibyte_region, do_casify_unibyte_region): new functions.
* Add support for title-casing letters (bug#24603)Michal Nazarewicz2017-04-06
| | | | | | | | | | | * src/casefiddle.c (struct casing_context, prepare_casing_context): Add titlecase_char_table member. It’s set to the ‘titlecase’ Unicode property table if capitalisation has been requested. (case_character): Make use of the titlecase_char_table to title-case initial characters when capitalising. * test/src/casefiddle-tests.el (casefiddle-tests--characters, casefiddle-tests-casing): Update test cases which are now passing.
* Introduce case_character functionMichal Nazarewicz2017-04-06
| | | | | | | | | | | | | | Move single-character casing logic into a separate function so that it is collected in a single place. This will make future changes to the logic easier. This commit introduces no functionality changes. * src/casefiddle.c (struct casing_context, prepare_casing_context): New sturcture for saving casing context and function to initialise it. (case_character): New function which cases character base on provided context. (do_casify_integer, do_casify_multibyte_string, do_casify_unibyte_string, casify_object, casify_region): Convert to use casing_context and case_character.
* Split casify_object into multiple functionsMichal Nazarewicz2017-04-06
| | | | | | | | | | | | | | | casify_object had three major cases to cover and those were mostly independent of each other. Move those branches to separate function so it’s easier to comprehend each individual case. While at it, use somewhat more descriptive ch and cased variable names rather than c and c1. This commit introduces no functional changes. * src/casefiddle.c (casify_object): Split into… (do_casify_integer, do_casify_multibyte_string, do_casify_unibyte_string): …new functions.
* Explicit error on changing case of negative integersGlenn Morris2017-02-16
| | | | | * src/casefiddle.c (casify_object): Reject negative integers: Emacs characters are positive integers. (Bug#25684)
* casing: don’t assume letters are *either* upper- or lower-case (bug#24603)Michal Nazarewicz2017-02-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | A compatibility digraph characters, such as Dž, are neither upper- nor lower-case. At the moment however, those are reported as upper-case¹ despite the fact that they change when upper-cased. Stop checking if a character is upper-case before trying to up-case it so that title-case characters are handled correctly. This fixes one of the issues mentioned in bug#24603. ¹ Because they change when converted to lower-case. Notice an asymmetry in that for a character to be considered lower-case it must not be upper-case (plus the usual condition of changing when upper-cased). * src/buffer.h (upcase1): Delete. (upcase): Change to upcase character unconditionally just like downcase does it. This is what upcase1 was. * src/casefiddle.c (casify_object, casify_region): Use upcase instead of upcase1 and don’t check !uppercasep(x) before calling upcase. * src/keyboard.c (read_key_sequence): Don’t check if uppercase(x), just downcase(x) and see if it changed. * test/src/casefiddle-tests.el (casefiddle-tests--characters, casefiddle-tests-casing): Update test cases which are now passing.
* Merge from origin/emacs-25Paul Eggert2017-01-01
|\ | | | | | | | | 2e2a806 Fix copyright years by hand 5badc81 Update copyright year to 2017
| * Update copyright year to 2017Paul Eggert2016-12-31
| | | | | | | | Run admin/update-copyright.
* | * src/casefiddle.c (casify_word): Simplify.Paul Eggert2016-09-12
| |
* | * src/casefiddle.c (casify_word): Return Qnil.Paul Eggert2016-09-12
| |
* | Refactor common code in {upcase,downcase,capitalize}-word functionsMichal Nazarewicz2016-09-12
| | | | | | | | | | | | | | | | | | * src/casefiddle.c (operate_on_word): Removed in favour of… (casify_word) …new function which does what operate_on_word did plus what all of the common code from *-word functions. (upcase-word, downcase-word, capitalize-word): Move code common between those functions (pretty much the whole body of those functions) into casify_word and use that instead of now deleted operate_on_word.
* | * src/casefiddle.c (Fupcase_region): Add arg ‘region-noncontiguous-p’.Juri Linkov2016-06-06
| | | | | | | | | | | | If non-nil, operate on multiple chunks. (Bug#23655) * src/search.c (Freplace_match): Use Qnil for new arg of Fupcase_region.
* | Omit IF_LINT code that no longer seems neededPaul Eggert2016-05-30
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Nowadays GCC is smarter, or the Emacs code has mutated, or both, and now is as good a time as any to remove uses of IF_LINT that now seem to be unnecessary. * lib-src/emacsclient.c (set_local_socket): * lib-src/movemail.c (main) [MAIL_USE_MAILLOCK && HAVE_TOUCHLOCK]: * src/buffer.c (fix_start_end_in_overlays, fix_overlays_before): * src/casefiddle.c (casify_region): * src/charset.c (load_charset_map): * src/coding.c (decode_coding_object, encode_coding_object): * src/data.c (Fmake_variable_buffer_local, Fmake_local_variable) (cons_to_unsigned, cons_to_signed): * src/frame.c (make_frame, x_set_frame_parameters): * src/keyboard.c (read_event_from_main_queue): * src/regex.c (regex_compile): * src/syntax.c (back_comment): * src/window.c (Frecenter): * src/xfaces.c (Fx_list_fonts): Remove IF_LINT that no longer seems necessary. * src/image.c (png_load_body, jpeg_load_body): Simplify use of IF_LINT. * src/keyboard.c (read_char): Use IF_LINT (volatile) rather than a pragma dance to pacify GCC -Wclobbered. * src/xdisp.c (x_produce_glyphs): Rewrite to avoid need for IF_LINT. * src/xterm.c (x_connection_closed): Now _Noreturn, which should mean we do not need IF_LINT any more. (x_io_error_quitter): Now _Noreturn. Put an 'assume (false)’ at the end, to forestall warnings from older compilers.
* Rework C source files to avoid ^(Paul Eggert2016-03-10
| | | | | | | | 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-01
| | | | Run admin/update-copyright.
* Support rectangular regions for more commandsJuri Linkov2015-11-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/simple.el (region-extract-function): Handle the arg value ‘bounds’. (region-insert-function): New function. (shell-command-on-region): Add arg ‘region-noncontiguous-p’. If non-nil, operate on multiple chunks. (region-noncontiguous-p): New function. * lisp/rect.el: Add function rectangle--insert-region around region-insert-function. (extract-rectangle-bounds): New function. (rectangle--extract-region): Handle the arg value ‘bounds’. (rectangle--insert-region): New function. * lisp/emulation/cua-rect.el: Add function cua--insert-rectangle around region-insert-function. (cua--extract-rectangle-bounds): New function. (cua--rectangle-region-extract): Handle the arg value ‘bounds’. * lisp/replace.el (query-replace, query-replace-regexp): Add arg ‘region-noncontiguous-p’. Use ‘use-region-p’. (query-replace-regexp-eval, map-query-replace-regexp) (replace-string, replace-regexp): Use ‘use-region-p’. (keep-lines, flush-lines, how-many): Use ‘use-region-p’. (perform-replace): Add arg ‘region-noncontiguous-p’. If non-nil, operate on multiple chunks. * src/casefiddle.c (Fdowncase_region): Add arg ‘region-noncontiguous-p’. If non-nil, operate on multiple chunks. (Bug#19829)