commit 45d0b3dd119566b2d2b29526b931eead15cdf740 (HEAD, refs/remotes/origin/master) Author: Eli Zaretskii Date: Thu Jul 9 05:38:29 2015 +0300 shr: fix too long lines in rendered buffers (Bug#21012) Co-authored-by: Michael Heerdegen * lisp/net/shr.el (shr-insert-document, shr-fill-text): Correct calculation of available width. (shr-find-fill-point): Don't overflow window edge if shr-kinsoku-shorten is nil. diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 60203f5..9116e50 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -222,10 +222,29 @@ DOM should be a parse tree as generated by (if (not shr-use-fonts) shr-width (* shr-width (frame-char-width)))) + ;; We need to adjust the available + ;; width for when the user disables + ;; the fringes, which will cause the + ;; display engine usurp one column for + ;; the continuation glyph. (if (not shr-use-fonts) - (- (window-width) 2) - (- (window-pixel-width) - (* (frame-fringe-width) 2)))))) + (- (window-body-width) 1 + (if (and (null shr-width) + (or (zerop + (fringe-columns 'right)) + (zerop + (fringe-columns 'left)))) + 0 + 1)) + (- (window-body-width nil t) + (* 2 (frame-char-width)) + (if (and (null shr-width) + (or (zerop + (fringe-columns 'right)) + (zerop + (fringe-columns 'left)))) + (* (frame-char-width) 2) + 0)))))) (shr-descend dom) (shr-fill-lines start (point)) (shr-remove-trailing-whitespace start (point)) @@ -439,8 +458,18 @@ size, and full-buffer size." (with-temp-buffer (let ((shr-indentation 0) (shr-start nil) - (shr-internal-width (- (window-pixel-width) - (* (frame-fringe-width) 2)))) + (shr-internal-width (- (window-body-width nil t) + (* 2 (frame-char-width)) + ;; Adjust the window width for when + ;; the user disables the fringes, + ;; which causes the display engine + ;; usurp one coplumn for the + ;; continuation glyph. + (if (and (null shr-width) + (or (zerop (fringe-columns 'right)) + (zerop (fringe-columns 'left)))) + (* (frame-char-width) 2) + 0)))) (shr-insert text) (buffer-string))))) @@ -620,7 +649,9 @@ size, and full-buffer size." ;; There's no breakable point, so we give it up. (let (found) (goto-char bp) - (unless shr-kinsoku-shorten + ;; Don't overflow the window edge, even if + ;; shr-kinsoku-shorten is nil. + (unless (or shr-kinsoku-shorten (null shr-width)) (while (setq found (re-search-forward "\\(\\c>\\)\\| \\|\\c<\\|\\c|" (line-end-position) 'move))) @@ -632,9 +663,12 @@ size, and full-buffer size." ;; Don't put kinsoku-bol characters at the beginning of a line, ;; or kinsoku-eol characters at the end of a line. (cond - (shr-kinsoku-shorten + ;; Don't overflow the window edge, even if shr-kinsoku-shorten + ;; is nil. + ((or shr-kinsoku-shorten (null shr-width)) (while (and (not (memq (preceding-char) (list ?\C-@ ?\n ? ))) - (shr-char-kinsoku-eol-p (preceding-char))) + (or (shr-char-kinsoku-eol-p (preceding-char)) + (shr-char-kinsoku-bol-p (following-char)))) (backward-char 1)) (when (setq failed (<= (point) start)) ;; There's no breakable point that doesn't violate kinsoku, commit fd51234cd3b526edb86e905c96f8cd9f15d9a2d9 Author: Xue Fuqiao Date: Sun Oct 4 14:42:45 2015 +0800 ; Add some comments diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi index a171db7..95b721f 100644 --- a/doc/emacs/frames.texi +++ b/doc/emacs/frames.texi @@ -329,6 +329,7 @@ instead of running the @code{mouse-save-then-kill} command, rebind @kbd{Mouse-3} by adding the following line to your init file (@pxref{Init Rebinding}): +@c FIXME: `mouse-popup-menubar-stuff' is obsolete since 23.1. @smallexample (global-set-key [mouse-3] 'mouse-popup-menubar-stuff) @end smallexample diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi index 22e50e9..245113b 100644 --- a/doc/lispintro/emacs-lisp-intro.texi +++ b/doc/lispintro/emacs-lisp-intro.texi @@ -3454,6 +3454,9 @@ a function. (@xref{Interactive Codes, , Code Characters for Consider the function @code{zap-to-char}. Its interactive expression is +@c FIXME: the interactive expression of zap-to-char has been changed +@c (in 2012-04-10). + @smallexample (interactive "p\ncZap to char: ") @end smallexample commit ddb8f90322e2dd3e3dc598d29241442a9e8bcf2d Author: Vincent Belaïche Date: Sun Oct 4 08:16:35 2015 +0200 Restore blank line before next section, erroneously erased in my previous commit * etc/compilation.txt (symbol ant): add an additional trailing blank line to this section, so that there are two of them immediately before the next section diff --git a/etc/compilation.txt b/etc/compilation.txt index 8f4986a..da6df8a 100644 --- a/etc/compilation.txt +++ b/etc/compilation.txt @@ -54,6 +54,7 @@ jikes are the ending line and ending column. [jikes] foo.java:3:5:7:9: blah blah [javadoc] c:\MyProject\Polynomial.java:560: error: unknown tag: math + * Bash v2 symbol: bash commit 460c3576761bfeca942ab46660cf8b1346552535 Author: Vincent Belaïche Date: Sun Oct 4 07:57:28 2015 +0200 Support MSW filename style for ant compilation error regexp * etc/compilation.txt (symbol ant): * lisp/progmodes/compile.el (compilation-error-regexp-alist-alist): Support MSW filename style diff --git a/etc/compilation.txt b/etc/compilation.txt index f134f53..8f4986a 100644 --- a/etc/compilation.txt +++ b/etc/compilation.txt @@ -52,7 +52,7 @@ jikes are the ending line and ending column. [javac] /src/DataBaseTestCase.java:27: unreported exception ... [javac] /src/DataBaseTestCase.java:49: warning: finally clause cannot complete normally [jikes] foo.java:3:5:7:9: blah blah - + [javadoc] c:\MyProject\Polynomial.java:560: error: unknown tag: math * Bash v2 diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 9cb367a..9e2d625 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -145,7 +145,7 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1)) " in line \\([0-9]+\\) of file \\([^ \n]+[^. \n]\\)\\.? " 2 1) (ant - "^[ \t]*\\[[^] \n]+\\][ \t]*\\([^: \n]+\\):\\([0-9]+\\):\\(?:\\([0-9]+\\):\\([0-9]+\\):\\([0-9]+\\):\\)?\ + "^[ \t]*\\[[^] \n]+\\][ \t]*\\(\\(?:[A-Za-z]:\\\\\\)?[^: \n]+\\):\\([0-9]+\\):\\(?:\\([0-9]+\\):\\([0-9]+\\):\\([0-9]+\\):\\)?\ \\( warning\\)?" 1 (2 . 4) (3 . 5) (6)) (bash commit 42d0000cf38f74b559e0ed049ec820661b104b2a Author: Paul Eggert Date: Sat Oct 3 17:37:59 2015 -0700 * nt/INSTALL: Minor spelling and quote fixes. diff --git a/nt/INSTALL b/nt/INSTALL index 86c4ad3..3bcb496 100644 --- a/nt/INSTALL +++ b/nt/INSTALL @@ -382,11 +382,11 @@ build will run on Windows 9X and newer systems). ok Your system has the required tools, running autoreconf... Installing git hooks... - You can now run `./configure'. + You can now run './configure'. If the script fails because it cannot find Git, you will need to arrange for the MSYS Bash's PATH to include the Git's 'bin' - sibdirectory, where there's the git.exe executable. + subdirectory, where there's the git.exe executable. * Configuring Emacs for MinGW: @@ -466,7 +466,7 @@ build will run on Windows 9X and newer systems). successful, will eventually produce a summary of the configuration similar to this: - Configured for `i686-pc-mingw32'. + Configured for 'i686-pc-mingw32'. Where should the build process find the source code? /path/to/emacs/sources What compiler should emacs be built with? gcc -std=gnu99 -O0 -g3 commit 99763700e33cc04700e2ee2fd9313e9ff279b2de Author: Paul Eggert Date: Sat Oct 3 17:25:01 2015 -0700 * lisp/ibuffer.el: Fix docstring length (Bug#21541). diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el index 92eb068..89477bd 100644 --- a/lisp/ibuffer.el +++ b/lisp/ibuffer.el @@ -2493,14 +2493,17 @@ new filter onto the stack, and the filters combine to show just buffers which satisfy ALL criteria on the stack. For example, suppose you only want to see buffers in `emacs-lisp' mode, whose names begin with \"gnus\". You can accomplish this via: -`\\[ibuffer-filter-by-mode] emacs-lisp-mode RET -\\[ibuffer-filter-by-name] ^gnus RET'. + + \\[ibuffer-filter-by-mode] emacs-lisp-mode RET + \\[ibuffer-filter-by-name] ^gnus RET Additionally, you can OR the top two filters together with `\\[ibuffer-or-filters]'. To see all buffers in either `emacs-lisp-mode' or `lisp-interaction-mode', type: -`\\[ibuffer-filter-by-mode] emacs-lisp-mode RET \\[ibuffer-filter-by-mode] lisp-interaction-mode RET \\[ibuffer-or-filters]'. + \\[ibuffer-filter-by-mode] emacs-lisp-mode RET + \\[ibuffer-filter-by-mode] lisp-interaction-mode RET + \\[ibuffer-or-filters] Filters can also be saved and restored using mnemonic names: see the functions `ibuffer-save-filters' and `ibuffer-switch-to-saved-filters'. @@ -2518,9 +2521,10 @@ create a filter group, simply use the regular functions to create a filter, and then type `\\[ibuffer-filters-to-filter-group]'. A quick example will make things clearer. Suppose that one wants to -group all of one's Emacs Lisp buffers together. To do this, type +group all of one's Emacs Lisp buffers together. To do this, type: -`\\[ibuffer-filter-by-mode] emacs-lisp-mode RET \\[ibuffer-filters-to-filter-group] RET emacs lisp buffers RET' + \\[ibuffer-filter-by-mode] emacs-lisp-mode RET + \\[ibuffer-filters-to-filter-group] emacs lisp buffers RET You may, of course, name the group whatever you want; it doesn't have to be \"emacs lisp buffers\". Filter groups may be composed of any commit 6b66375133a54ea37106b00786d3a85f7c6d658d Author: Simen Heggestøyl Date: Sat Oct 3 23:52:36 2015 +0200 Maintain ordering of JSON object keys by default * lisp/json.el (json-object-type): Mention order handling in doc-string. (json--plist-reverse): New utility function. (json-read-object): Maintain ordering for alists and plists. (json-pretty-print): Ensure that ordering is maintained. * test/automated/json-tests.el (test-json-plist-reverse): New test for `json--plist-reverse'. (json-read-simple-alist): Update test to accommodate for changes in `json-read-object'. * etc/NEWS: Document the new behavior of the pretty printing functions. diff --git a/etc/NEWS b/etc/NEWS index 26c478e..dbe0de3 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -314,6 +314,11 @@ standards. * Changes in Specialized Modes and Packages in Emacs 25.1 +** JSON +--- +*** `json-pretty-print' and `json-pretty-print-buffer' now maintain +the ordering of object keys by default. + ** You can recompute the VC state of a file buffer with `M-x vc-refresh-state' ** Prog mode has some support for multi-mode indentation. See `prog-indentation-context' and `prog-widen'. diff --git a/lisp/json.el b/lisp/json.el index daa0c94..e2c7cc7 100644 --- a/lisp/json.el +++ b/lisp/json.el @@ -57,7 +57,8 @@ (defvar json-object-type 'alist "Type to convert JSON objects to. Must be one of `alist', `plist', or `hash-table'. Consider let-binding -this around your call to `json-read' instead of `setq'ing it.") +this around your call to `json-read' instead of `setq'ing it. Ordering +is maintained for `alist' and `plist', but not for `hash-table'.") (defvar json-array-type 'vector "Type to convert JSON arrays to. @@ -136,6 +137,17 @@ without indentation.") 'not-plist))) (null list)) +(defun json--plist-reverse (plist) + "Return a copy of PLIST in reverse order. +Unlike `reverse', this keeps the property-value pairs intact." + (let (res) + (while plist + (let ((prop (pop plist)) + (val (pop plist))) + (push val res) + (push prop res))) + res)) + (defmacro json--with-indentation (body) `(let ((json--encoding-current-indentation (if json-encoding-pretty-print @@ -400,7 +412,10 @@ Please see the documentation of `json-object-type' and `json-key-type'." (signal 'json-object-format (list "," (json-peek)))))) ;; Skip over the "}" (json-advance) - elements)) + (pcase json-object-type + (`alist (nreverse elements)) + (`plist (json--plist-reverse elements)) + (_ elements)))) ;; Hash table encoding @@ -602,6 +617,8 @@ Advances point just past JSON object." (interactive "r") (atomic-change-group (let ((json-encoding-pretty-print t) + ;; Ensure that ordering is maintained + (json-object-type 'alist) (txt (delete-and-extract-region begin end))) (insert (json-encode (json-read-from-string txt)))))) diff --git a/test/automated/json-tests.el b/test/automated/json-tests.el index fd89b7a..d1b7a2f 100644 --- a/test/automated/json-tests.el +++ b/test/automated/json-tests.el @@ -22,15 +22,22 @@ (require 'ert) (require 'json) +(ert-deftest test-json-plist-reverse () + (should (equal (json--plist-reverse '()) '())) + (should (equal (json--plist-reverse '(:a 1)) '(:a 1))) + (should (equal (json--plist-reverse '(:a 1 :b 2 :c 3)) + '(:c 3 :b 2 :a 1)))) + (ert-deftest json-encode-simple-alist () (should (equal (json-encode '((a . 1) (b . 2))) "{\"a\":1,\"b\":2}"))) (ert-deftest json-read-simple-alist () - (should (equal (json-read-from-string "{\"a\": 1, \"b\": 2}") - '((b . 2) - (a . 1))))) + (let ((json-object-type 'alist)) + (should (equal (json-read-from-string "{\"a\": 1, \"b\": 2}") + '((a . 1) + (b . 2)))))) (ert-deftest json-encode-string-with-special-chars () (should (equal (json-encode-string "a\n\fb") commit 9a05f0ac953ce19395c7409aed6bdd8db83cebb0 Author: Andreas Schwab Date: Sat Oct 3 20:14:40 2015 +0200 * src/coding.c (complement_process_encoding_system): Revert last change. diff --git a/src/coding.c b/src/coding.c index 31bffea..c5099a7 100644 --- a/src/coding.c +++ b/src/coding.c @@ -6052,7 +6052,6 @@ complement_process_encoding_system (Lisp_Object coding_system) coding_system = CDR_SAFE (Vdefault_process_coding_system); else if (i == 2) coding_system = preferred_coding_system (); - CHECK_CODING_SYSTEM (coding_system); spec = CODING_SYSTEM_SPEC (coding_system); if (NILP (spec)) continue; commit 829e818d57903c5b99492f8793a28def2736d4eb Author: Ulf Jasper Date: Sat Oct 3 18:21:07 2015 +0200 Add entry for Ulf Jasper. diff --git a/admin/MAINTAINERS b/admin/MAINTAINERS index 43fa46d..8b7647e 100644 --- a/admin/MAINTAINERS +++ b/admin/MAINTAINERS @@ -129,6 +129,22 @@ Dmitry Gutov lisp/progmodes/xref.el lisp/progmodes/project.el +Ulf Jasper + Newsticker + doc/misc/newsticker.texi + etc/images/newsticker/* + lisp/net/newst-backend.el + lisp/net/newst-plainview.el + lisp/net/newst-reader.el + lisp/net/newst-ticker.el + lisp/net/newst-treeview.el + lisp/net/newsticker.el + test/automated/newsticker-tests.el + + Icalendar + lisp/calendar/icalendar.el + test/automated/icalendar-tests.el + ============================================================================== 2. ============================================================================== @@ -543,12 +559,6 @@ lisp/net/mairix.el lisp/net/netrc.el lisp/net/net-utils.el lisp/net/network-stream.el -lisp/net/newst-backend.el -lisp/net/newsticker.el -lisp/net/newst-plainview.el -lisp/net/newst-reader.el -lisp/net/newst-ticker.el -lisp/net/newst-treeview.el lisp/net/nsm.el lisp/net/ntlm.el lisp/net/pinentry.el commit 9cca3fe8baddee9b1d59d060340c69c98c22850e Author: Xue Fuqiao Date: Sat Oct 3 21:24:09 2015 +0800 Doc fix for `defmacro' * doc/lispref/objects.texi (Macro Type): `defmacro' is a macro now. diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi index 0a19274..c650572 100644 --- a/doc/lispref/objects.texi +++ b/doc/lispref/objects.texi @@ -1279,8 +1279,8 @@ list whose first element is the symbol @code{macro} and whose @sc{cdr} is a Lisp function object, including the @code{lambda} symbol. Lisp macro objects are usually defined with the built-in -@code{defmacro} function, but any list that begins with @code{macro} is -a macro as far as Emacs is concerned. @xref{Macros}, for an explanation +@code{defmacro} macro, but any list that begins with @code{macro} is a +macro as far as Emacs is concerned. @xref{Macros}, for an explanation of how to write a macro. @strong{Warning}: Lisp macros and keyboard macros (@pxref{Keyboard commit b235ceaaf69345a5c79ec96ce0ca61b29fb232e1 Author: Andreas Schwab Date: Sat Oct 3 14:21:48 2015 +0200 More validatation of coding systems * src/fileio.c (Finsert_file_contents): Remove redundant coding-system check. (choose_write_coding_system): Likewise. * src/coding.c (complement_process_encoding_system): Check argument for valid coding system. diff --git a/src/coding.c b/src/coding.c index d265531..31bffea 100644 --- a/src/coding.c +++ b/src/coding.c @@ -6004,7 +6004,8 @@ coding_inherit_eol_type (Lisp_Object coding_system, Lisp_Object parent) if (NILP (coding_system)) coding_system = Qraw_text; - CHECK_CODING_SYSTEM (coding_system); + else + CHECK_CODING_SYSTEM (coding_system); spec = CODING_SYSTEM_SPEC (coding_system); eol_type = AREF (spec, 2); if (VECTORP (eol_type)) @@ -6051,6 +6052,7 @@ complement_process_encoding_system (Lisp_Object coding_system) coding_system = CDR_SAFE (Vdefault_process_coding_system); else if (i == 2) coding_system = preferred_coding_system (); + CHECK_CODING_SYSTEM (coding_system); spec = CODING_SYSTEM_SPEC (coding_system); if (NILP (spec)) continue; diff --git a/src/fileio.c b/src/fileio.c index 15bebdf..b82b7d3 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -3470,10 +3470,7 @@ by calling `format-decode', which see. */) mtime = time_error_value (save_errno); st.st_size = -1; if (!NILP (Vcoding_system_for_read)) - { - CHECK_CODING_SYSTEM (Vcoding_system_for_read); - Fset (Qbuffer_file_coding_system, Vcoding_system_for_read); - } + Fset (Qbuffer_file_coding_system, Vcoding_system_for_read); goto notfound; } @@ -4529,7 +4526,6 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file else if (!NILP (Vcoding_system_for_write)) { val = Vcoding_system_for_write; - CHECK_CODING_SYSTEM (val); if (coding_system_require_warning && !NILP (Ffboundp (Vselect_safe_coding_system_function))) /* Confirm that VAL can surely encode the current region. */ @@ -4578,13 +4574,11 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file using_default_coding = 1; } - if (!NILP (val)) - CHECK_CODING_SYSTEM (val); - if (! NILP (val) && ! force_raw_text) { Lisp_Object spec, attrs; + CHECK_CODING_SYSTEM (val); CHECK_CODING_SYSTEM_GET_SPEC (val, spec); attrs = AREF (spec, 0); if (EQ (CODING_ATTR_TYPE (attrs), Qraw_text)) @@ -4593,12 +4587,9 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file if (!force_raw_text && !NILP (Ffboundp (Vselect_safe_coding_system_function))) - { - /* Confirm that VAL can surely encode the current region. */ - val = call5 (Vselect_safe_coding_system_function, - start, end, val, Qnil, filename); - CHECK_CODING_SYSTEM (val); - } + /* Confirm that VAL can surely encode the current region. */ + val = call5 (Vselect_safe_coding_system_function, + start, end, val, Qnil, filename); /* If the decided coding-system doesn't specify end-of-line format, we use that of @@ -4608,10 +4599,7 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file Lisp_Object dflt = BVAR (&buffer_defaults, buffer_file_coding_system); if (! NILP (dflt)) - { - CHECK_CODING_SYSTEM (dflt); - val = (coding_inherit_eol_type (val, dflt)); - } + val = coding_inherit_eol_type (val, dflt); } /* If we decide not to encode text, use `raw-text' or one of its commit 272ca096356e30c67ce337855da7531994040255 Author: Eli Zaretskii Date: Sat Oct 3 15:39:17 2015 +0300 Avoid crashes in coding_inherit_eol_type * src/coding.c (coding_inherit_eol_type): Check the validity of the arguments. Suggested by Andreas Schwab . (Bug#21602) diff --git a/src/coding.c b/src/coding.c index 3fc6fb6..d265531 100644 --- a/src/coding.c +++ b/src/coding.c @@ -6004,6 +6004,7 @@ coding_inherit_eol_type (Lisp_Object coding_system, Lisp_Object parent) if (NILP (coding_system)) coding_system = Qraw_text; + CHECK_CODING_SYSTEM (coding_system); spec = CODING_SYSTEM_SPEC (coding_system); eol_type = AREF (spec, 2); if (VECTORP (eol_type)) @@ -6014,6 +6015,7 @@ coding_inherit_eol_type (Lisp_Object coding_system, Lisp_Object parent) { Lisp_Object parent_spec; + CHECK_CODING_SYSTEM (parent); parent_spec = CODING_SYSTEM_SPEC (parent); parent_eol_type = AREF (parent_spec, 2); if (VECTORP (parent_eol_type)) commit 265d525a5ef9f59a6c26d40cd560ae43c3ae1d2c Author: Eli Zaretskii Date: Sat Oct 3 14:49:16 2015 +0300 More validatation of coding system in 'write-region' * src/coding.c (choose_write_coding_system): More validation of coding-system from various sources. Suggested by Andreas Schwab . (Bug#21602) diff --git a/src/fileio.c b/src/fileio.c index 65aaf57..15bebdf 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -4593,17 +4593,26 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file if (!force_raw_text && !NILP (Ffboundp (Vselect_safe_coding_system_function))) - /* Confirm that VAL can surely encode the current region. */ - val = call5 (Vselect_safe_coding_system_function, - start, end, val, Qnil, filename); + { + /* Confirm that VAL can surely encode the current region. */ + val = call5 (Vselect_safe_coding_system_function, + start, end, val, Qnil, filename); + CHECK_CODING_SYSTEM (val); + } /* If the decided coding-system doesn't specify end-of-line format, we use that of `default-buffer-file-coding-system'. */ - if (! using_default_coding - && ! NILP (BVAR (&buffer_defaults, buffer_file_coding_system))) - val = (coding_inherit_eol_type - (val, BVAR (&buffer_defaults, buffer_file_coding_system))); + if (! using_default_coding) + { + Lisp_Object dflt = BVAR (&buffer_defaults, buffer_file_coding_system); + + if (! NILP (dflt)) + { + CHECK_CODING_SYSTEM (dflt); + val = (coding_inherit_eol_type (val, dflt)); + } + } /* If we decide not to encode text, use `raw-text' or one of its subsidiaries. */ commit 658f2c450d17357d8c09a07ca92c2ca980c3c797 Author: Eli Zaretskii Date: Sat Oct 3 13:44:44 2015 +0300 Avoid crashes due to invalid coding-system * src/fileio.c (choose_write_coding_system) (Finsert_file_contents): Check validity of coding-system-for-write and coding-system-for-read bound by the caller. (Bug#21602) diff --git a/src/fileio.c b/src/fileio.c index e4b255a..65aaf57 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -3470,7 +3470,10 @@ by calling `format-decode', which see. */) mtime = time_error_value (save_errno); st.st_size = -1; if (!NILP (Vcoding_system_for_read)) - Fset (Qbuffer_file_coding_system, Vcoding_system_for_read); + { + CHECK_CODING_SYSTEM (Vcoding_system_for_read); + Fset (Qbuffer_file_coding_system, Vcoding_system_for_read); + } goto notfound; } @@ -4526,6 +4529,7 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file else if (!NILP (Vcoding_system_for_write)) { val = Vcoding_system_for_write; + CHECK_CODING_SYSTEM (val); if (coding_system_require_warning && !NILP (Ffboundp (Vselect_safe_coding_system_function))) /* Confirm that VAL can surely encode the current region. */ @@ -4574,6 +4578,9 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file using_default_coding = 1; } + if (!NILP (val)) + CHECK_CODING_SYSTEM (val); + if (! NILP (val) && ! force_raw_text) { Lisp_Object spec, attrs;