commit b1cf262a79463f28164ea1c2ffee3c657ce02ea4 (HEAD, refs/remotes/origin/master) Merge: a415a97461 b3f4a3a5ae Author: Glenn Morris Date: Wed Dec 20 21:15:43 2017 -0500 Merge from origin/emacs-26 b3f4a3a (origin/emacs-26) Special-case %DUMBFW for GnuTLS between 3.2... c2ae057 Work around GnuTLS version issues with %DUMBFW (tiny change) 2f9d9ef ; Remove the mention of "plain C code" in the docstring as well aca827b Merge branch 'widen-less' into emacs-26 87548f5 ; Rephrase NEWS entry a bit da0d773 (emacs-26) ; * lisp/erc/erc.el: Update URL. 3a60515 * lisp/erc/erc.el (erc-shorten-server-name): Silence compiler... 471b6c1 ; Replace non-ascii quote characters in doc strings etc 7af7f5e Fix some more aliases to user options 79fb4b5 Fix some flymake aliases b9fbc03 (origin/widen-less) Widen in indent-for-tab-command in the no... 446faf3 Replace the mention of c-indent-defun with js-indent-line 7e9eef0 Consolidate 'widen' calls # Conflicts: # etc/NEWS # lisp/progmodes/flymake-proc.el commit a415a97461cb10d2c6710871f90f57bd1ca34ec2 Merge: b5f140166a 964dd38c8f Author: Glenn Morris Date: Wed Dec 20 21:14:20 2017 -0500 ; Merge from origin/emacs-26 The following commit was skipped: 964dd38 Unbreak a fileio test on non-Mac OS X systems commit b5f140166ab9057b9e9dd56fd332e6b2937388c4 Merge: 5bf3ab291c 4122d54067 Author: Glenn Morris Date: Wed Dec 20 21:14:19 2017 -0500 Merge from origin/emacs-26 4122d54 Fix updating scrollbar sizes when scaling is in effect 21a212f Collect GnuTLS extensions and use them to set %DUMBFW if supp... 936136e * test/lisp/emacs-lisp/derived-tests.el: Fix copy&paste lefto... 07b7fb9 * lisp/subr.el (delayed-after-hook-functions): Rename from ..... a5b0a4e * lisp/net/shr.el (shr-string-pixel-width): Return pixel-widt... c51e797 python.el doc fixes c62ced5 Make 'mouse-drag-and-drop-region' more robust and customizable commit 5bf3ab291c90b4976e70694982db55dad3fa84cd Merge: 0482fa774c 2e9eba2013 Author: Glenn Morris Date: Wed Dec 20 21:14:19 2017 -0500 ; Merge from origin/emacs-26 The following commit was skipped: 2e9eba2 Backport: Don't compare arguments that can be nil (Bug#28039) commit 0482fa774cbb978c8b61f80ced844554b61655f0 Merge: 9f1c613b07 89cfdbf729 Author: Glenn Morris Date: Wed Dec 20 21:14:19 2017 -0500 Merge from origin/emacs-26 89cfdbf Don't mess up syntax-ppss cache in electric-pair (Bug#29710) c5061d8 * etc/emacs.appdata.xml: Update file format. 080f227 Use utf-8-hfs-unix on macOS (Bug#29712) 28e0261 * lisp/progmodes/cc-defs.el (c-version): Update to 5.33.1. ac53084 Improve fix for Bug#29712 ffd4771 * doc/lispref/sequences.texi (Sequence Functions): Improve in... f274cbd Avoid reordering of output in 'shr-insert-document' 7890864 Improve documentation of 'invisible-p' a1327bb Remove one more check that Vframe_list is non-nil 63b6281 Fix off-by-one error in 'css--hex-color' 804b37c Save and restore text-pixel height and width of frames (Bug#2... 777fe94 Partially revert "Mention new strictness for &optional, &rest... ad17db7 * lisp/vc/smerge-mode.el (smerge-refine): Respect font-lock-m... 5a7d009 * lisp/vc/smerge-mode.el (smerge-refine): Replace obsolete al... e019c35 FOR_EACH_FRAME no longer assumes frame-list d64b88d * src/font.c (Ffont_info): Doc fix. (Bug#29682) 92b2604 Modernise message.el face spec syntax b1efbe6 Update message.el obsolete face aliases 2494c14 ; * lisp/comint.el (comint-terminfo-terminal): Add a :version... 12ad276 Improve documentation of TERM environment variable 8ed529f Add option to configure comint TERM 889f07c Better support utf-8-with-signature and utf-8-hfs in XML/HTML a2697fa * lisp/menu-bar.el (menu-bar-mode): Doc fix. ffb50ea ; * etc/NEWS: Fix last change. 95606af Fix Bug#29712 in tramp-tests.el 9bf66c6 Don't run FOR_EACH_FRAME when there's no frame left (Bug#29961) c2a88ec * lisp/textmodes/tex-mode.el: Ensure uncompiled file is loada... b178870 Remember password change for IMAP in Gnus (Bug#29692) a21dac1 Add %DUMBFW to the default GnuTLS priority strings 780407c Small fixes prompted by make check-declare 541a601 Fix some custom groups e220d6e Fix fontification of first declaration within a C++ lambda form. aa66da2 * src/data.c (Fadd_variable_watcher): Doc fix. f838210 Fix misfontification of C++ member initialization list after ... 232c646 Fix doc-string of Fbuffer_list 3f9aac6 Don't raise an extraneous frame (bug#29696) e7b1111 Mention new strictness for &optional, &rest in arglists (Bug#... 4cb8696 Don't misfontify "foo ()" inside C++ initialization parenthes... ce31e72 Fixes for defcustoms, prompted by cus-test-opts aacd1e1 * lisp/net/newst-backend.el (newsticker--raw-url-list-default... 7e2f4d3 * lisp/htmlfontify.el (hfy-which-etags): Fix it. 52d2a69 Add missing :version tags revealed by cusver-check f5d0360 Escape column-zero doc parens 45099bb Remove ObjC blocks (Bug#23753) b0369d0 Import the latest IVD_Sequences.txt cd53b63 Fix dired-do-compress when tar doesn't default to stdin (Bug#... 51911da Suppress warnings during elisp completion macroexpansion a36a090 * lisp/progmodes/verilog-mode.el (verilog-mode): Fix typo (Bu... 6a6e8e6 Make tramp-interrupt-process more robust 5bcd468 Make quail-input-method work when inhibit-read-only is non-ni... 87baf12 Fix 'fontset-name-p' d231587 Fix fontset documentation inconsistencies for bug#29630 a829cb8 Remove sentence from child frames section in Elisp manual ad491c8 Avoid crashes in 'font-at' after 'set-fontset-font' c73d2cd * lisp/files-x.el (connection-local-set-profile-variables): F... cefca2b Add /etc/ssl/cert.pem to gnutls-trustfiles for macOS 122e726 Fix tool-tip display when display margins are non-zero by def... e1cc203 Handle hash tables and vectors when reading/writing EIEIO obj... cda219c Improve interactive debugging commands in xdisp.c 1056b3c Fix calculation of continuation_pixel_width in display engine 90e2080 Improve documentation of 'save-abbrevs'. 14f0230 Improve documentation of Dired 161b0e5 * lisp/bookmark.el (bookmark-alist): Doc fix. (Bug#29551) 7eea314 Minor Tramp fixes c0a670a * lisp/help-mode.el (help-function-def): Allow help-make-xref... 0572016 Fix doc-string of 'display-buffer-in-side-window' a1bbc49 Fix Bug#29579 cb3d979 ; NEWS: Update Org version number 445eefd Backport: Update Org to v9.1.4 5381c70 In windows.texi mention special splitting behavior of side an... 46d62b9 * lisp/gnus/gnus-group.el (gnus-group-mode-map): Bind [follow... 1ef1dbd Avoid compilation warning in xterm.c 5cf3c26 * README: Document all the top-level directories. (Bug#29558) e9ea206 Don't enable erc modules on simply loading erc.el 4b06af0 Allow shr to use data: URLs without encoding 1fdac2d Don't add newlines in minibuffer history de68f33 modhelp.py: Support Python 3 (Bug#24954) afb04f7 Use forward slashes for python w32 config example (Bug#21656) 04e5b28 Fix bug in i18n/l10n optimization 8227087 Let autoload-compute-prefix be set file-locally (Bug#29471) 98ca7d5 Improve edit-kbd-macro prompting in case of remapped keys (Bu... c02c1f6 Add tests on electric-indentation and Python multiline string... 946bb6d Disable electric indent for python strings (Bug#29305) 35f1ed1 ; ChangeLog.2: Fix bug reference. ac31663 Fix buffer overflow in fontname conversion (Bug#29523) bf9b972 Fix byte compilation of files with leading directories ac144dc * lisp/files.el (make-backup-file-name-1): Fix scoping error. 1b351c8 Revert Tramp commit from 2017-11-20 77cf972 Improve documentation of buffer-list commands and features 66ec92a Fix backing up remote files in local directories on MS-Windows 7e61e74 * doc/emacs/mule.texi (Output Coding): Clarify sendmail coding. 1e25cd7 Revert "Fix backing up remote files in local directories on M... f52d795 Fix a typo in ELisp manual bf26fc3 * lisp/composite.el (find-composition): Fix a typo in the doc... 34a21c3 ; Auto-commit of loaddefs files. 8c8b673 Fix backing up remote files in local directories on MS-Windows 8eb6870 Fix vertical cursor motion in pixel-scroll.el 625e84f Fix typos in doc strings of message.el 9292276 Fix a typo in the Emacs manual 42509c0 Improve the documentation of 'table-insert-sequence' 93dc7ae Port better to QNX ad99550 Make tramp-test42-auto-load more robust af0ce33 ; * lisp/composite.el (find-composition): Fix a typo in last ... bdbcdba Avoid assertions in find-composition 408862f ; * lisp/emacs-lisp/bytecomp.el: Tweak message formatting in ... 9964db4 Restore obsolete method of changing byte-compile-dest-file 3dd25ae Some minor Tramp corrections d670a15 * doc/misc/url.texi (http/https): Fix typo 99d07e8 Remove some bogus definition-prefixes from loaddefs commit b3f4a3a5aee93fa2f7ad2597383befbf7b242209 Author: Ted Zlatanov Date: Wed Dec 20 20:12:42 2017 -0500 Special-case %DUMBFW for GnuTLS between 3.2.5 and 3.5.1 * src/gnutls.c: Introduce HAVE_GNUTLS_EXT__DUMBFW for GnuTLS >= 3.2.5. (Fgnutls_available_p): Use it. diff --git a/src/gnutls.c b/src/gnutls.c index 48ea25397a..c21421fe55 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -50,6 +50,10 @@ along with GNU Emacs. If not, see . */ # define HAVE_GNUTLS_EXT_GET_NAME #endif +#if GNUTLS_VERSION_NUMBER >= 0x030205 +# define HAVE_GNUTLS_EXT__DUMBFW +#endif + #ifdef HAVE_GNUTLS # ifdef WINDOWSNT @@ -2476,6 +2480,10 @@ Any GnuTLS extension with ID up to 100 # endif # endif /* HAVE_GNUTLS3 */ +# ifdef HAVE_GNUTLS_EXT__DUMBFW + capabilities = Fcons (intern("ClientHello Padding"), capabilities); +# endif + # ifdef WINDOWSNT Vlibrary_cache = Fcons (Fcons (Qgnutls, capabilities), Vlibrary_cache); # endif /* WINDOWSNT */ commit c2ae057d0e455ed40127fec931b803ff628bffb7 Author: Andy Moreton Date: Wed Dec 20 20:07:54 2017 -0500 Work around GnuTLS version issues with %DUMBFW (tiny change) * src/gnutls.c: Introduce HAVE_GNUTLS_EXT_GET_NAME and use it. (init_gnutls_functions): Use it. (Fgnutls_available_p): Use it (Bug#25061). Fix Vlibrary_cache bug. diff --git a/src/gnutls.c b/src/gnutls.c index 8db201ae83..48ea25397a 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -46,6 +46,10 @@ along with GNU Emacs. If not, see . */ # define HAVE_GNUTLS_MAC_GET_NONCE_SIZE #endif +#if GNUTLS_VERSION_NUMBER >= 0x030501 +# define HAVE_GNUTLS_EXT_GET_NAME +#endif + #ifdef HAVE_GNUTLS # ifdef WINDOWSNT @@ -237,6 +241,9 @@ DEF_DLL_FN (int, gnutls_hash_get_len, (gnutls_digest_algorithm_t)); DEF_DLL_FN (int, gnutls_hash, (gnutls_hash_hd_t, const void *, size_t)); DEF_DLL_FN (void, gnutls_hash_deinit, (gnutls_hash_hd_t, void *)); DEF_DLL_FN (void, gnutls_hash_output, (gnutls_hash_hd_t, void *)); +# ifdef HAVE_GNUTLS_EXT_GET_NAME +DEF_DLL_FN (const char *, gnutls_ext_get_name, (unsigned int)); +# endif # endif /* HAVE_GNUTLS3 */ @@ -356,6 +363,9 @@ init_gnutls_functions (void) LOAD_DLL_FN (library, gnutls_hash); LOAD_DLL_FN (library, gnutls_hash_deinit); LOAD_DLL_FN (library, gnutls_hash_output); +# ifdef HAVE_GNUTLS_EXT_GET_NAME + LOAD_DLL_FN (library, gnutls_ext_get_name); +# endif # endif /* HAVE_GNUTLS3 */ max_log_level = global_gnutls_log_level; @@ -469,8 +479,12 @@ init_gnutls_functions (void) # define gnutls_hash fn_gnutls_hash # define gnutls_hash_deinit fn_gnutls_hash_deinit # define gnutls_hash_output fn_gnutls_hash_output +# ifdef HAVE_GNUTLS_EXT_GET_NAME +# define gnutls_ext_get_name fn_gnutls_ext_get_name +# endif # endif /* HAVE_GNUTLS3 */ + /* This wrapper is called from fns.c, which doesn't know about the LOAD_DLL_FN stuff above. */ int @@ -2425,6 +2439,18 @@ Any GnuTLS extension with ID up to 100 #ifdef HAVE_GNUTLS +# ifdef WINDOWSNT + Lisp_Object found = Fassq (Qgnutls, Vlibrary_cache); + if (CONSP (found)) + return XCDR (found); + + /* Load the GnuTLS DLL and find exported functions. The external + library cache is updated after the capabilities have been + determined. */ + if (!init_gnutls_functions ()) + return Qnil; +# endif /* WINDOWSNT */ + capabilities = Fcons (intern("gnutls"), capabilities); # ifdef HAVE_GNUTLS3 @@ -2437,8 +2463,8 @@ Any GnuTLS extension with ID up to 100 # endif capabilities = Fcons (intern("macs"), capabilities); -# endif /* HAVE_GNUTLS3 */ +# ifdef HAVE_GNUTLS_EXT_GET_NAME for (unsigned int ext=0; ext < 100; ext++) { const char* name = gnutls_ext_get_name(ext); @@ -2447,18 +2473,11 @@ Any GnuTLS extension with ID up to 100 capabilities = Fcons (intern(name), capabilities); } } +# endif +# endif /* HAVE_GNUTLS3 */ # ifdef WINDOWSNT - Lisp_Object found = Fassq (Qgnutls, Vlibrary_cache); - if (CONSP (found)) - return XCDR (found); - else - { - Lisp_Object status; - status = init_gnutls_functions () ? capabilities : Qnil; - Vlibrary_cache = Fcons (Fcons (Qgnutls, status), Vlibrary_cache); - return status; - } + Vlibrary_cache = Fcons (Fcons (Qgnutls, capabilities), Vlibrary_cache); # endif /* WINDOWSNT */ #endif /* HAVE_GNUTLS */ commit 2f9d9efd080b46341f34b2cc2e29c907cd478de5 Author: Dmitry Gutov Date: Thu Dec 21 00:38:36 2017 +0200 ; Remove the mention of "plain C code" in the docstring as well diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el index 4efe443fba..f46e6da73d 100644 --- a/lisp/progmodes/prog-mode.el +++ b/lisp/progmodes/prog-mode.el @@ -53,8 +53,8 @@ "When non-nil, provides context for indenting embedded code chunks. There are languages where part of the code is actually written in -a sub language, e.g., a Yacc/Bison or ANTLR grammar also consists -of plain C code. This variable enables the primary mode of the +a sub language, e.g., a Yacc/Bison or ANTLR grammar can also include +JS or Python code. This variable enables the primary mode of the main language to use the indentation engine of the sub-mode for lines in code chunks written in the sub-mode's language. commit aca827b0d0b108e26628da04d01a4e8bac372bdd Merge: da0d7730b5 87548f5e98 Author: Dmitry Gutov Date: Thu Dec 21 00:34:07 2017 +0200 Merge branch 'widen-less' into emacs-26 commit 87548f5e98b450f2186d3fb5018ec34f4426351b Author: Dmitry Gutov Date: Thu Dec 21 00:33:48 2017 +0200 ; Rephrase NEWS entry a bit diff --git a/etc/NEWS b/etc/NEWS index eb076c943b..220508ee8a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1109,7 +1109,7 @@ environments or ANTLR programs with embedded Python code. A major mode can provide indentation context for a sub-mode. To support this, modes should use 'prog-first-column' instead of a -literal zero and never call 'widen' in their indentation functions. +literal zero and avoid calling 'widen' in their indentation functions. See the node "(elisp) Mode-Specific Indent" in the ELisp manual for more details. commit da0d7730b534ec5dee91c472246709d1c93df40c Author: Glenn Morris Date: Wed Dec 20 16:31:00 2017 -0500 ; * lisp/erc/erc.el: Update URL. diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 3906c9d32d..b0cd6d7e46 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -36,7 +36,7 @@ ;; For more information, see the following URLs: ;; * https://sv.gnu.org/projects/erc/ -;; * http://www.emacswiki.org/cgi-bin/wiki/ERC +;; * https://www.emacswiki.org/emacs/ERC @@ -75,12 +75,12 @@ (require 'erc-compat) (defvar erc-official-location - "https://emacswiki.org/cgi-bin/wiki/ERC (mailing list: erc-discuss@gnu.org)" + "https://www.emacswiki.org/emacs/ERC (mailing list: erc-discuss@gnu.org)" "Location of the ERC client on the Internet.") (defgroup erc nil "Emacs Internet Relay Chat client." - :link '(url-link "http://www.emacswiki.org/cgi-bin/wiki/ERC") + :link '(url-link "https://www.emacswiki.org/emacs/ERC") :link '(custom-manual "(erc) Top") :prefix "erc-" :group 'applications) commit 3a6051578b940a8592e7dda374d87e47c6eec79c Author: Glenn Morris Date: Wed Dec 20 16:29:40 2017 -0500 * lisp/erc/erc.el (erc-shorten-server-name): Silence compiler warning. diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index c6548b7eaf..3906c9d32d 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -6244,11 +6244,11 @@ This should be a string with substitution variables recognized by :group 'erc-mode-line-and-header :type 'string) -(defun erc-shorten-server-name (server-name) - "Shorten SERVER-NAME according to `erc-common-server-suffixes'." - (if (stringp server-name) +(defun erc-shorten-server-name (server) + "Shorten SERVER name according to `erc-common-server-suffixes'." + (if (stringp server) (with-temp-buffer - (insert server-name) + (insert server) (let ((alist erc-common-server-suffixes)) (while alist (goto-char (point-min)) commit 471b6c163f16fbc0b7c58c223bdb7f18ac7656e7 Author: Glenn Morris Date: Wed Dec 20 16:23:11 2017 -0500 ; Replace non-ascii quote characters in doc strings etc diff --git a/admin/last-chance.el b/admin/last-chance.el index 76b8bcf6db..cd3f78bd59 100644 --- a/admin/last-chance.el +++ b/admin/last-chance.el @@ -25,13 +25,13 @@ ;;; Commentary: ;; Late 2016. In a recent build, the date in a ChangeLog file -;; is not fontified. Turns out the face ‘change-log-date-face’ +;; is not fontified. Turns out the face `change-log-date-face' ;; was declared obsolete since 22.1 and removed 2016-06-23. ;; (compile "git show c430f7e23fc2c22f251ace4254e37dea1452dfc3") ;; -;; This library provides a command ‘last-chance’, which is a small +;; This library provides a command `last-chance', which is a small ;; combination of "git grep" and some regexp filtering. For example, -;; if point is on the symbol ‘change-log-date-face’ in the form: +;; if point is on the symbol `change-log-date-face' in the form: ;; ;; (define-obsolete-face-alias 'change-log-date-face ...) ;; @@ -39,7 +39,7 @@ ;; ;; M-x last-chance RET ;; -;; will show you any references to ‘change-log-date-face’ in the +;; will show you any references to `change-log-date-face' in the ;; *.el files in a new buffer (in Grep mode). Hopefully you see ;; only the obsolete declaration and can proceed w/ its removal. ;; If not, please DTRT and refrain from the removal until those @@ -59,17 +59,17 @@ This should include -n, -H, -F.") (defvar last-chance-uninteresting-regexps '("ChangeLog[.0-9]*:" "NEWS[-.0-9]*:" - ;; Add more ‘flush-lines’ args here. + ;; Add more `flush-lines' args here. ) "List of regexps that match uninteresting \"git grep\" hits.") (defvar-local last-chance-symbol nil - "Symbol set by ‘last-chance’ for ‘last-chance-cleanup’ to DTRT.") + "Symbol set by `last-chance' for `last-chance-cleanup' to DTRT.") (defun last-chance-cleanup (buffer status) "Filter lines in BUFFER; append STATUS and count of removed lines. -If BUFFER does not seem to be one created by ‘last-chance’, do nothing. -This function is intended to be added to ‘compilation-finish-functions’." +If BUFFER does not seem to be one created by `last-chance', do nothing. +This function is intended to be added to `compilation-finish-functions'." (let ((name (buffer-local-value 'last-chance-symbol buffer)) bef aft) (when name @@ -90,10 +90,10 @@ This function is intended to be added to ‘compilation-finish-functions’." (defun last-chance (symbol) "Grep the repo for SYMBOL, filtering the hits. -This uses ‘last-chance-grep-command’ to do the grep and the -regexps in ‘last-chance-uninteresting-regexps’ to filter the hits. -Grepping is recursive starting under the dir that ‘vc-root-dir’ -finds (or the default directory if ‘vc-root-dir’ finds nothing). +This uses `last-chance-grep-command' to do the grep and the +regexps in `last-chance-uninteresting-regexps' to filter the hits. +Grepping is recursive starting under the dir that `vc-root-dir' +finds (or the default directory if `vc-root-dir' finds nothing). Output goes to the *grep* buffer. Interactively, Emacs queries for a symbol, diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index d62d8128c1..1fdbb7307a 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -1253,7 +1253,7 @@ function directly; use `byte-compile-warn' or (defun byte-compile-report-error (error-info &optional fill) "Report Lisp error in compilation. ERROR-INFO is the error data, in the form of either (ERROR-SYMBOL . DATA) -or STRING. If FILL is non-nil, set ‘warning-fill-prefix’ to four spaces +or STRING. If FILL is non-nil, set `warning-fill-prefix' to four spaces when printing the error message." (setq byte-compiler-error-flag t) (byte-compile-log-warning diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 750958dab7..7ad66f5f3d 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -6245,14 +6245,14 @@ they are." (declare-function beginning-of-visual-line "simple" (&optional n)) (defun message-beginning-of-header (handle-folded) - "Move point to beginning of header’s value. + "Move point to beginning of header's value. When point is at the first header line, moves it after the colon and spaces separating header name and header value. When point is in a continuation line of a folded header (i.e. the line starts with a space), the behavior depends on HANDLE-FOLDED -argument. If it’s nil, function moves the point to the start of +argument. If it's nil, function moves the point to the start of the header continuation; otherwise, function locates the beginning of the header and moves point past the colon as is the case of single-line headers. @@ -6260,7 +6260,7 @@ case of single-line headers. No check whether point is inside of a header or body of the message is performed. -Returns point or nil if beginning of header’s value could not be +Returns point or nil if beginning of header's value could not be found. In the latter case, the point is still moved to the beginning of line (possibly after attempting to move it to the beginning of a folded header)." diff --git a/lisp/winner.el b/lisp/winner.el index 6bc27484a7..041e925360 100644 --- a/lisp/winner.el +++ b/lisp/winner.el @@ -353,7 +353,7 @@ You may want to include buffer names such as *Help*, *Apropos*, "Toggle Winner mode on or off. With a prefix argument ARG, enable Winner mode if ARG is positive, and disable it otherwise. If called from Lisp, enable -the mode if ARG is omitted or nil, and toggle it if ARG is ‘toggle’. +the mode if ARG is omitted or nil, and toggle it if ARG is `toggle'. Winner mode is a global minor mode that records the changes in the window configuration (i.e. how the frames are partitioned diff --git a/test/lisp/mouse-tests.el b/test/lisp/mouse-tests.el index f8c91004ec..170df4a9b9 100644 --- a/test/lisp/mouse-tests.el +++ b/test/lisp/mouse-tests.el @@ -26,8 +26,7 @@ ;;; Code: (ert-deftest bug23288-use-return-value () - "If ‘mouse-on-link-p’ returns a string, its first character is -used." + "If `mouse-on-link-p' returns a string, its first character is used." (cl-letf ((last-input-event '(down-mouse-1 nil 1)) (unread-command-events '((mouse-1 nil 1))) (mouse-1-click-follows-link t) @@ -37,8 +36,8 @@ used." (should (equal unread-command-events '(?a))))) (ert-deftest bug23288-translate-to-mouse-2 () - "If ‘mouse-on-link-p’ doesn’t return a string or vector, -translate ‘mouse-1’ events into ‘mouse-2’ events." + "If `mouse-on-link-p' doesn't return a string or vector, +translate `mouse-1' events into `mouse-2' events." (cl-letf ((last-input-event '(down-mouse-1 nil 1)) (unread-command-events '((mouse-1 nil 1))) (mouse-1-click-follows-link t) diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el index 4b41fc21c2..767d87a7e3 100644 --- a/test/src/emacs-module-tests.el +++ b/test/src/emacs-module-tests.el @@ -231,10 +231,9 @@ must evaluate to a regular expression string." (point) (point-max)))))))) (ert-deftest module--test-assertions--load-non-live-object () - "Check that -module-assertions verify that non-live objects -aren’t accessed." + "Check that -module-assertions verify that non-live objects aren't accessed." (skip-unless (file-executable-p mod-test-emacs)) - ;; This doesn’t yet cause undefined behavior. + ;; This doesn't yet cause undefined behavior. (should (eq (mod-test-invalid-store) 123)) (module--test-assertion (rx "Emacs value not found in " (+ digit) " values of " diff --git a/test/src/eval-tests.el b/test/src/eval-tests.el index 7ff60dd01c..15b2fdf9c4 100644 --- a/test/src/eval-tests.el +++ b/test/src/eval-tests.el @@ -28,14 +28,14 @@ (require 'ert) (ert-deftest eval-tests--bug24673 () - "Checks that Bug#24673 has been fixed." + "Check that Bug#24673 has been fixed." ;; This should not crash. (should-error (funcall '(closure)) :type 'invalid-function)) (defvar byte-compile-debug) (ert-deftest eval-tests--bugs-24912-and-24913 () - "Checks that Emacs doesn’t accept weird argument lists. + "Check that Emacs doesn't accept weird argument lists. Bug#24912 and Bug#24913." (dolist (args '((&optional) (&rest) (&optional &rest) (&rest &optional) (&optional &rest a) (&optional a &rest) diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el index 705d02fdff..4d8228b941 100644 --- a/test/src/fns-tests.el +++ b/test/src/fns-tests.el @@ -548,7 +548,7 @@ (should-error (nconc (cyc2 1 2) 'tail) :type 'circular-list)) (ert-deftest plist-get/odd-number-of-elements () - "Test that ‘plist-get’ doesn’t signal an error on degenerate plists." + "Test that `plist-get' doesn't signal an error on degenerate plists." (should-not (plist-get '(:foo 1 :bar) :bar))) (ert-deftest lax-plist-get/odd-number-of-elements () diff --git a/test/src/regex-tests.el b/test/src/regex-tests.el index b1f1ea71ce..220d42c8d2 100644 --- a/test/src/regex-tests.el +++ b/test/src/regex-tests.el @@ -27,13 +27,13 @@ "Path to regex-resources directory next to the \"regex-tests.el\" file.") (ert-deftest regex-word-cc-fallback-test () - "Test that ‘[[:cc:]]*x’ matches ‘x’ (bug#24020). + "Test that \"[[:cc:]]*x\" matches \"x\" (bug#24020). Test that a regex of the form \"[[:cc:]]*x\" where CC is a character class which matches a multibyte character X, matches string \"x\". -For example, ‘[[:word:]]*\u2620’ regex (note: \u2620 is a word +For example, \"[[:word:]]*\u2620\" regex (note: \u2620 is a word character) must match a string \"\u2420\"." (dolist (class '("[[:word:]]" "\\sw")) (dolist (repeat '("*" "+")) commit 7af7f5e15589407e1e78d0595fa93b20aa7dbb5a Author: Glenn Morris Date: Wed Dec 20 16:05:46 2017 -0500 Fix some more aliases to user options * lisp/cus-edit.el (custom-mode-hook): * lisp/erc/erc.el (erc-default-coding-system): * lisp/progmodes/python.el (python-indent, python-guess-indent) (python-shell-virtualenv-path) (python-shell-completion-module-string-code) (python-shell-completion-pdb-string-code, python-use-skeletons): Define aliases to user options before the options are defined. diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index efdadffa07..9993f9494f 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -4776,6 +4776,8 @@ If several parents are listed, go to the first of them." (parent (downcase (widget-get button :tag)))) (customize-group parent))))) +(define-obsolete-variable-alias 'custom-mode-hook 'Custom-mode-hook "23.1") + (defcustom Custom-mode-hook nil "Hook called when entering Custom mode." :type 'hook @@ -4804,7 +4806,6 @@ If several parents are listed, go to the first of them." (setq-local widget-link-suffix "")) (setq show-trailing-whitespace nil)) -(define-obsolete-variable-alias 'custom-mode-hook 'Custom-mode-hook "23.1") (define-derived-mode Custom-mode nil "Custom" "Major mode for editing customization buffers. diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index d75209a0e2..c6548b7eaf 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -122,8 +122,6 @@ "Running scripts at startup and with /LOAD" :group 'erc) -(require 'erc-backend) - ;; compatibility with older ERC releases (define-obsolete-variable-alias 'erc-announced-server-name @@ -135,6 +133,8 @@ (define-obsolete-function-alias 'erc-send-command 'erc-server-send "ERC 5.1") +(require 'erc-backend) + ;; tunable connection and authentication parameters (defcustom erc-server nil diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 035d93f7b9..4388cbdc06 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -725,12 +725,18 @@ It makes underscores and dots word constituent chars.") ;;; Indentation +(define-obsolete-variable-alias + 'python-indent 'python-indent-offset "24.3") + (defcustom python-indent-offset 4 "Default indentation offset for Python." :group 'python :type 'integer :safe 'integerp) +(define-obsolete-variable-alias + 'python-guess-indent 'python-indent-guess-indent-offset "24.3") + (defcustom python-indent-guess-indent-offset t "Non-nil tells Python mode to guess `python-indent-offset' value." :type 'boolean @@ -750,12 +756,6 @@ It makes underscores and dots word constituent chars.") :type '(repeat symbol) :group 'python) -(define-obsolete-variable-alias - 'python-indent 'python-indent-offset "24.3") - -(define-obsolete-variable-alias - 'python-guess-indent 'python-indent-guess-indent-offset "24.3") - (defvar python-indent-current-level 0 "Deprecated var available for compatibility.") @@ -2042,6 +2042,9 @@ executed through tramp connections." :type '(repeat string) :group 'python) +(define-obsolete-variable-alias + 'python-shell-virtualenv-path 'python-shell-virtualenv-root "25.1") + (defcustom python-shell-virtualenv-root nil "Path to virtualenv root. This variable, when set to a string, makes the environment to be @@ -2050,9 +2053,6 @@ virtualenv." :type '(choice (const nil) string) :group 'python) -(define-obsolete-variable-alias - 'python-shell-virtualenv-path 'python-shell-virtualenv-root "25.1") - (defcustom python-shell-setup-codes nil "List of code run by `python-shell-send-setup-codes'." :type '(repeat symbol) @@ -3289,14 +3289,6 @@ def __PYTHON_EL_get_completions(text): :type 'string :group 'python) -(defcustom python-shell-completion-string-code - "';'.join(__PYTHON_EL_get_completions('''%s'''))" - "Python code used to get a string of completions separated by semicolons. -The string passed to the function is the current python name or -the full statement in the case of imports." - :type 'string - :group 'python) - (define-obsolete-variable-alias 'python-shell-completion-module-string-code 'python-shell-completion-string-code @@ -3309,6 +3301,14 @@ the full statement in the case of imports." "25.1" "Completion string code must work for (i)pdb.") +(defcustom python-shell-completion-string-code + "';'.join(__PYTHON_EL_get_completions('''%s'''))" + "Python code used to get a string of completions separated by semicolons. +The string passed to the function is the current python name or +the full statement in the case of imports." + :type 'string + :group 'python) + (defcustom python-shell-completion-native-disabled-interpreters ;; PyPy's readline cannot handle some escape sequences yet. Native ;; completion was found to be non-functional for IPython (see @@ -4040,6 +4040,9 @@ JUSTIFY should be used (if applicable) as in `fill-paragraph'." ;;; Skeletons +(define-obsolete-variable-alias + 'python-use-skeletons 'python-skeleton-autoinsert "24.3") + (defcustom python-skeleton-autoinsert nil "Non-nil means template skeletons will be automagically inserted. This happens when pressing \"if\", for example, to prompt for @@ -4048,9 +4051,6 @@ the if condition." :group 'python :safe 'booleanp) -(define-obsolete-variable-alias - 'python-use-skeletons 'python-skeleton-autoinsert "24.3") - (defvar python-skeleton-available '() "Internal list of available skeletons.") commit 9f1c613b07e4a745671af5818366660e3765984d Author: Charles A. Roelli Date: Wed Dec 20 20:52:45 2017 +0100 Fix vc-region-history when narrowed * lisp/vc/vc.el (vc-region-history): Fix behavior when narrowed, by using line numbers starting from (point-min). diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index b159991500..f48f682096 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2417,8 +2417,8 @@ When called interactively with a prefix argument, prompt for REMOTE-LOCATION." (defun vc-region-history (from to) "Show the history of the region FROM..TO." (interactive "r") - (let* ((lfrom (line-number-at-pos from)) - (lto (line-number-at-pos (1- to))) + (let* ((lfrom (line-number-at-pos from t)) + (lto (line-number-at-pos (1- to) t)) (file buffer-file-name) (backend (vc-backend file)) (buf (get-buffer-create "*VC-history*"))) commit 7d392ccd69f4925bb9990c8267a2b710c80ec5c5 Author: Charles A. Roelli Date: Wed Dec 20 20:40:14 2017 +0100 Ensure current buffer is version-controlled in vc-region-history * lisp/vc/vc.el (vc-region-history): Ensure buffer is version-controlled. Otherwise if a user runs it in a non-version-controlled buffer, they get the error: Cannot open load file: No such file or directory, vc-nil diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 211feddc55..b159991500 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2422,6 +2422,8 @@ When called interactively with a prefix argument, prompt for REMOTE-LOCATION." (file buffer-file-name) (backend (vc-backend file)) (buf (get-buffer-create "*VC-history*"))) + (unless backend + (error "Buffer is not version controlled")) (with-current-buffer buf (setq-local vc-log-view-type 'long)) (vc-call region-history file buf lfrom lto) commit 79fb4b5438d1a5ccf695459de4df295e602fb7b3 Author: Glenn Morris Date: Wed Dec 20 14:31:03 2017 -0500 Fix some flymake aliases * lisp/progmodes/flymake-proc.el (flymake-xml-program) (flymake-compilation-prevents-syntax-check, flymake-master-file-dirs) (flymake-master-file-count-limit, flymake-allowed-file-name-masks): * lisp/progmodes/flymake.el (flymake-start-syntax-check-on-find-file): Define aliases to user options before the options are defined. diff --git a/lisp/progmodes/flymake-proc.el b/lisp/progmodes/flymake-proc.el index 85c60394d9..5e382b38b3 100644 --- a/lisp/progmodes/flymake-proc.el +++ b/lisp/progmodes/flymake-proc.el @@ -43,11 +43,17 @@ (require 'flymake) +(define-obsolete-variable-alias 'flymake-compilation-prevents-syntax-check + 'flymake-proc-compilation-prevents-syntax-check "26.1") + (defcustom flymake-proc-compilation-prevents-syntax-check t "If non-nil, don't start syntax check if compilation is running." :group 'flymake :type 'boolean) +(define-obsolete-variable-alias 'flymake-xml-program + 'flymake-proc-xml-program "26.1") + (defcustom flymake-proc-xml-program (if (executable-find "xmlstarlet") "xmlstarlet" "xml") "Program to use for XML validation." @@ -55,16 +61,25 @@ :group 'flymake :version "24.4") +(define-obsolete-variable-alias 'flymake-master-file-dirs + 'flymake-proc-master-file-dirs "26.1") + (defcustom flymake-proc-master-file-dirs '("." "./src" "./UnitTest") "Dirs where to look for master files." :group 'flymake :type '(repeat (string))) +(define-obsolete-variable-alias 'flymake-master-file-count-limit + 'flymake-proc-master-file-count-limit "26.1") + (defcustom flymake-proc-master-file-count-limit 32 "Max number of master files to check." :group 'flymake :type 'integer) +(define-obsolete-variable-alias 'flymake-allowed-file-name-masks + 'flymake-proc-allowed-file-name-masks "26.1") + (defcustom flymake-proc-allowed-file-name-masks '(("\\.\\(?:c\\(?:pp\\|xx\\|\\+\\+\\)?\\|CC\\)\\'" flymake-proc-simple-make-init @@ -1118,76 +1133,62 @@ Use CREATE-TEMP-F for creating temp copy." ;;;; -(progn - (define-obsolete-variable-alias 'flymake-compilation-prevents-syntax-check - 'flymake-proc-compilation-prevents-syntax-check "26.1") - (define-obsolete-variable-alias 'flymake-xml-program - 'flymake-proc-xml-program "26.1") - (define-obsolete-variable-alias 'flymake-master-file-dirs - 'flymake-proc-master-file-dirs "26.1") - (define-obsolete-variable-alias 'flymake-master-file-count-limit - 'flymake-proc-master-file-count-limit "26.1" - "Max number of master files to check.") - (define-obsolete-variable-alias 'flymake-allowed-file-name-masks - 'flymake-proc-allowed-file-name-masks "26.1") - (define-obsolete-variable-alias 'flymake-check-file-limit - 'flymake-proc-check-file-limit "26.1") - (define-obsolete-function-alias 'flymake-reformat-err-line-patterns-from-compile-el - 'flymake-proc-reformat-err-line-patterns-from-compile-el "26.1") - (define-obsolete-variable-alias 'flymake-err-line-patterns - 'flymake-proc-err-line-patterns "26.1") - (define-obsolete-function-alias 'flymake-parse-line - 'flymake-proc-parse-line "26.1") - (define-obsolete-function-alias 'flymake-get-include-dirs - 'flymake-proc-get-include-dirs "26.1") - (define-obsolete-function-alias 'flymake-stop-all-syntax-checks - 'flymake-proc-stop-all-syntax-checks "26.1") - (define-obsolete-function-alias 'flymake-compile - 'flymake-proc-compile "26.1") - (define-obsolete-function-alias 'flymake-create-temp-inplace - 'flymake-proc-create-temp-inplace "26.1") - (define-obsolete-function-alias 'flymake-create-temp-with-folder-structure - 'flymake-proc-create-temp-with-folder-structure "26.1") - (define-obsolete-function-alias 'flymake-init-create-temp-buffer-copy - 'flymake-proc-init-create-temp-buffer-copy "26.1") - (define-obsolete-function-alias 'flymake-simple-cleanup - 'flymake-proc-simple-cleanup "26.1") - (define-obsolete-function-alias 'flymake-get-real-file-name - 'flymake-proc-get-real-file-name "26.1") - (define-obsolete-function-alias 'flymake-master-cleanup - 'flymake-proc-master-cleanup "26.1") - (define-obsolete-function-alias 'flymake-get-make-cmdline - 'flymake-proc-get-make-cmdline "26.1") - (define-obsolete-function-alias 'flymake-get-ant-cmdline - 'flymake-proc-get-ant-cmdline "26.1") - (define-obsolete-function-alias 'flymake-simple-make-init-impl - 'flymake-proc-simple-make-init-impl "26.1") - (define-obsolete-function-alias 'flymake-simple-make-init - 'flymake-proc-simple-make-init "26.1") - (define-obsolete-function-alias 'flymake-master-make-init - 'flymake-proc-master-make-init "26.1") - (define-obsolete-function-alias 'flymake-find-make-buildfile - 'flymake-proc--find-make-buildfile "26.1") - (define-obsolete-function-alias 'flymake-master-make-header-init - 'flymake-proc-master-make-header-init "26.1") - (define-obsolete-function-alias 'flymake-simple-make-java-init - 'flymake-proc-simple-make-java-init "26.1") - (define-obsolete-function-alias 'flymake-simple-ant-java-init - 'flymake-proc-simple-ant-java-init "26.1") - (define-obsolete-function-alias 'flymake-simple-java-cleanup - 'flymake-proc-simple-java-cleanup "26.1") - (define-obsolete-function-alias 'flymake-perl-init - 'flymake-proc-perl-init "26.1") - (define-obsolete-function-alias 'flymake-php-init - 'flymake-proc-php-init "26.1") - (define-obsolete-function-alias 'flymake-simple-tex-init - 'flymake-proc-simple-tex-init "26.1") - (define-obsolete-function-alias 'flymake-master-tex-init - 'flymake-proc-master-tex-init "26.1") - (define-obsolete-function-alias 'flymake-xml-init - 'flymake-proc-xml-init "26.1")) - - +(define-obsolete-variable-alias 'flymake-check-file-limit + 'flymake-proc-check-file-limit "26.1") +(define-obsolete-function-alias 'flymake-reformat-err-line-patterns-from-compile-el + 'flymake-proc-reformat-err-line-patterns-from-compile-el "26.1") +(define-obsolete-variable-alias 'flymake-err-line-patterns + 'flymake-proc-err-line-patterns "26.1") +(define-obsolete-function-alias 'flymake-parse-line + 'flymake-proc-parse-line "26.1") +(define-obsolete-function-alias 'flymake-get-include-dirs + 'flymake-proc-get-include-dirs "26.1") +(define-obsolete-function-alias 'flymake-stop-all-syntax-checks + 'flymake-proc-stop-all-syntax-checks "26.1") +(define-obsolete-function-alias 'flymake-compile + 'flymake-proc-compile "26.1") +(define-obsolete-function-alias 'flymake-create-temp-inplace + 'flymake-proc-create-temp-inplace "26.1") +(define-obsolete-function-alias 'flymake-create-temp-with-folder-structure + 'flymake-proc-create-temp-with-folder-structure "26.1") +(define-obsolete-function-alias 'flymake-init-create-temp-buffer-copy + 'flymake-proc-init-create-temp-buffer-copy "26.1") +(define-obsolete-function-alias 'flymake-simple-cleanup + 'flymake-proc-simple-cleanup "26.1") +(define-obsolete-function-alias 'flymake-get-real-file-name + 'flymake-proc-get-real-file-name "26.1") +(define-obsolete-function-alias 'flymake-master-cleanup + 'flymake-proc-master-cleanup "26.1") +(define-obsolete-function-alias 'flymake-get-make-cmdline + 'flymake-proc-get-make-cmdline "26.1") +(define-obsolete-function-alias 'flymake-get-ant-cmdline + 'flymake-proc-get-ant-cmdline "26.1") +(define-obsolete-function-alias 'flymake-simple-make-init-impl + 'flymake-proc-simple-make-init-impl "26.1") +(define-obsolete-function-alias 'flymake-simple-make-init + 'flymake-proc-simple-make-init "26.1") +(define-obsolete-function-alias 'flymake-master-make-init + 'flymake-proc-master-make-init "26.1") +(define-obsolete-function-alias 'flymake-find-make-buildfile + 'flymake-proc--find-make-buildfile "26.1") +(define-obsolete-function-alias 'flymake-master-make-header-init + 'flymake-proc-master-make-header-init "26.1") +(define-obsolete-function-alias 'flymake-simple-make-java-init + 'flymake-proc-simple-make-java-init "26.1") +(define-obsolete-function-alias 'flymake-simple-ant-java-init + 'flymake-proc-simple-ant-java-init "26.1") +(define-obsolete-function-alias 'flymake-simple-java-cleanup + 'flymake-proc-simple-java-cleanup "26.1") +(define-obsolete-function-alias 'flymake-perl-init + 'flymake-proc-perl-init "26.1") +(define-obsolete-function-alias 'flymake-php-init + 'flymake-proc-php-init "26.1") +(define-obsolete-function-alias 'flymake-simple-tex-init + 'flymake-proc-simple-tex-init "26.1") +(define-obsolete-function-alias 'flymake-master-tex-init + 'flymake-proc-master-tex-init "26.1") +(define-obsolete-function-alias 'flymake-xml-init + 'flymake-proc-xml-init "26.1") (provide 'flymake-proc) ;;; flymake-proc.el ends here diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 66d1497b40..38813de1ef 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -124,15 +124,15 @@ If nil, never start checking buffer automatically like this." (make-obsolete-variable 'flymake-gui-warnings-enabled "it no longer has any effect." "26.1") +(define-obsolete-variable-alias 'flymake-start-syntax-check-on-find-file + 'flymake-start-on-flymake-mode "26.1") + (defcustom flymake-start-on-flymake-mode t "Start syntax check when `flymake-mode' is enabled. Specifically, start it when the buffer is actually displayed." :version "26.1" :type 'boolean) -(define-obsolete-variable-alias 'flymake-start-syntax-check-on-find-file - 'flymake-start-on-flymake-mode "26.1") - (defcustom flymake-log-level -1 "Obsolete and ignored variable." :type 'integer) commit 964dd38c8f71d13ab33ef1ba1f1e63c166c13fb6 Author: Glenn Morris Date: Wed Dec 20 14:28:04 2017 -0500 Unbreak a fileio test on non-Mac OS X systems * test/src/fileio-tests.el (fileio-tests--symlink-failure): Don't use an undefined coding system. ; No need to merge to master, since breaking commit wasn't merged. diff --git a/test/src/fileio-tests.el b/test/src/fileio-tests.el index 6962b68456..5ed67919a5 100644 --- a/test/src/fileio-tests.el +++ b/test/src/fileio-tests.el @@ -30,7 +30,10 @@ (defun fileio-tests--symlink-failure () (let* ((dir (make-temp-file "fileio" t)) (link (expand-file-name "link" dir)) - (file-name-coding-system 'utf-8-hfs-unix)) + (file-name-coding-system (if (and (eq system-type 'darwin) + (featurep 'ucs-normalize)) + 'utf-8-hfs-unix + file-name-coding-system))) (unwind-protect (let (failure (char 0)) commit 615c5cf0a6ba64af1e66e39722bc01334d484dcc Author: Philipp Stephani Date: Wed Dec 20 18:36:35 2017 +0100 Define helper functions only if needed * src/json.c (JSON_HAS_ERROR_CODE): New define. (json_parse_error): Use it. (json_has_prefix, json_has_suffix): Define only if needed. diff --git a/src/json.c b/src/json.c index 6d822224b2..48cf96a62b 100644 --- a/src/json.c +++ b/src/json.c @@ -30,6 +30,8 @@ along with GNU Emacs. If not, see . */ #include "buffer.h" #include "coding.h" +#define JSON_HAS_ERROR_CODE (JANSSON_VERSION_HEX >= 0x020B00) + #ifdef WINDOWSNT # include # include "w32.h" @@ -179,6 +181,8 @@ init_json (void) json_set_alloc_funcs (json_malloc, json_free); } +#if !JSON_HAS_ERROR_CODE + /* Return whether STRING starts with PREFIX. */ static bool @@ -200,6 +204,8 @@ json_has_suffix (const char *string, const char *suffix) && memcmp (string + string_len - suffix_len, suffix, suffix_len) == 0; } +#endif + /* Create a multibyte Lisp string from the UTF-8 string in [DATA, DATA + SIZE). If the range [DATA, DATA + SIZE) does not contain a valid UTF-8 string, an unspecified string is @@ -249,7 +255,7 @@ static _Noreturn void json_parse_error (const json_error_t *error) { Lisp_Object symbol; -#if JANSSON_VERSION_HEX >= 0x020B00 +#if JSON_HAS_ERROR_CODE switch (json_error_code (error)) { case json_error_premature_end_of_input: commit 4bb8e2879d31aa0e7ead0b384959c85b4ccc7c0c Author: Philipp Stephani Date: Wed Dec 20 18:30:23 2017 +0100 * src/json.c (json_parse_error): Fix embarrassing bug. diff --git a/src/json.c b/src/json.c index 1c9bf6d49b..6d822224b2 100644 --- a/src/json.c +++ b/src/json.c @@ -254,10 +254,13 @@ json_parse_error (const json_error_t *error) { case json_error_premature_end_of_input: symbol = Qjson_end_of_file; + break; case json_error_end_of_input_expected: symbol = Qjson_trailing_content; + break; default: symbol = Qjson_parse_error; + break; } #else if (json_has_suffix (error->text, "expected near end of file")) commit 909bea9e5abafde8cf1d7244503640796fbfc142 Author: Philipp Stephani Date: Wed Dec 20 18:06:28 2017 +0100 Fix a few compiler warnings in auth-source.el * lisp/auth-source.el (json): Add missing require. (auth-source-json-search): Remove unused argument. diff --git a/lisp/auth-source.el b/lisp/auth-source.el index e6582fa796..25a35c86bd 100644 --- a/lisp/auth-source.el +++ b/lisp/auth-source.el @@ -39,6 +39,7 @@ ;;; Code: +(require 'json) (require 'password-cache) (eval-when-compile (require 'cl-lib)) @@ -2015,7 +2016,7 @@ entries for git.gnus.org: always (plist-get item req))))) (cl-defun auth-source-json-search (&rest spec - &key backend require create + &key backend require type max host user port &allow-other-keys) "Given a property list SPEC, return search matches from the :backend. commit 4122d54067c61bbdff5aab7ddf5dfe5b5797b218 Author: Robert Pluim Date: Wed Dec 20 09:24:17 2017 +0100 Fix updating scrollbar sizes when scaling is in effect * src/gtkutil.c (xg_update_scrollbar_pos): Update width of scrollbar when scaling is in effect. (xg_update_horizontal_scrollbar_pos): Update scrollbar size when scaling is in effect. diff --git a/src/gtkutil.c b/src/gtkutil.c index 2708e5f0f7..ec1f70e461 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -3890,7 +3890,7 @@ xg_update_scrollbar_pos (struct frame *f, top /= scale; left /= scale; height /= scale; - left -= (scale - 1) * ((width / scale) >> 1); + width /= scale; /* Clear out old position. */ int oldx = -1, oldy = -1, oldw, oldh; @@ -3966,6 +3966,12 @@ xg_update_horizontal_scrollbar_pos (struct frame *f, GtkWidget *wfixed = f->output_data.x->edit_widget; GtkWidget *wparent = gtk_widget_get_parent (wscroll); gint msl; + int scale = xg_get_scale (f); + + top /= scale; + left /= scale; + height /= scale; + width /= scale; /* Clear out old position. */ int oldx = -1, oldy = -1, oldw, oldh; commit b9fbc03b862413bfee2728b1760f959bfc912e56 (refs/remotes/origin/widen-less) Author: Dmitry Gutov Date: Wed Dec 20 01:42:49 2017 +0200 Widen in indent-for-tab-command in the normal case, too Fixing this obvious omission. * lisp/indent.el (indent--funcall-widened): New function. (indent-for-tab-command): Use it. diff --git a/lisp/indent.el b/lisp/indent.el index ccf0e99c08..400280f615 100644 --- a/lisp/indent.el +++ b/lisp/indent.el @@ -142,13 +142,11 @@ prefix argument is ignored." (old-indent (current-indentation))) ;; Indent the line. - (or (not (eq (funcall indent-line-function) 'noindent)) + (or (not (eq (indent--funcall-widened indent-line-function) 'noindent)) (indent--default-inside-comment) (when (or (<= (current-column) (current-indentation)) (not (eq tab-always-indent 'complete))) - (save-restriction - (widen) - (funcall (default-value 'indent-line-function))))) + (indent--funcall-widened (default-value 'indent-line-function)))) (cond ;; If the text was already indented right, try completion. @@ -170,6 +168,11 @@ prefix argument is ignored." (< (point) end-marker)) (indent-rigidly (point) end-marker indentation-change)))))))))) +(defun indent--funcall-widened (func) + (save-restriction + (widen) + (funcall func))) + (defun insert-tab (&optional arg) (let ((count (prefix-numeric-value arg))) (if (and abbrev-mode commit 21a212f9e256a05a0fc67260d338d612cba77266 Author: Ted Zlatanov Date: Tue Dec 19 12:43:56 2017 -0500 Collect GnuTLS extensions and use them to set %DUMBFW if supported * lisp/net/gnutls.el (gnutls-boot-parameters): Use it to set %DUMBFW only when it's supported as "ClientHello Padding" (Bug#25061). * src/gnutls.c (Fgnutls_available_p): Get extension names and put them in the GnuTLS capabilities, using a hard-coded limit of 100 since GnuTLS MAX_EXT_TYPES is not exported. diff --git a/lisp/net/gnutls.el b/lisp/net/gnutls.el index a406b0b07f..608b6cfe9e 100644 --- a/lisp/net/gnutls.el +++ b/lisp/net/gnutls.el @@ -261,33 +261,37 @@ here's a recent version of the list. It must be omitted, a number, or nil; if omitted or nil it defaults to GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT." - (let ((trustfiles (or trustfiles (gnutls-trustfiles))) - (priority-string (or priority-string - (cond - ((eq type 'gnutls-anon) - "NORMAL:+ANON-DH:!ARCFOUR-128:%DUMBFW") - ((eq type 'gnutls-x509pki) - (if gnutls-algorithm-priority - (upcase gnutls-algorithm-priority) - "NORMAL:%DUMBFW"))))) - (verify-error (or verify-error - ;; this uses the value of `gnutls-verify-error' - (cond - ;; if t, pass it on - ((eq gnutls-verify-error t) - t) - ;; if a list, look for hostname matches - ((listp gnutls-verify-error) - (apply 'append - (mapcar - (lambda (check) - (when (string-match (nth 0 check) - hostname) - (nth 1 check))) - gnutls-verify-error))) - ;; else it's nil - (t nil)))) - (min-prime-bits (or min-prime-bits gnutls-min-prime-bits))) + (let* ((trustfiles (or trustfiles (gnutls-trustfiles))) + (maybe-dumbfw (if (memq 'ClientHello\ Padding (gnutls-available-p)) + ":%DUMBFW" + "")) + (priority-string (or priority-string + (cond + ((eq type 'gnutls-anon) + (concat "NORMAL:+ANON-DH:!ARCFOUR-128" + maybe-dumbfw)) + ((eq type 'gnutls-x509pki) + (if gnutls-algorithm-priority + (upcase gnutls-algorithm-priority) + (concat "NORMAL" maybe-dumbfw)))))) + (verify-error (or verify-error + ;; this uses the value of `gnutls-verify-error' + (cond + ;; if t, pass it on + ((eq gnutls-verify-error t) + t) + ;; if a list, look for hostname matches + ((listp gnutls-verify-error) + (apply 'append + (mapcar + (lambda (check) + (when (string-match (nth 0 check) + hostname) + (nth 1 check))) + gnutls-verify-error))) + ;; else it's nil + (t nil)))) + (min-prime-bits (or min-prime-bits gnutls-min-prime-bits))) (when verify-hostname-error (push :hostname verify-error)) diff --git a/src/gnutls.c b/src/gnutls.c index 4622011bc1..8db201ae83 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -2415,7 +2415,10 @@ GnuTLS 3 or higher : the list will contain `gnutls3'. GnuTLS MACs : the list will contain `macs'. GnuTLS digests : the list will contain `digests'. GnuTLS symmetric ciphers: the list will contain `ciphers'. -GnuTLS AEAD ciphers : the list will contain `AEAD-ciphers'. */) +GnuTLS AEAD ciphers : the list will contain `AEAD-ciphers'. +%DUMBFW : the list will contain `ClientHello\ Padding'. +Any GnuTLS extension with ID up to 100 + : the list will contain its name. */) (void) { Lisp_Object capabilities = Qnil; @@ -2436,6 +2439,15 @@ GnuTLS AEAD ciphers : the list will contain `AEAD-ciphers'. */) capabilities = Fcons (intern("macs"), capabilities); # endif /* HAVE_GNUTLS3 */ + for (unsigned int ext=0; ext < 100; ext++) + { + const char* name = gnutls_ext_get_name(ext); + if (name != NULL) + { + capabilities = Fcons (intern(name), capabilities); + } + } + # ifdef WINDOWSNT Lisp_Object found = Fassq (Qgnutls, Vlibrary_cache); if (CONSP (found)) commit 936136ecab567a2ca320df080595a5fd2693b4c3 Author: Stefan Monnier Date: Mon Dec 18 11:43:34 2017 -0500 * test/lisp/emacs-lisp/derived-tests.el: Fix copy&paste leftovers diff --git a/test/lisp/emacs-lisp/derived-tests.el b/test/lisp/emacs-lisp/derived-tests.el index adea102a78..8f65091694 100644 --- a/test/lisp/emacs-lisp/derived-tests.el +++ b/test/lisp/emacs-lisp/derived-tests.el @@ -1,4 +1,4 @@ -;;; gv-tests.el --- tests for gv.el -*- lexical-binding: t; -*- +;;; derived-tests.el --- tests for derived.el -*- lexical-binding: t; -*- ;; Copyright (C) 2017 Free Software Foundation, Inc. @@ -20,7 +20,6 @@ ;;; Code: (require 'ert) -(eval-when-compile (require 'cl-lib)) (define-derived-mode derived-tests--parent-mode prog-mode "P" :after-hook @@ -41,4 +40,4 @@ (derived-tests--child-mode) (should (equal (buffer-string) "PB CB MH AFP=S AFC=S "))))) -;;; gv-tests.el ends here +;;; derived-tests.el ends here commit 07b7fb98e6f980bae3dd15375dc8603b7e9cb61c Author: Stefan Monnier Date: Mon Dec 18 11:39:17 2017 -0500 * lisp/subr.el (delayed-after-hook-functions): Rename from ...-forms (run-mode-hooks): `funcall` the functions instead of `eval`ing the forms. * lisp/emacs-lisp/derived.el (define-derived-mode): Push functions rather than forms (bug#29679). diff --git a/lisp/emacs-lisp/derived.el b/lisp/emacs-lisp/derived.el index 751291afa8..c0ef199424 100644 --- a/lisp/emacs-lisp/derived.el +++ b/lisp/emacs-lisp/derived.el @@ -285,7 +285,7 @@ No problems result if this variable is not bound. (run-mode-hooks ',hook) ,@(when after-hook `((if delay-mode-hooks - (push ',after-hook delayed-after-hook-forms) + (push (lambda () ,after-hook) delayed-after-hook-functions) ,after-hook))))))) ;; PUBLIC: find the ultimate class of a derived mode. diff --git a/lisp/subr.el b/lisp/subr.el index 6db3b614d6..64521711b7 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1844,10 +1844,10 @@ if it is empty or a duplicate." (make-variable-buffer-local 'delayed-mode-hooks) (put 'delay-mode-hooks 'permanent-local t) -(defvar delayed-after-hook-forms nil +(defvar delayed-after-hook-functions nil "List of delayed :after-hook forms waiting to be run. These forms come from `define-derived-mode'.") -(make-variable-buffer-local 'delayed-after-hook-forms) +(make-variable-buffer-local 'delayed-after-hook-functions) (defvar change-major-mode-after-body-hook nil "Normal hook run in major mode functions, before the mode hooks.") @@ -1865,7 +1865,7 @@ just adds the HOOKS to the list `delayed-mode-hooks'. Otherwise, runs hooks in the sequence: `change-major-mode-after-body-hook', `delayed-mode-hooks' (in reverse order), HOOKS, then runs `hack-local-variables', runs the hook `after-change-major-mode-hook', and -finally evaluates the forms in `delayed-after-hook-forms' (see +finally evaluates the functions in `delayed-after-hook-functions' (see `define-derived-mode'). Major mode functions should use this instead of `run-hooks' when @@ -1882,9 +1882,9 @@ running their FOO-mode-hook." (with-demoted-errors "File local-variables error: %s" (hack-local-variables 'no-mode))) (run-hooks 'after-change-major-mode-hook) - (dolist (form (nreverse delayed-after-hook-forms)) - (eval form)) - (setq delayed-after-hook-forms nil))) + (dolist (fun (nreverse delayed-after-hook-functions)) + (funcall fun)) + (setq delayed-after-hook-functions nil))) (defmacro delay-mode-hooks (&rest body) "Execute BODY, but delay any `run-mode-hooks'. diff --git a/test/lisp/emacs-lisp/derived-tests.el b/test/lisp/emacs-lisp/derived-tests.el new file mode 100644 index 0000000000..adea102a78 --- /dev/null +++ b/test/lisp/emacs-lisp/derived-tests.el @@ -0,0 +1,44 @@ +;;; gv-tests.el --- tests for gv.el -*- lexical-binding: t; -*- + +;; Copyright (C) 2017 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Code: + +(require 'ert) +(eval-when-compile (require 'cl-lib)) + +(define-derived-mode derived-tests--parent-mode prog-mode "P" + :after-hook + (let ((f (let ((x "S")) (lambda () x)))) + (insert (format "AFP=%s " (let ((x "D")) (funcall f))))) + (insert "PB ")) + +(define-derived-mode derived-tests--child-mode derived-tests--parent-mode "C" + :after-hook + (let ((f (let ((x "S")) (lambda () x)))) + (insert (format "AFC=%s " (let ((x "D")) (funcall f))))) + (insert "CB ")) + +(ert-deftest derived-tests-after-hook-lexical () + (with-temp-buffer + (let ((derived-tests--child-mode-hook + (lambda () (insert "MH ")))) + (derived-tests--child-mode) + (should (equal (buffer-string) "PB CB MH AFP=S AFC=S "))))) + +;;; gv-tests.el ends here commit a5b0a4e29243d3cf91e2b5cd365ae9ce0ae48726 Author: Katsumi Yamaoka Date: Mon Dec 18 02:53:26 2017 +0000 * lisp/net/shr.el (shr-string-pixel-width): Return pixel-width, not position (bug#29734). diff --git a/lisp/net/shr.el b/lisp/net/shr.el index c505f25a5a..23f2ff75fa 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -595,10 +595,11 @@ size, and full-buffer size." ;; shr-pixel-column uses save-window-excursion, which can reset ;; point to 1. (let ((pt (point))) - (with-temp-buffer - (insert string) - (shr-pixel-column)) - (goto-char pt)))) + (prog1 + (with-temp-buffer + (insert string) + (shr-pixel-column)) + (goto-char pt))))) (defsubst shr--translate-insertion-chars () ;; Remove soft hyphens. commit 446faf3efa0f2d9ccdaf746348c3173b3eb7be2f Author: Dmitry Gutov Date: Mon Dec 18 02:30:41 2017 +0200 Replace the mention of c-indent-defun with js-indent-line * doc/lispref/text.texi (Mode-Specific Indent): Avoid mentioning c-indent-defun in the context of multi-mode indentation. diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index 67a303a599..0ec1998da4 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -2396,9 +2396,9 @@ text at point (@pxref{Completion in Buffers}). syntax belongs to a different major mode. Examples include @dfn{literate programming} source files that combine documentation and snippets of source code, Yacc/Bison programs that include snippets of -plain C code, etc. To correctly indent the embedded chunks, the primary +Python or JS code, etc. To correctly indent the embedded chunks, the primary mode needs to delegate the indentation to another mode's indentation -engine (e.g., call @code{c-indent-defun} for C code or +engine (e.g., call @code{js-indent-line} for JS code or @code{python-indent-line} for Python), while providing it with some context to guide the indentation. Major modes, for their part, should avoid calling @code{widen} in their indentation code and obey commit c51e797bbace83181a3c778ba610560e236ee62b Author: Charles A. Roelli Date: Sun Dec 17 17:09:55 2017 +0100 python.el doc fixes * lisp/progmodes/python.el (python-shell-accept-process-output): (python-shell-comint-end-of-output-p): (python-shell-first-prompt-hook): (python-info-beginning-of-backslash): Doc fixes. diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 2de40c4ab8..035d93f7b9 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -2451,7 +2451,7 @@ the `buffer-name'." Optional argument TIMEOUT is the timeout argument to `accept-process-output' calls. Optional argument REGEXP overrides the regexp to match the end of output, defaults to -`comint-prompt-regexp.'. Returns non-nil when output was +`comint-prompt-regexp'. Returns non-nil when output was properly captured. This utility is useful in situations where the output may be @@ -2469,7 +2469,7 @@ banner and the initial prompt are received separately." (throw 'found t)))))) (defun python-shell-comint-end-of-output-p (output) - "Return non-nil if OUTPUT is ends with input prompt." + "Return non-nil if OUTPUT ends with input prompt." (string-match ;; XXX: It seems on macOS an extra carriage return is attached ;; at the end of output, this handles that too. @@ -2674,10 +2674,9 @@ With argument MSG show activation/deactivation message." "Hook run upon first (non-pdb) shell prompt detection. This is the place for shell setup functions that need to wait for output. Since the first prompt is ensured, this helps the -current process to not hang waiting for output by safeguarding -interactive actions can be performed. This is useful to safely -attach setup code for long-running processes that eventually -provide a shell." +current process to not hang while waiting. This is useful to +safely attach setup code for long-running processes that +eventually provide a shell." :version "25.1" :type 'hook :group 'python) @@ -4826,7 +4825,7 @@ With optional argument LINE-NUMBER, check that line instead." (point-marker))))) (defun python-info-beginning-of-backslash (&optional line-number) - "Return the point where the backslashed line start. + "Return the point where the backslashed line starts. Optional argument LINE-NUMBER forces the line number to check against." (save-excursion (save-restriction commit c62ced5b4d48e5aeef9c3b4d9c6f1b687a9aaa79 Author: Tak Kunihiro Date: Sun Dec 17 11:19:19 2017 +0100 Make 'mouse-drag-and-drop-region' more robust and customizable * lisp/mouse.el (mouse-drag-and-drop-region-cut-when-buffers-differ): New option to permit 'mouse-drag-and-drop-region' to cut text also when source and destination buffers differ. (mouse-drag-and-drop-region-show-tooltip): New option to toggle display of tooltip during mouse dragging on graphic displays. (mouse-drag-and-drop-region-show-cursor): New option to toggle moving point with mouse cursor during mouse dragging of region. (mouse-drag-and-drop-region): New face to highlight original text while dragging. (mouse-drag-and-drop-region): Make use of new options and face. Ignore errors during tracking. diff --git a/lisp/mouse.el b/lisp/mouse.el index 17d1732e50..bbcc5c5ba0 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -2345,10 +2345,10 @@ choose a font." ;; Drag and drop support. (defcustom mouse-drag-and-drop-region nil - "If non-nil, dragging the mouse drags the region, if that exists. -If the value is a modifier, such as `control' or `shift' or `meta', -then if that modifier key is pressed when dropping the region, region -text is copied instead of being cut." + "If non-nil, dragging the mouse drags the region, if it exists. +If the value is a modifier, such as `control' or `shift' or +`meta', then if that modifier key is pressed when dropping the +region, text is copied instead of being cut." :type `(choice (const :tag "Disable dragging the region" nil) ,@(mapcar @@ -2361,6 +2361,45 @@ text is copied instead of being cut." :version "26.1" :group 'mouse) +(defcustom mouse-drag-and-drop-region-cut-when-buffers-differ nil + "If non-nil, cut text also when source and destination buffers differ. +If this option is nil, `mouse-drag-and-drop-region' will leave +the text in the source buffer alone when dropping it in a +different buffer. If this is non-nil, it will cut the text just +as it does when dropping text in the source buffer." + :type 'boolean + :version "26.1" + :group 'mouse) + +(defcustom mouse-drag-and-drop-region-show-tooltip 256 + "If non-nil, text is shown by a tooltip in a graphic display. +If this option is nil, `mouse-drag-and-drop-region' does not show +tooltips. If this is t, it shows the entire text dragged in a +tooltip. If this is an integer (as with the default value of +256), it will show that many characters of the dragged text in +a tooltip." + :type 'integer + :version "26.1" + :group 'mouse) + +(defcustom mouse-drag-and-drop-region-show-cursor t + "If non-nil, move point with mouse cursor during dragging. +If this is nil, `mouse-drag-and-drop-region' leaves point alone. +Otherwise, it will move point together with the mouse cursor and, +in addition, temporarily highlight the original region with the +`mouse-drag-and-drop-region' face." + :type 'boolean + :version "26.1" + :group 'mouse) + +(defface mouse-drag-and-drop-region '((t :inherit region)) + "Face to highlight original text during dragging. +This face is used by `mouse-drag-and-drop-region' to temporarily +highlight the original region when +`mouse-drag-and-drop-region-show-cursor' is non-nil." + :version "26.1" + :group 'mouse) + (defun mouse-drag-and-drop-region (event) "Move text in the region to point where mouse is dragged to. The transportation of text is also referred as `drag and drop'. @@ -2369,66 +2408,246 @@ modifier key was pressed when dropping, and the value of the variable `mouse-drag-and-drop-region' is that modifier, the text is copied instead of being cut." (interactive "e") - (require 'tooltip) - (let ((start (region-beginning)) - (end (region-end)) - (point (point)) - (buffer (current-buffer)) - (window (selected-window)) - value-selection) - (track-mouse - ;; When event was click instead of drag, skip loop - (while (progn - (setq event (read-event)) - (or (mouse-movement-p event) - ;; Handle `mouse-autoselect-window'. - (eq (car-safe event) 'select-window))) - (unless value-selection ; initialization - (delete-overlay mouse-secondary-overlay) - (setq value-selection (buffer-substring start end)) - (move-overlay mouse-secondary-overlay start end)) ; (deactivate-mark) - (ignore-errors (deactivate-mark) ; care existing region in other window - (mouse-set-point event) - (tooltip-show value-selection))) - (tooltip-hide)) - ;; Do not modify buffer under mouse when "event was click", - ;; "drag negligible", or - ;; "drag to read-only". - (if (or (equal (mouse-posn-property (event-end event) 'face) 'region) ; "event was click" - (member 'secondary-selection ; "drag negligible" - (mapcar (lambda (xxx) (overlay-get xxx 'face)) - (overlays-at (posn-point (event-end event))))) - buffer-read-only) - ;; Do not modify buffer under mouse. + (let* ((mouse-button (event-basic-type last-input-event)) + (mouse-drag-and-drop-region-show-tooltip + (when (and mouse-drag-and-drop-region-show-tooltip + (display-multi-frame-p) + (require 'tooltip)) + mouse-drag-and-drop-region-show-tooltip)) + (start (region-beginning)) + (end (region-end)) + (point (point)) + (buffer (current-buffer)) + (window (selected-window)) + (text-from-read-only buffer-read-only) + (mouse-drag-and-drop-overlay (make-overlay start end)) + point-to-paste + point-to-paste-read-only + window-to-paste + buffer-to-paste + cursor-in-text-area + no-modifier-on-drop + drag-but-negligible + clicked + value-selection ; This remains nil when event was "click". + text-tooltip + states + window-exempt) + + ;; STATES stores for each window on this frame its start and point + ;; positions so we can restore them on all windows but for the one + ;; where the drop occurs. For inter-frame drags we'll have to do + ;; this for all windows on all visible frames. In addition we save + ;; also the cursor type for the window's buffer so we can restore it + ;; in case we modified it. + ;; https://lists.gnu.org/archive/html/emacs-devel/2017-12/msg00090.html + (walk-window-tree + (lambda (window) + (setq states + (cons + (list + window + (copy-marker (window-start window)) + (copy-marker (window-point window)) + (with-current-buffer (window-buffer window) + cursor-type)) + states)))) + + (ignore-errors + (track-mouse + ;; When event was "click" instead of "drag", skip loop. + (while (progn + (setq event (read-key)) ; read-event or read-key + (or (mouse-movement-p event) + ;; Handle `mouse-autoselect-window'. + (eq (car-safe event) 'select-window))) + ;; Obtain the dragged text in region. When the loop was + ;; skipped, value-selection remains nil. + (unless value-selection + (setq value-selection (buffer-substring start end)) + (when mouse-drag-and-drop-region-show-tooltip + (let ((text-size mouse-drag-and-drop-region-show-tooltip)) + (setq text-tooltip + (if (and (integerp text-size) + (> (length value-selection) text-size)) + (concat + (substring value-selection 0 (/ text-size 2)) + "\n...\n" + (substring value-selection (- (/ text-size 2)) -1)) + value-selection)))) + + ;; Check if selected text is read-only. + (setq text-from-read-only (or text-from-read-only + (get-text-property start 'read-only) + (not (equal + (next-single-char-property-change + start 'read-only nil end) + end))))) + (setq window-to-paste (posn-window (event-end event))) + (setq point-to-paste (posn-point (event-end event))) + ;; Set nil when target buffer is minibuffer. + (setq buffer-to-paste (let (buf) + (when (windowp window-to-paste) + (setq buf (window-buffer window-to-paste)) + (when (not (minibufferp buf)) + buf)))) + (setq cursor-in-text-area (and window-to-paste + point-to-paste + buffer-to-paste)) + + (when cursor-in-text-area + ;; Check if point under mouse is read-only. + (save-window-excursion + (select-window window-to-paste) + (setq point-to-paste-read-only + (or buffer-read-only + (get-text-property point-to-paste 'read-only)))) + + ;; Check if "drag but negligible". Operation "drag but + ;; negligible" is defined as drag-and-drop the text to + ;; the original region. When modifier is pressed, the + ;; text will be inserted to inside of the original + ;; region. + (setq drag-but-negligible + (and (eq (overlay-buffer mouse-drag-and-drop-overlay) + buffer-to-paste) + (< (overlay-start mouse-drag-and-drop-overlay) + point-to-paste) + (< point-to-paste + (overlay-end mouse-drag-and-drop-overlay))))) + + ;; Show a tooltip. + (if mouse-drag-and-drop-region-show-tooltip + (tooltip-show text-tooltip) + (tooltip-hide)) + + ;; Show cursor and highlight the original region. + (when mouse-drag-and-drop-region-show-cursor + ;; Modify cursor even when point is out of frame. + (setq cursor-type (cond + ((not cursor-in-text-area) + nil) + ((or point-to-paste-read-only + drag-but-negligible) + 'hollow) + (t + 'bar))) + (when cursor-in-text-area + (overlay-put mouse-drag-and-drop-overlay + 'face 'mouse-drag-and-drop-region) + (deactivate-mark) ; Maintain region in other window. + (mouse-set-point event))))) + + ;; Hide a tooltip. + (when mouse-drag-and-drop-region-show-tooltip (tooltip-hide)) + + ;; Check if modifier was pressed on drop. + (setq no-modifier-on-drop + (not (member mouse-drag-and-drop-region (event-modifiers event)))) + + ;; Check if event was "click". + (setq clicked (not value-selection)) + + ;; Restore status on drag to outside of text-area or non-mouse input. + (when (or (not cursor-in-text-area) + (not (equal (event-basic-type event) mouse-button))) + (setq drag-but-negligible t + no-modifier-on-drop t)) + + ;; Do not modify any buffers when event is "click", + ;; "drag but negligible", or "drag to read-only". + (let* ((mouse-drag-and-drop-region-cut-when-buffers-differ + (if no-modifier-on-drop + mouse-drag-and-drop-region-cut-when-buffers-differ + (not mouse-drag-and-drop-region-cut-when-buffers-differ))) + (wanna-paste-to-same-buffer (equal buffer-to-paste buffer)) + (wanna-cut-on-same-buffer (and wanna-paste-to-same-buffer + no-modifier-on-drop)) + (wanna-cut-on-other-buffer + (and (not wanna-paste-to-same-buffer) + mouse-drag-and-drop-region-cut-when-buffers-differ)) + (cannot-paste (or point-to-paste-read-only + (when (or wanna-cut-on-same-buffer + wanna-cut-on-other-buffer) + text-from-read-only)))) + (cond - ;; "drag negligible" or "drag to read-only", restore region. - (value-selection - (select-window window) ; In case miss drag to other window + ;; Move point within region. + (clicked + (deactivate-mark) + (mouse-set-point event)) + ;; Undo operation. Set back the original text as region. + ((or (and drag-but-negligible + no-modifier-on-drop) + cannot-paste) + ;; Inform user either source or destination buffer cannot be modified. + (when (and (not drag-but-negligible) + cannot-paste) + (message "Buffer is read-only")) + + ;; Select source window back and restore region. + ;; (set-window-point window point) + (select-window window) (goto-char point) (setq deactivate-mark nil) (activate-mark)) - ;; "event was click" + ;; Modify buffers. (t - (deactivate-mark) - (mouse-set-point event))) - ;; Modify buffer under mouse by inserting text. - (push-mark) - (insert value-selection) - (when (not (equal (mark) (point))) ; on success insert - (setq deactivate-mark nil) - (activate-mark)) ; have region on destination - ;; Take care of initial region on source. - (if (equal (current-buffer) buffer) ; when same buffer - (let (deactivate-mark) ; remove text - (unless (member mouse-drag-and-drop-region (event-modifiers event)) - (kill-region (overlay-start mouse-secondary-overlay) - (overlay-end mouse-secondary-overlay)))) - (let ((window1 (selected-window))) ; when beyond buffer - (select-window window) - (goto-char point) ; restore point on source window - (activate-mark) ; restore region - (select-window window1)))) - (delete-overlay mouse-secondary-overlay))) + ;; * DESTINATION BUFFER:: + ;; Insert the text to destination buffer under mouse. + (select-window window-to-paste) + (setq window-exempt window-to-paste) + (goto-char point-to-paste) + (push-mark) + (insert value-selection) + ;; On success, set the text as region on destination buffer. + (when (not (equal (mark) (point))) + (setq deactivate-mark nil) + (activate-mark)) + + ;; * SOURCE BUFFER:: + ;; Set back the original text as region or delete the original + ;; text, on source buffer. + (if wanna-paste-to-same-buffer + ;; When source buffer and destination buffer are the same, + ;; remove the original text. + (when no-modifier-on-drop + (let (deactivate-mark) + (delete-region (overlay-start mouse-drag-and-drop-overlay) + (overlay-end mouse-drag-and-drop-overlay)))) + ;; When source buffer and destination buffer are different, + ;; keep (set back the original text as region) or remove the + ;; original text. + (select-window window) ; Select window with source buffer. + (goto-char point) ; Move point to the original text on source buffer. + + (if mouse-drag-and-drop-region-cut-when-buffers-differ + ;; Remove the dragged text from source buffer like + ;; operation `cut'. + (delete-region (overlay-start mouse-drag-and-drop-overlay) + (overlay-end mouse-drag-and-drop-overlay)) + ;; Set back the dragged text as region on source buffer + ;; like operation `copy'. + (activate-mark)) + (select-window window-to-paste)))))) + + ;; Clean up. + (delete-overlay mouse-drag-and-drop-overlay) + + ;; Restore old states but for the window where the drop + ;; occurred. Restore cursor types for all windows. + (dolist (state states) + (let ((window (car state))) + (when (and window-exempt + (not (eq window window-exempt))) + (set-window-start window (nth 1 state) 'noforce) + (set-marker (nth 1 state) nil) + ;; If window is selected, the following automatically sets + ;; point for that window's buffer. + (set-window-point window (nth 2 state)) + (set-marker (nth 2 state) nil)) + (with-current-buffer (window-buffer window) + (setq cursor-type (nth 3 state))))))) ;;; Bindings for mouse commands. commit 2e9eba2013521cb55dc4613733a65d3c6408c65f Author: Oscar Fuentes Date: Sat Dec 16 01:34:35 2017 +0100 Backport: Don't compare arguments that can be nil (Bug#28039) copy-region-as-kill can be called passing nil as `beg' and `end'. Magit does that, which caused an error when this advice was in effect. * lisp/ses.el (ses--advice-copy-region-as-kill): avoid comparison unless `beg' and `end' are non-nil. diff --git a/lisp/ses.el b/lisp/ses.el index 4c19c70c5d..188992c78f 100644 --- a/lisp/ses.el +++ b/lisp/ses.el @@ -3051,7 +3051,7 @@ We'll assume copying front-sticky properties doesn't make sense, either. This advice also includes some SES-specific code because otherwise it's too hard to override how mouse-1 works." - (when (> beg end) + (when (and beg end (> beg end)) (let ((temp beg)) (setq beg end end temp))) commit 89cfdbf729bc731331358e0efc69547547aa3ca2 Author: Noam Postavsky Date: Thu Dec 14 21:25:13 2017 -0500 Don't mess up syntax-ppss cache in electric-pair (Bug#29710) In Emacs 25 and above, calling `scan-sexps', `parse-partial-sexp', or similar may update the syntax-ppss cache if `parse-sexp-lookup-properties' is non-nil. Therefore, when calling any of these functions with a different than normal syntax-table, the cache must be cleaned afterwards. * lisp/elec-pair.el (electric-pair--with-uncached-syntax): New macro. (electric-pair--syntax-ppss, electric-pair--balance-info): Use it. diff --git a/lisp/elec-pair.el b/lisp/elec-pair.el index 7f523d1df4..a980f51d3c 100644 --- a/lisp/elec-pair.el +++ b/lisp/elec-pair.el @@ -24,6 +24,7 @@ ;;; Code: (require 'electric) +(eval-when-compile (require 'cl-lib)) ;;; Electric pairing. @@ -222,6 +223,22 @@ inside a comment or string." (electric-pair-mode nil)) (self-insert-command 1))) +(cl-defmacro electric-pair--with-uncached-syntax ((table &optional start) &rest body) + "Like `with-syntax-table', but flush the syntax-ppss cache afterwards. +Use this instead of (with-syntax-table TABLE BODY) when BODY +contains code which may update the syntax-ppss cache. This +includes calling `parse-partial-sexp' and any sexp-based movement +functions when `parse-sexp-lookup-properties' is non-nil. The +cache is flushed from position START, defaulting to point." + (declare (debug ((form &optional form) body)) (indent 1)) + (let ((start-var (make-symbol "start"))) + `(let ((syntax-propertize-function nil) + (,start-var ,(or start '(point)))) + (unwind-protect + (with-syntax-table ,table + ,@body) + (syntax-ppss-flush-cache ,start-var))))) + (defun electric-pair--syntax-ppss (&optional pos where) "Like `syntax-ppss', but sometimes fallback to `parse-partial-sexp'. @@ -240,7 +257,8 @@ when to fallback to `parse-partial-sexp'." (skip-syntax-forward " >!") (point))))) (if s-or-c-start - (with-syntax-table electric-pair-text-syntax-table + (electric-pair--with-uncached-syntax (electric-pair-text-syntax-table + s-or-c-start) (parse-partial-sexp s-or-c-start pos)) ;; HACK! cc-mode apparently has some `syntax-ppss' bugs (if (memq major-mode '(c-mode c++ mode)) @@ -293,7 +311,8 @@ If point is not enclosed by any lists, return ((t) . (t))." (cond ((< direction 0) (condition-case nil (eq (char-after pos) - (with-syntax-table table + (electric-pair--with-uncached-syntax + (table) (matching-paren (char-before (scan-sexps (point) 1))))) @@ -323,7 +342,7 @@ If point is not enclosed by any lists, return ((t) . (t))." (save-excursion (while (not outermost) (condition-case err - (with-syntax-table table + (electric-pair--with-uncached-syntax (table) (scan-sexps (point) (if (> direction 0) (point-max) (- (point-max)))) commit c5061d81b972d9b846359d6b9be1c5a0fc4a2402 Author: Glenn Morris Date: Sat Dec 16 16:12:18 2017 -0800 * etc/emacs.appdata.xml: Update file format. diff --git a/etc/emacs.appdata.xml b/etc/emacs.appdata.xml index c3b1afb628..6d9df8bf0b 100644 --- a/etc/emacs.appdata.xml +++ b/etc/emacs.appdata.xml @@ -1,10 +1,9 @@ - - emacs.desktop - GFDL-1.3 - - GPL-3.0+ and GFDL-1.3 + + org.gnu.emacs + GFDL-1.3+ + GPL-3.0+ and GFDL-1.3+ GNU Emacs An extensible text editor @@ -25,9 +24,12 @@ - https://www.gnu.org/software/emacs/images/appdata.png + + https://www.gnu.org/software/emacs/images/appdata.png + + emacs https://www.gnu.org/software/emacs - emacs-devel_at_gnu.org + emacs-devel_AT_gnu.org GNU - + commit 7e9eef0ffd90cd7e39f15b003e4a9770be27b0ce Author: Dmitry Gutov Date: Thu Dec 14 11:18:51 2017 +0200 Consolidate 'widen' calls * lisp/progmodes/prog-mode.el (prog-indentation-context): Un-document all elements but the first. (prog-widen): Remove. (http://lists.gnu.org/archive/html/emacs-devel/2017-12/msg00321.html) * doc/lispref/text.texi (Mode-Specific Indent): Update. * lisp/progmodes/ruby-mode.el (ruby-calculate-indent): Don't call widen. * lisp/progmodes/python.el (python-indent-guess-indent-offset) (python-info-current-defun): Replace prog-widen with widen; these functions are not called during indentation. (python-indent-context) (python-indent--calculate-indentation) (python-info-dedenter-opening-block-message) (python-info-line-ends-backslash-p) (python-info-beginning-of-backslash) (python-info-continuation-line-p) (python-info-current-defun): Remove 'widen' calls. * lisp/indent.el (indent-according-to-mode) (indent-for-tab-command, indent-region): Move them here. * lisp/textmodes/mhtml-mode.el (mhtml-indent-line): Bind prog-indentation-context to one-element list. diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index 1e19f75d68..67a303a599 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -2396,57 +2396,31 @@ text at point (@pxref{Completion in Buffers}). syntax belongs to a different major mode. Examples include @dfn{literate programming} source files that combine documentation and snippets of source code, Yacc/Bison programs that include snippets of -plain C code, etc. To correctly indent the embedded chunks, the major +plain C code, etc. To correctly indent the embedded chunks, the primary mode needs to delegate the indentation to another mode's indentation engine (e.g., call @code{c-indent-defun} for C code or @code{python-indent-line} for Python), while providing it with some -context to guide the indentation. The following facilities support -such multi-mode indentation. +context to guide the indentation. Major modes, for their part, should +avoid calling @code{widen} in their indentation code and obey +@code{prog-first-column}. @defvar prog-indentation-context This variable, when non-@code{nil}, holds the indentation context for the sub-mode's indentation engine provided by the superior major mode. -The value should be a list of the form @code{(@var{first-column} -@w{(@var{start} . @var{end})} @code{prev-chunk})}. The members of the -list have the following meaning: +The value should be a list of the form @code{(@var{first-column} . @var{rest}}. +The members of the list have the following meaning: @table @var @item first-column The column to be used for top-level constructs. This replaces the default value of the top-level column used by the sub-mode, usually zero. -@item start -@itemx end -The region of the code chunk to be indented by the sub-mode. The -value of @var{end} can be @code{nil}, which stands for the value of -@code{point-max}. -@item prev-chunk -If this is non-@code{nil}, it should provide the sub-mode's -indentation engine with a virtual context of the code chunk. Valid -values include: - -@itemize @minus -@item -A string whose contents is the text the sub-mode's indentation engine -should consider to precede the code chunk. The sub-mode's indentation -engine can add text properties to that string, to be reused in -repeated calls with the same string, thus using it as a cache. An -example where this is useful is code chunks that need to be indented -as function bodies, but lack the function's preamble---the string -could then include that missing preamble. -@item -A function. It is expected to be called with the start position of -the current chunk, and should return a cons cell -@w{@code{(@var{prev-start} . @var{prev-end})}} that specifies the -region of the previous code chunk, or @code{nil} if there is no previous -chunk. This is useful in literate-programming sources, where code is -split into chunks, and correct indentation needs to access previous -chunks. -@end itemize +@item rest +This value is currently unused. @end table @end defvar -The following convenience functions should be used by major mode's +The following convenience function should be used by major mode's indentation engine in support of invocations as sub-modes of another major mode. @@ -2457,16 +2431,6 @@ function's value is the column number to use for top-level constructs. When no superior mode is in effect, this function returns zero. @end defun -@defun prog-widen -Call this function instead of @code{widen} to remove any restrictions -imposed by the mode's indentation engine and restore the restrictions -recorded in @code{prog-indentation-context}. This prevents the -indentation engine of a sub-mode from inadvertently operating on text -outside of the chunk it was supposed to indent, and preserves the -restriction imposed by the superior mode. When no superior mode is in -effect, this function just calls @code{widen}. -@end defun - @node Region Indent @subsection Indenting an Entire Region diff --git a/etc/NEWS b/etc/NEWS index 4ccf468693..eb076c943b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1107,11 +1107,11 @@ This allows better indentation support in modes that support multiple programming languages in the same buffer, like literate programming environments or ANTLR programs with embedded Python code. -A major mode can provide indentation context for a sub-mode through -the 'prog-indentation-context' variable. To support this, modes that -provide indentation should use 'prog-widen' instead of 'widen' and -'prog-first-column' instead of a literal zero. See the node -"(elisp) Mode-Specific Indent" in the ELisp manual for more details. +A major mode can provide indentation context for a sub-mode. To +support this, modes should use 'prog-first-column' instead of a +literal zero and never call 'widen' in their indentation functions. +See the node "(elisp) Mode-Specific Indent" in the ELisp manual for +more details. ** ERC diff --git a/lisp/indent.el b/lisp/indent.el index d5ba0bd849..ccf0e99c08 100644 --- a/lisp/indent.el +++ b/lisp/indent.el @@ -69,6 +69,8 @@ variable is `indent-relative' or `indent-relative-maybe', handle it specially (since those functions are used for tabbing); in that case, indent by aligning to the previous non-blank line." (interactive) + (save-restriction + (widen) (syntax-propertize (line-end-position)) (if (memq indent-line-function '(indent-relative indent-relative-maybe)) @@ -84,7 +86,7 @@ that case, indent by aligning to the previous non-blank line." (indent-line-to column) (save-excursion (indent-line-to column)))) ;; The normal case. - (funcall indent-line-function))) + (funcall indent-line-function)))) (defun indent--default-inside-comment () (unless (or (> (current-column) (current-indentation)) @@ -144,7 +146,9 @@ prefix argument is ignored." (indent--default-inside-comment) (when (or (<= (current-column) (current-indentation)) (not (eq tab-always-indent 'complete))) - (funcall (default-value 'indent-line-function)))) + (save-restriction + (widen) + (funcall (default-value 'indent-line-function))))) (cond ;; If the text was already indented right, try completion. @@ -538,7 +542,9 @@ column to indent to; if it is nil, use one of the three methods above." (forward-line 1))))) ;; Use indent-region-function is available. (indent-region-function - (funcall indent-region-function start end)) + (save-restriction + (widen) + (funcall indent-region-function start end))) ;; Else, use a default implementation that calls indent-line-function on ;; each line. (t (indent-region-line-by-line start end))) diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el index f727e458b2..4efe443fba 100644 --- a/lisp/progmodes/prog-mode.el +++ b/lisp/progmodes/prog-mode.el @@ -54,7 +54,7 @@ There are languages where part of the code is actually written in a sub language, e.g., a Yacc/Bison or ANTLR grammar also consists -of plain C code. This variable enables the major mode of the +of plain C code. This variable enables the primary mode of the main language to use the indentation engine of the sub-mode for lines in code chunks written in the sub-mode's language. @@ -64,37 +64,13 @@ mode, it should bind this variable to non-nil around the call. The non-nil value should be a list of the form: - (FIRST-COLUMN (START . END) PREVIOUS-CHUNKS) + (FIRST-COLUMN . REST) FIRST-COLUMN is the column the indentation engine of the sub-mode should use for top-level language constructs inside the code chunk (instead of 0). -START and END specify the region of the code chunk. END can be -nil, which stands for the value of `point-max'. The function -`prog-widen' uses this to restore restrictions imposed by the -sub-mode's indentation engine. - -PREVIOUS-CHUNKS, if non-nil, provides the indentation engine of -the sub-mode with the virtual context of the code chunk. Valid -values are: - - - A string containing text which the indentation engine can - consider as standing in front of the code chunk. To cache the - string's calculated syntactic information for repeated calls - with the same string, the sub-mode can add text-properties to - the string. - - A typical use case is for grammars with code chunks which are - to be indented like function bodies -- the string would contain - the corresponding function preamble. - - - A function, to be called with the start position of the current - chunk. It should return either the region of the previous chunk - as (PREV-START . PREV-END), or nil if there is no previous chunk. - - A typical use case are literate programming sources -- the - function would successively return the previous code chunks.") +REST is currently unused.") (defun prog-indent-sexp (&optional defun) "Indent the expression after point. @@ -113,23 +89,6 @@ instead." "Return the indentation column normally used for top-level constructs." (or (car prog-indentation-context) 0)) -(defun prog-widen () - "Remove restrictions (narrowing) from current code chunk or buffer. -This function should be used instead of `widen' in any function used -by the indentation engine to make it respect the value of -`prog-indentation-context'. - -This function (like `widen') is useful inside a -`save-restriction' to make the indentation correctly work when -narrowing is in effect." - (let ((chunk (cadr prog-indentation-context))) - (if chunk - ;; No call to `widen' is necessary here, as narrow-to-region - ;; changes (not just narrows) the existing restrictions - (narrow-to-region (car chunk) (or (cdr chunk) (point-max))) - (widen)))) - - (defvar-local prettify-symbols-alist nil "Alist of symbol prettifications. Each element looks like (SYMBOL . CHARACTER), where the symbol diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index d4226e5ce7..b8926529d1 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -287,10 +287,6 @@ ;;; 24.x Compat -(unless (fboundp 'prog-widen) - (defun prog-widen () - (widen))) - (unless (fboundp 'prog-first-column) (defun prog-first-column () 0)) @@ -785,7 +781,7 @@ work on `python-indent-calculate-indentation' instead." (interactive) (save-excursion (save-restriction - (prog-widen) + (widen) (goto-char (point-min)) (let ((block-end)) (while (and (not block-end) @@ -883,8 +879,6 @@ keyword :at-dedenter-block-start - Point is on a line starting a dedenter block. - START is the position where the dedenter block starts." - (save-restriction - (prog-widen) (let ((ppss (save-excursion (beginning-of-line) (syntax-ppss)))) @@ -1022,7 +1016,7 @@ keyword (looking-at (python-rx block-ender))) :after-block-end) (t :after-line)) - (point))))))))) + (point)))))))) (defun python-indent--calculate-indentation () "Internal implementation of `python-indent-calculate-indentation'. @@ -1030,8 +1024,6 @@ May return an integer for the maximum possible indentation at current context or a list of integers. The latter case is only happening for :at-dedenter-block-start context since the possibilities can be narrowed to specific indentation points." - (save-restriction - (prog-widen) (save-excursion (pcase (python-indent-context) (`(:no-indent . ,_) (prog-first-column)) ; usually 0 @@ -1081,7 +1073,7 @@ possibilities can be narrowed to specific indentation points." (`(,(or :inside-paren-newline-start-from-block) . ,start) ;; Add two indentation levels to make the suite stand out. (goto-char start) - (+ (current-indentation) (* python-indent-offset 2))))))) + (+ (current-indentation) (* python-indent-offset 2)))))) (defun python-indent--calculate-levels (indentation) "Calculate levels list given INDENTATION. @@ -4590,7 +4582,7 @@ Optional argument INCLUDE-TYPE indicates to include the type of the defun. This function can be used as the value of `add-log-current-defun-function' since it returns nil if point is not inside a defun." (save-restriction - (prog-widen) + (widen) (save-excursion (end-of-line 1) (let ((names) @@ -4788,12 +4780,10 @@ likely an invalid python file." "Message the first line of the block the current statement closes." (let ((point (python-info-dedenter-opening-block-position))) (when point - (save-restriction - (prog-widen) (message "Closes %s" (save-excursion (goto-char point) (buffer-substring - (point) (line-end-position)))))))) + (point) (line-end-position))))))) (defun python-info-dedenter-statement-p () "Return point if current statement is a dedenter. @@ -4809,8 +4799,6 @@ statement." "Return non-nil if current line ends with backslash. With optional argument LINE-NUMBER, check that line instead." (save-excursion - (save-restriction - (prog-widen) (when line-number (python-util-goto-line line-number)) (while (and (not (eobp)) @@ -4819,14 +4807,12 @@ With optional argument LINE-NUMBER, check that line instead." (not (equal (char-before (point)) ?\\))) (forward-line 1)) (when (equal (char-before) ?\\) - (point-marker))))) + (point-marker)))) (defun python-info-beginning-of-backslash (&optional line-number) "Return the point where the backslashed line start. Optional argument LINE-NUMBER forces the line number to check against." (save-excursion - (save-restriction - (prog-widen) (when line-number (python-util-goto-line line-number)) (when (python-info-line-ends-backslash-p) @@ -4835,15 +4821,13 @@ Optional argument LINE-NUMBER forces the line number to check against." (python-syntax-context 'paren)) (forward-line -1)) (back-to-indentation) - (point-marker))))) + (point-marker)))) (defun python-info-continuation-line-p () "Check if current line is continuation of another. When current line is continuation of another return the point where the continued line ends." (save-excursion - (save-restriction - (prog-widen) (let* ((context-type (progn (back-to-indentation) (python-syntax-context-type))) @@ -4869,7 +4853,7 @@ where the continued line ends." (python-util-forward-comment -1) (when (and (equal (1- line-start) (line-number-at-pos)) (python-info-line-ends-backslash-p)) - (point-marker)))))))) + (point-marker))))))) (defun python-info-block-continuation-line-p () "Return non-nil if current line is a continuation of a block." diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index dc1b0f8e2d..7c10114334 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -1364,7 +1364,6 @@ delimiter." "\\)\\>"))) (eq (ruby-deep-indent-paren-p t) 'space) (not (bobp))) - (widen) (goto-char (or begin parse-start)) (skip-syntax-forward " ") (current-column)) diff --git a/lisp/textmodes/mhtml-mode.el b/lisp/textmodes/mhtml-mode.el index 09da155f48..79c1125ff6 100644 --- a/lisp/textmodes/mhtml-mode.el +++ b/lisp/textmodes/mhtml-mode.el @@ -341,9 +341,7 @@ This is used by `mhtml--pre-command'.") ((eq mhtml-tag-relative-indent 'ignore) (setq base-indent 0))) (narrow-to-region region-start (point-max)) - (let ((prog-indentation-context (list base-indent - (cons (point-min) nil) - nil))) + (let ((prog-indentation-context (list base-indent))) (mhtml--with-locals submode ;; indent-line-function was rebound by ;; mhtml--with-locals.