commit e2cc16fbd0d16e6c0ff59221af49e3d4113500cd (HEAD, refs/remotes/origin/master) Author: F. Jason Park Date: Tue Jul 18 22:18:00 2023 -0700 Warn when toggling erc-nicks-mode in target buffers * lisp/erc/erc-nicks.el (erc-nicks-mode, erc-nicks-enable): This local module isn't autoloaded like most global modules, in part to dissuade users from attempting to enable it by running M-x erc-nicks-mode RET. However, rather than signal an error upon detecting such an attempt, ERC should explain that the only supported means of activation is via `erc-modules'. This change does that and then enables it anyway, despite the degraded experience. diff --git a/lisp/erc/erc-nicks.el b/lisp/erc/erc-nicks.el index 3f753adc625..67f513f8d3e 100644 --- a/lisp/erc/erc-nicks.el +++ b/lisp/erc/erc-nicks.el @@ -480,6 +480,12 @@ nicks "Uniquely colorize nicknames in target buffers." ((if erc--target (progn + (erc-with-server-buffer + (unless erc-nicks-mode + (erc--warn-once-before-connect 'erc-nicks-mode + "Module `nicks' must be enabled or disabled session-wide." + " Toggling it in individual target buffers is unsupported.") + (erc-nicks-mode +1))) ; but do it anyway (setq erc-nicks--downcased-skip-nicks (mapcar #'erc-downcase erc-nicks-skip-nicks)) (add-function :filter-return (local 'erc-button--modify-nick-function) commit 8af96d831ffd7144a28145ed024418143fde857b Author: F. Jason Park Date: Sat Jul 15 19:11:37 2023 -0700 ; Address some ambiguities in ERC's documentation * doc/misc/erc.texi: Change name of example function from `erc-my-enable-read-indicator-on-join' to `erc-my-enable-keep-place-indicator-on-join'. Fix example functions `erc-cmd-TRACK' and `erc-cmd-UNTRACK' to work with server buffers as well as target buffers. * etc/ERC-NEWS: Revise `keep-place' entry and make headlines less redundant. * lisp/erc/erc.el (erc-accidental-paste-threshold-seconds): Fix portion of existing wording that was more likely interpreted as a single multiline submission, whereas the intended meaning is three separate submissions. diff --git a/doc/misc/erc.texi b/doc/misc/erc.texi index 63ea94d9b2e..2e216629a1d 100644 --- a/doc/misc/erc.texi +++ b/doc/misc/erc.texi @@ -1218,15 +1218,14 @@ Sample Configuration learning it. For our purposes, it's just a means of presenting configuration details in a tidy, standardized format. If it helps, just pretend it's some make-believe, pseudo configuration language. -Although the syntax below is easy enough to intuit and adapt to your -setup, you may wish to keep the following in mind (or @pxref{Top,,, -use-package,}): +And while the syntax below is easy enough to intuit and adapt to your +setup, you may wish to keep the following in mind: @itemize @bullet @item Each @code{use-package} ``declaration'' focuses on a library ``feature'', which is just a symbol you'd normally @code{require} in -your config @pxref{Named Features,,, elisp,}). +your config. @item Emacs loads anything in a @code{:config} section @emph{after} loading @@ -1235,6 +1234,10 @@ Sample Configuration @item Everything in a @code{:custom} or @code{:custom-face} section is basically something you'd find in your @code{custom-file}. + +@item +For more info, @pxref{Named Features,,, elisp,}, or @pxref{Top,,, +use-package,}. @end itemize @noindent @@ -1300,12 +1303,12 @@ Sample Configuration (use-package erc-goodies ;; Turn on read indicators when joining channels. - :hook (erc-join . my-erc-enable-read-indicator-on-join)) + :hook (erc-join . my-erc-enable-keep-place-indicator-on-join)) (defvar my-erc-read-indicator-channels '("#emacs") "Channels in which to show a `keep-place-indicator'.") -(defun my-erc-enable-read-indicator-on-join () +(defun my-erc-enable-keep-place-indicator-on-join () "Enable read indicators for certain queries or channels." (when (member (erc-default-target) my-erc-read-indicator-channels) (erc-keep-place-indicator-mode +1))) @@ -1313,14 +1316,16 @@ Sample Configuration ;; Handy commands from the Emacs Wiki. (defun erc-cmd-TRACK (&optional target) "Start tracking TARGET or that of current buffer." - (setq erc-track-exclude (delete (or target (erc-default-target)) - erc-track-exclude))) + (setq erc-track-exclude + (delete (or target (erc-default-target) (current-buffer)) + erc-track-exclude))) (defun erc-cmd-UNTRACK (&optional target) "Stop tracking TARGET or that of current buffer." - (setq erc-track-exclude (cl-pushnew (or target (erc-default-target)) - erc-track-exclude - :test #'equal))) + (setq erc-track-exclude + (cl-pushnew (or target (erc-default-target) (current-buffer)) + erc-track-exclude + :test #'equal))) @end lisp diff --git a/etc/ERC-NEWS b/etc/ERC-NEWS index cd0b8e5f823..4c881e32ab4 100644 --- a/etc/ERC-NEWS +++ b/etc/ERC-NEWS @@ -15,13 +15,14 @@ GNU Emacs since Emacs version 22.1. * Changes in ERC 5.6 ** Module 'keep-place' has gained a more flamboyant cousin. -Remember your place in ERC buffers a bit more easily while retaining -the freedom to look around. Optionally sync the indicator to any -progress made when you haven't yet caught up to the live stream. See -options 'erc-keep-place-indicator-style' and friends, and try M-x +Remember your place in ERC buffers more easily while retaining the +freedom to look around, all with the help of a configurable, visible +indicator. Optionally sync the indicator to any progress made when +you haven't yet caught up to the live stream. See options +'erc-keep-place-indicator-style' and friends, and try M-x keep-place-indicator-mode to see it in action. -** Module 'fill' now offers a style based on 'visual-line-mode'. +** Module 'fill' offers a style based on 'visual-line-mode'. This fill style mimics the "hanging indent" look of 'erc-fill-static' and provides some movement and editing commands to optionally tame the less familiar aspects of 'visual-line' behavior. An interactive @@ -29,7 +30,7 @@ helper called 'erc-fill-wrap-nudge' allows for dynamic "refilling" of buffers on the fly. Set 'erc-fill-function' to 'erc-fill-wrap' to get started. -** A new module for nickname highlighting has joined ERC. +** A module for nickname highlighting has joined ERC. Automatic nickname coloring has come to ERC core. Users familiar with 'erc-hl-nicks', from which this module directly descends, will already be familiar with its suite of handy options. By default, each @@ -140,7 +141,7 @@ This is especially handy when using the option 'erc-fill-wrap-merge' to omit repeated speaker tags, which can make message boundaries less detectable by tired eyes. -** Some keybindings are now set by modules rather than their libraries. +** Modules rather than their libraries set major-mode keybindings. To put it another way, simply loading a built-in module's library no longer modifies 'erc-mode-map'. Instead, modifications occur during module setup. This should not impact most user configs since ERC @@ -149,7 +150,7 @@ previously created. Note that while all affected bindings still reside in 'erc-mode-map', future built-in modules will use their own minor-mode maps, and new third-party modules should do the same. -** The option 'erc-timestamp-format-right' has been deprecated. +** Option 'erc-timestamp-format-right' deprecated. Having to account for this option prevented other ERC modules from easily determining what right-hand stamps would look like before insertion, which is knowledge needed for certain UI decisions. The @@ -270,7 +271,7 @@ encouraged to keep a module's name aligned with its group's as well as the provided feature of its containing library, if only for the usual reasons of namespace hygiene and discoverability. -*** ERC now supports arbitrary CHANTYPES. +*** ERC supports arbitrary CHANTYPES. Specifically, channels can be prefixed with any predesignated character, mainly to afford more flexibility to specialty services, like bridges to other protocols. @@ -281,7 +282,7 @@ specify a subcommand to actually carry out anything of consequence. Built-in modules can now provide more detailed help for a particular subcommand by telling ERC to defer to a specialized handler. -*** Longtime quasi modules have been made proper. +*** Longtime quasi modules made proper. The 'fill' module is now defined by 'define-erc-module'. The same goes for ERC's imenu integration, which has 'imenu' now appearing in the default value of 'erc-modules'. @@ -299,7 +300,7 @@ third-party code, the key takeaway is that more 'font-lock-face' properties encountered in the wild may be combinations of faces rather than lone ones. -*** Prompt input is split before 'erc-pre-send-functions' has a say. +*** Prompt input split before 'erc-pre-send-functions' gets a say. Hook members are now treated to input whose lines have already been adjusted to fall within the allowed length limit. For convenience, third-party code can request that the final input be "re-filled" prior diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 03c21059a92..eca6a90d706 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -6350,7 +6350,9 @@ erc-accidental-paste-threshold-seconds from being sent to the server. Offending sources include terminal multiplexers, desktop-automation scripts, and anything capable of rapidly submitting successive lines of prompt input. -For example, entering \"one\\ntwo\\nthree\\n\" will send \"one\" +For example, if you could somehow manage to type \"one \\`RET' +two \\`RET' three \\`RET'\" at the prompt in less than +`erc-accidental-paste-threshold-seconds', ERC would send \"one\" to the server, leave \"two\" at the prompt, and insert \"three\" into an \"overflow\" buffer. See `erc-inhibit-multiline-input' and `erc-warn-about-blank-lines' for suppression involving input commit f9f9c95ab578dee680093cf3f1e618c770fc22c3 Author: Alan Mackenzie Date: Wed Jul 19 11:23:00 2023 +0000 Fix native compilation in dynamically bound files. This fixes bug#64642. * lisp/emacs-lisp/comp.el (comp-spill-lap-function/symbol): Add code for dynamically bound functions. * test/src/comp-tests.el (comp-tests-result-lambda): New test. * test/src/comp-resources/comp-test-funcs-dyn2.el: New test file. # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # # On branch master # Your branch is up to date with 'origin/master'. # # Changes to be committed: # modified: lisp/emacs-lisp/comp.el # new file: test/src/comp-resources/comp-test-funcs-dyn2.el # modified: test/src/comp-tests.el # # Changes not staged for commit: # modified: .gitignore # # Untracked files: # .gitignore.acm # .gitignore.backup # .timestamps.txt # 2021-01-03.err # 2021-01-06.err # 2021-12-16.make # 2021-12-30.err # 2021-12-31.err # 2022-01-01.err # 2022-01-02.check.err # 2022-01-02.err # 2022-01-04.err # 2022-01-05.err # 2022-01-06.err # 2022-01-07.err # 2022-01-07.outerr # 2022-01-08.err # 2022-01-09.err # 2022-01-09b.err # 2022-01-10.err # 2022-01-11 # 2022-01-11.err # 2022-02-22.err # 2022-02-22.outerr # checkout.20220228.out # checkout.20220301.out # checkout.20220302.out # doc/lispref/syntax.20160318.techsi # doc/lispref/syntax.20160318b.techsi # lib/.deps/ # lisp/2022-01-09.err # lisp/emacs-lisp/comp.el.rej # src/2021-12-20.err # src/globals.20211124.aitch # src/lisp.20211127.aitch # test/lisp/calendar/icalendar-tests.elcr5m9Wq # diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 4892733d456..b35e1b97e9d 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -1301,33 +1301,45 @@ comp-spill-lap-function (make-temp-file (comp-c-func-name function-name "freefn-") nil ".eln"))) (let* ((f (symbol-function function-name)) + (byte-code (byte-compile function-name)) (c-name (comp-c-func-name function-name "F")) - (func (make-comp-func-l :name function-name - :c-name c-name - :doc (documentation f t) - :int-spec (interactive-form f) - :command-modes (command-modes f) - :speed (comp-spill-speed function-name) - :pure (comp-spill-decl-spec function-name - 'pure)))) + (func + (if (comp-lex-byte-func-p byte-code) + (make-comp-func-l :name function-name + :c-name c-name + :doc (documentation f t) + :int-spec (interactive-form f) + :command-modes (command-modes f) + :speed (comp-spill-speed function-name) + :pure (comp-spill-decl-spec function-name + 'pure)) + (make-comp-func-d :name function-name + :c-name c-name + :doc (documentation f t) + :int-spec (interactive-form f) + :command-modes (command-modes f) + :speed (comp-spill-speed function-name) + :pure (comp-spill-decl-spec function-name + 'pure))))) (when (byte-code-function-p f) (signal 'native-compiler-error '("can't native compile an already byte-compiled function"))) - (setf (comp-func-byte-func func) - (byte-compile (comp-func-name func))) + (setf (comp-func-byte-func func) byte-code) (let ((lap (byte-to-native-lambda-lap (gethash (aref (comp-func-byte-func func) 1) byte-to-native-lambdas-h)))) (cl-assert lap) (comp-log lap 2 t) - (let ((arg-list (aref (comp-func-byte-func func) 0))) - (setf (comp-func-l-args func) - (comp-decrypt-arg-list arg-list function-name) - (comp-func-lap func) - lap - (comp-func-frame-size func) - (comp-byte-frame-size (comp-func-byte-func func)))) - (setf (comp-ctxt-top-level-forms comp-ctxt) + (if (comp-func-l-p func) + (let ((arg-list (aref (comp-func-byte-func func) 0))) + (setf (comp-func-l-args func) + (comp-decrypt-arg-list arg-list function-name))) + (setf (comp-func-d-lambda-list func) (cadr f))) + (setf (comp-func-lap func) + lap + (comp-func-frame-size func) + (comp-byte-frame-size (comp-func-byte-func func)) + (comp-ctxt-top-level-forms comp-ctxt) (list (make-byte-to-native-func-def :name function-name :c-name c-name))) (comp-add-func-to-ctxt func)))) diff --git a/test/src/comp-resources/comp-test-funcs-dyn2.el b/test/src/comp-resources/comp-test-funcs-dyn2.el new file mode 100644 index 00000000000..3d70489d1ca --- /dev/null +++ b/test/src/comp-resources/comp-test-funcs-dyn2.el @@ -0,0 +1,31 @@ +;;; comp-test-funcs-dyn2.el -*- lexical-binding: nil; no-byte-compile: t; -*- + +;; Copyright (C) 2023 Free Software Foundation, Inc. + +;; Author: Alan Mackenzie + +;; 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 . + +;;; Commentary: +;; Test the compilation of a function under dynamic binding. + +;;; Code: + +(defun comp-tests-result-lambda () + (lambda (bar) (car bar))) + +(provide 'comp-test-funcs-dyn2) +;;; comp-test-funcs-dyn2.el ends here. diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index ce7899d9d4c..30dfd669ded 100644 --- a/test/src/comp-tests.el +++ b/test/src/comp-tests.el @@ -33,7 +33,8 @@ (eval-and-compile (defconst comp-test-src (ert-resource-file "comp-test-funcs.el")) - (defconst comp-test-dyn-src (ert-resource-file "comp-test-funcs-dyn.el"))) + (defconst comp-test-dyn-src (ert-resource-file "comp-test-funcs-dyn.el")) + (defconst comp-test-dyn-src2 (ert-resource-file "comp-test-funcs-dyn2.el"))) (when (native-comp-available-p) (message "Compiling tests...") @@ -44,6 +45,7 @@ ;; names used in this file. (require 'comp-test-funcs comp-test-src) (require 'comp-test-dyn-funcs comp-test-dyn-src) ;Non-standard feature name! +(require 'comp-test-funcs-dyn2 comp-test-dyn-src2) (defmacro comp-deftest (name args &rest docstring-and-body) "Define a test for the native compiler tagging it as :nativecomp." @@ -1528,4 +1530,7 @@ comp-tests-cond-rw-checker-type (equal (comp-mvar-typeset mvar) comp-tests-cond-rw-expected-type)))))))) +(ert-deftest comp-tests-result-lambda () + (native-compile 'comp-tests-result-lambda) + (should (eq (funcall (comp-tests-result-lambda) '(a . b)) 'a))) ;;; comp-tests.el ends here