diff --git a/ChangeLog.3 b/ChangeLog.3 index c8dd40b5eb6..6418f9c8a2c 100644 --- a/ChangeLog.3 +++ b/ChangeLog.3 @@ -1,3 +1,99 @@ +2020-08-03 Phil Sainty + + lisp/so-long.el: Improve support for major mode hooks + + * lisp/so-long.el (so-long-remember-all, so-long-disable-minor-modes) + (so-long-override-variables): Store and use the `so-long-minor-modes' + and `so-long-variable-overrides' values seen by the original major + mode, so that buffer-local changes made in the major mode hook will be + respected. + + Add documentation of this and other major mode hook usage. + +2020-08-02 Grégory Mounié (tiny change) + + Avoid segfaults if XIM is set but not xim_styles + + Emacs segfaults at the X11 initialization if XIM is set + and xim_styles is NULL. This patch avoids the crash. + * src/xfns.c: Check also if FRAME_X_XIM_STYLES(f) is NULL. + (Bug#42676) (Bug#42673) (Bug#42677) + +2020-07-31 Philipp Stephani + + Backport: Make checking for liveness of global values more precise. + + We can't just use a hash lookup because a global and a local reference + might refer to the same Lisp object. + + * src/emacs-module.c (module_free_global_ref): More precise check for + global liveness. + + (cherry picked from commit 9f01ce6327af886f26399924a9aadf16cdd4fd9f) + +2020-07-31 Philipp Stephani + + Backport: Fix subtle bug when checking liveness of module values. + + We can't simply look up the Lisp object in the global reference table + because an invalid local and a valid global reference might refer to + the same object. Instead, we have to test the address of the global + reference against the stored references. + + * src/emacs-module.c (module_global_reference_p): New helper function. + (value_to_lisp): Use it. + + (cherry picked from commit 6355a3ec62f43c9b99d483982ff851d32dd78891) + +2020-07-31 Philipp Stephani + + Backport: Fix memory leak for global module objects (Bug#42482). + + Instead of storing the global values in a global 'emacs_value_storage' + object, store them as hash values alongside the reference counts. + That way the garbage collector takes care of cleaning them up. + + * src/emacs-module.c (global_storage): Remove. + (struct module_global_reference): New pseudovector type. + (XMODULE_GLOBAL_REFERENCE): New helper function. + (module_make_global_ref, module_free_global_ref): Use + 'module_global_reference' struct for global reference values. + (value_to_lisp, module_handle_nonlocal_exit): Adapt to deletion of + 'global_storage'. + + (cherry picked from commit 5c5eb9790898e4ab10bcbbdb6871947ed3018569) + +2020-07-30 Nicolas Petton + + * admin/authors.el (authors-aliases): Remove a faulty regexp. + +2020-07-29 Stefan Kangas + + * doc/lispref/symbols.texi (Definitions): Fix typo. + +2020-07-28 Nicolas Petton + + * etc/HISTORY: Add Emacs 27.1 release date. + +2020-07-28 Nicolas Petton + + Bump Emacs version to 27.1 + + * README: + * configure.ac: + * msdos/sed2v2.inp: + * nt/README.W32: Bump Emacs version. + +2020-07-28 Nicolas Petton + + * etc/AUTHORS: Update. + +2020-07-28 Nicolas Petton + + Update authors.el + + * admin/authors.el (authors-aliases): Add author aliases. + 2020-07-28 Nicolas Petton * etc/NEWS: Remove temporary markup. @@ -142382,7 +142478,7 @@ This file records repository revisions from commit 9d56a21e6a696ad19ac65c4b405aeca44785884a (exclusive) to -commit 56f958807c0b8ea8f45e3c088157ca144a1b1fac (inclusive). +commit 1ca4da054be7eb340c511d817f3ec89c8b819db7 (inclusive). See ChangeLog.2 for earlier changes. ;; Local Variables: diff --git a/etc/HISTORY b/etc/HISTORY index f0fd7d6f218..a6b9f57814f 100644 --- a/etc/HISTORY +++ b/etc/HISTORY @@ -220,7 +220,7 @@ GNU Emacs 26.2 (2019-04-12) emacs-26.2 GNU Emacs 26.3 (2019-08-28) emacs-26.3 -GNU Emacs 27.1 (2020-08-06) emacs-27.1 +GNU Emacs 27.1 (2020-08-10) emacs-27.1 ---------------------------------------------------------------------- diff --git a/etc/NEWS.27 b/etc/NEWS.27 index a056f5c1e82..d0a24c23f3a 100644 --- a/etc/NEWS.27 +++ b/etc/NEWS.27 @@ -595,7 +595,7 @@ the node "(emacs) Directory Variables" of the user manual. ** Network connections using 'local' can now use IPv6. 'make-network-process' now uses the correct loopback address when -asked to use ':host 'local' and ':family 'ipv6'. +asked to use ":host 'local" and ":family 'ipv6". ** The new function 'replace-region-contents' replaces the current region using a given replacement-function in a non-destructive manner diff --git a/lisp/ldefs-boot.el b/lisp/ldefs-boot.el index ae58bfc566b..7077925602c 100644 --- a/lisp/ldefs-boot.el +++ b/lisp/ldefs-boot.el @@ -31062,7 +31062,7 @@ values), despite potential performance issues, type \\[so-long-revert]. Use \\[so-long-commentary] for more information. -Use \\[so-long-customize] to configure the behavior. +Use \\[so-long-customize] to configure the behaviour. \(fn)" t nil) @@ -31099,7 +31099,7 @@ or call the function `global-so-long-mode'.") (custom-autoload 'global-so-long-mode "so-long" nil) (autoload 'global-so-long-mode "so-long" "\ -Toggle automated performance mitigation for files with long lines. +Toggle automated performance mitigations for files with long lines. If called interactively, enable Global So-Long mode if ARG is positive, and disable it if ARG is zero or negative. If called from @@ -31118,7 +31118,7 @@ When such files are detected by `so-long-predicate', we invoke the selected Use \\[so-long-commentary] for more information. -Use \\[so-long-customize] to configure the behavior. +Use \\[so-long-customize] to configure the behaviour. \(fn &optional ARG)" t nil) diff --git a/lisp/so-long.el b/lisp/so-long.el index f2c078ba841..f8a5cc920d9 100644 --- a/lisp/so-long.el +++ b/lisp/so-long.el @@ -255,8 +255,7 @@ ;; `so-long-mode', completely bypassing the automated decision process. ;; Refer to M-: (info "(emacs) Specifying File Variables") RET ;; -;; If so-long itself is causing problems, it can be inhibited by setting the -;; `so-long-enabled' variable to nil, or by disabling the global mode with +;; If so-long itself causes problems, disable the automated behaviour with ;; M-- M-x global-so-long-mode, or M-: (global-so-long-mode 0) ;; * Example configuration @@ -282,6 +281,43 @@ ;; '((show-trailing-whitespace . nil) ;; (truncate-lines . nil)))) +;; * Mode-specific configuration +;; ----------------------------- +;; The `so-long-predicate' function is called in the context of the buffer's +;; original major mode, and therefore major mode hooks can be used to control +;; the criteria for calling `so-long' in any given mode (plus its derivatives) +;; by setting buffer-local values for the variables in question. This includes +;; `so-long-predicate' itself, as well as any variables used by the predicate +;; when determining the result. By default this means `so-long-max-lines', +;; `so-long-skip-leading-comments', and `so-long-threshold'. E.g.: +;; +;; (add-hook 'js-mode-hook 'my-js-mode-hook) +;; +;; (defun my-js-mode-hook () +;; "Custom `js-mode' behaviours." +;; (setq-local so-long-max-lines 100) +;; (setq-local so-long-threshold 1000)) +;; +;; `so-long-variable-overrides' and `so-long-minor-modes' may also be given +;; buffer-local values in order to apply different settings to different types +;; of file. For example, the Bidirectional Parentheses Algorithm does not apply +;; to `<' and `>' characters by default, and therefore one might prefer to not +;; set `bidi-inhibit-bpa' in XML files, on the basis that XML files with long +;; lines are less likely to trigger BPA-related performance problems: +;; +;; (add-hook 'nxml-mode-hook 'my-nxml-mode-hook) +;; +;; (defun my-nxml-mode-hook () +;; "Custom `nxml-mode' behaviours." +;; (require 'so-long) +;; (setq-local so-long-variable-overrides +;; (remove '(bidi-inhibit-bpa . t) so-long-variable-overrides))) +;; +;; Finally, note that setting `so-long-target-modes' to nil buffer-locally in +;; a major mode hook would prevent that mode from ever being targeted. With +;; `prog-mode' being targeted by default, specific derivatives of `prog-mode' +;; could therefore be un-targeted if desired. + ;; * Other ways of using so-long ;; ----------------------------- ;; It may prove useful to automatically invoke major mode `so-long-mode' for @@ -376,7 +412,6 @@ ;; - Added mode-line indicator, user option `so-long-mode-line-label', ;; and faces `so-long-mode-line-active', `so-long-mode-line-inactive'. ;; - New help commands `so-long-commentary' and `so-long-customize'. -;; - Renamed `so-long-mode-enabled' to `so-long-enabled'. ;; - Refactored the default hook values using variable overrides ;; (and returning all the hooks to nil default values). ;; - Performance improvements for `so-long-detected-long-line-p'. @@ -416,9 +451,14 @@ (declare-function longlines-mode "longlines") (defvar longlines-mode) (defvar so-long-enabled nil - "Set to nil to prevent `so-long' from being triggered automatically. - -Has no effect if `global-so-long-mode' is not enabled.") + ;; This was initially a renaming of the old `so-long-mode-enabled' and + ;; documented as "Set to nil to prevent `so-long' from being triggered + ;; automatically."; however `so-long--ensure-enabled' may forcibly re-enable + ;; it contrary to the user's expectations, so for the present this should be + ;; considered internal-use only (with `global-so-long-mode' the interface + ;; for enabling or disabling the automated behaviour). FIXME: Establish a + ;; way to support the original use-case, or rename to `so-long--enabled'. + "Internal use. Non-nil when any so-long functionality has been used.") (defvar-local so-long--active nil ; internal use "Non-nil when `so-long' mitigations are in effect.") @@ -886,9 +926,15 @@ buffer-local." Stores the existing value for each entry in `so-long-variable-overrides'. Stores the name of each enabled mode from the list `so-long-minor-modes'. +The lists themselves are also remembered, so that major mode hooks can +provide buffer-local modifications which are still accessible after changing +to `so-long-mode'. + If RESET is non-nil, remove any existing values before storing the new ones." (when reset (setq so-long-original-values nil)) + (so-long-remember 'so-long-variable-overrides) + (so-long-remember 'so-long-minor-modes) (dolist (ovar so-long-variable-overrides) (so-long-remember (car ovar))) (dolist (mode so-long-minor-modes) @@ -1288,7 +1334,7 @@ Calls `so-long-disable-minor-modes' and `so-long-override-variables'." (defun so-long-disable-minor-modes () "Disable any active minor modes listed in `so-long-minor-modes'." - (dolist (mode so-long-minor-modes) + (dolist (mode (so-long-original 'so-long-minor-modes)) (when (and (boundp mode) mode) (funcall mode 0)))) @@ -1304,7 +1350,7 @@ The modes are enabled in accordance with what was remembered in `so-long'." (defun so-long-override-variables () "Set the buffer-local values defined by `so-long-variable-overrides'." - (dolist (ovar so-long-variable-overrides) + (dolist (ovar (so-long-original 'so-long-variable-overrides)) (set (make-local-variable (car ovar)) (cdr ovar)))) (defun so-long-restore-variables () @@ -1879,7 +1925,7 @@ If it appears in `%s', you should remove it." ; LocalWords: defadvice nadvice whitespace ie bos eos eobp origmode un Un setq ; LocalWords: docstring auf Wiedersehen longlines alist autoload Refactored Inc ; LocalWords: MERCHANTABILITY RET REGEXP VAR ELPA WS mitigations EmacsWiki eval -; LocalWords: rx filename filenames bidi bpa +; LocalWords: rx filename filenames js defun bidi bpa prog FIXME ;; So long, farewell, auf Wiedersehen, goodbye ;; You have to go, this code is minified