From 5c77cc958451b3bc9ddb6752be1d32f50cba3e41 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Fri, 1 Oct 2021 09:31:40 -0700 Subject: [PATCH 01/51] ; * admin/release-branch.txt: Tweak previous. --- admin/release-branch.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/admin/release-branch.txt b/admin/release-branch.txt index 3318d8de806..0c393a9eccb 100644 --- a/admin/release-branch.txt +++ b/admin/release-branch.txt @@ -3,7 +3,8 @@ Instructions for cutting the Emacs release branch 1. In the clone of the Emacs Git repository, switch to the 'master' branch, "git pull", and build it (using 'make bootstrap') to make sure it's not broken. Run 'make check-expensive' and ensure all - tests pass. + tests pass. (Alternatively, verify that the automated build + servers are showing success for the latest revision.) 2. Create the release branch and switch to it. Assuming that it is for releasing Emacs versions XY.1, XY.2, etc., the command is: From 9307889d68222bad1a7e449d3adddac40da788cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Sat, 2 Oct 2021 00:49:48 +0100 Subject: [PATCH 02/51] Simplify shorthand injection (bug#50946) * lisp/loadup.el: Load "shorthands" relatively late. Set load-source-file-function to load-with-shorthands-and-code-conversion * lisp/international/mule.el (hack-elisp-shorthands) (load-with-shorthands-and-code-conversion): Move to lisp/shorthands.el * lisp/shorthands.el: New file. --- lisp/international/mule.el | 32 ---------------------- lisp/loadup.el | 6 ++++- lisp/shorthands.el | 55 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 33 deletions(-) create mode 100644 lisp/shorthands.el diff --git a/lisp/international/mule.el b/lisp/international/mule.el index 2298af42b28..2a855b56736 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el @@ -294,31 +294,6 @@ attribute." (apply 'define-charset-internal name (mapcar 'cdr attrs)))) -(defun hack-elisp-shorthands (fullname) - "Return value of the `elisp-shorthands' file-local variable in FULLNAME. -FULLNAME is the absolute file name of an Elisp .el file which -potentially specifies a file-local value for `elisp-shorthands'. -The Elisp code in FULLNAME isn't read or evaluated in any way, except -for extraction of the buffer-local value of `elisp-shorthands'." - (let ((size (nth 7 (file-attributes fullname)))) - (with-temp-buffer - (insert-file-contents fullname nil (max 0 (- size 3000)) size) - (goto-char (point-max)) - (let* ((found (search-backward-regexp "elisp-shorthands:[ \t]*" 0 t)) - (val (and found - (goto-char (match-end 0)) - (ignore-errors (read (current-buffer))))) - (probe val) - aux) - (catch 'done - (when (consp probe) - (while (setq aux (pop probe)) - (unless (and (consp aux) - (stringp (car aux)) - (stringp (cdr aux))) - (throw 'done nil))) - val)))))) - (defun load-with-code-conversion (fullname file &optional noerror nomessage) "Execute a file of Lisp code named FILE whose absolute name is FULLNAME. The file contents are decoded before evaluation if necessary. @@ -378,13 +353,6 @@ Return t if file exists." (message "Loading %s...done" file))) t))) -(defun load-with-shorthands-and-code-conversion (fullname file noerror nomessage) - "Like `load-with-code-conversion', but also consider Elisp shorthands. -This function uses shorthands defined in the file FULLNAME's local -value of `elisp-shorthands', when it processes that file's Elisp code." - (let ((elisp-shorthands (hack-elisp-shorthands fullname))) - (load-with-code-conversion fullname file noerror nomessage))) - (defun charset-info (charset) "Return a vector of information of CHARSET. This function is provided for backward compatibility. diff --git a/lisp/loadup.el b/lisp/loadup.el index 942057c838f..af997441d2e 100644 --- a/lisp/loadup.el +++ b/lisp/loadup.el @@ -151,7 +151,7 @@ ;; variable its advertised default value (it starts as nil, see ;; xdisp.c). (setq resize-mini-windows 'grow-only) -(setq load-source-file-function #'load-with-shorthands-and-code-conversion) +(setq load-source-file-function #'load-with-code-conversion) (load "files") ;; Load-time macro-expansion can only take effect after setting @@ -352,6 +352,10 @@ (load "vc/ediff-hook") (load "uniquify") (load "electric") + +(load "shorthands") +(setq load-source-file-function #'load-with-shorthands-and-code-conversion) + (load "emacs-lisp/eldoc") (load "cus-start") ;Late to reduce customize-rogue (needs loaddefs.el anyway) (if (not (eq system-type 'ms-dos)) diff --git a/lisp/shorthands.el b/lisp/shorthands.el new file mode 100644 index 00000000000..c72c04ab41d --- /dev/null +++ b/lisp/shorthands.el @@ -0,0 +1,55 @@ +;;; shorthands.el --- Read code considering Elisp shorthands -*- lexical-binding: t; -*- + +;; Copyright (C) 2021 Free Software Foundation, Inc. + +;; Author: João Távora +;; Keywords: lisp + +;; This program 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. + +;; This program 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 this program. If not, see . + +;;; Commentary: + +;; Basic helpers for loading files with Shorthands. + +;;; Code: +(require 'files) + +(defun hack-elisp-shorthands (fullname) + "Return value of `elisp-shorthands' file-local variable in FULLNAME. +FULLNAME is the absolute file name of an Elisp .el file which +potentially specifies a file-local value for `elisp-shorthands'. +The Elisp code in FULLNAME isn't read or evaluated in any way, +except for extraction of the buffer-local value of +`elisp-shorthands'." + (let* ((size (nth 7 (file-attributes fullname))) + (from (max 0 (- size 3000))) + (to size)) + (with-temp-buffer + (while (and (< (buffer-size) 3000) (>= from 0)) + (insert-file-contents fullname nil from to) + (setq to from from (- from 100))) + ;; FIXME: relies on the `hack-local-variables--find-variables' + ;; detail of files.el. That function should be exported, + ;; possibly be refactored into two parts, since we're only + ;; interested in basic "Local Variables" parsing. + (alist-get 'elisp-shorthands (hack-local-variables--find-variables))))) + +(defun load-with-shorthands-and-code-conversion (fullname file noerror nomessage) + "Like `load-with-code-conversion', but also consider Elisp shorthands. +This function uses shorthands defined in the file FULLNAME's local +value of `elisp-shorthands', when it processes that file's Elisp code." + (let ((elisp-shorthands (hack-elisp-shorthands fullname))) + (load-with-code-conversion fullname file noerror nomessage))) + +;;; shorthands.el ends here From d505971894d83e04e8d206be1dcee1cee5e8bb93 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Fri, 1 Oct 2021 18:07:45 -0700 Subject: [PATCH 03/51] ; Standardize some license headers --- lisp/org/ob-julia.el | 8 ++++---- lisp/org/oc-basic.el | 8 +++++--- lisp/org/oc-biblatex.el | 8 +++++--- lisp/org/oc-csl.el | 8 +++++--- lisp/org/oc-natbib.el | 8 +++++--- lisp/org/oc.el | 8 +++++--- lisp/org/ol-doi.el | 10 ++++++---- lisp/org/ox-koma-letter.el | 4 ++-- lisp/shorthands.el | 8 +++++--- lisp/textmodes/etc-authors-mode.el | 8 +++++--- 10 files changed, 47 insertions(+), 31 deletions(-) diff --git a/lisp/org/ob-julia.el b/lisp/org/ob-julia.el index 5ff6a7ca0a7..434b414b614 100644 --- a/lisp/org/ob-julia.el +++ b/lisp/org/ob-julia.el @@ -6,20 +6,20 @@ ;; Keywords: literate programming, reproducible research, scientific computing ;; Homepage: https://github.com/phrb/ob-julia -;; This file is not part of GNU Emacs. +;; This file is part of GNU Emacs. -;; This program is free software; you can redistribute it and/or modify +;; 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. -;; This program is distributed in the hope that it will be useful, +;; 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 this program. If not, see . +;; along with GNU Emacs. If not, see . ;;; Commentary: diff --git a/lisp/org/oc-basic.el b/lisp/org/oc-basic.el index 3b589908e04..bf0153d1d10 100644 --- a/lisp/org/oc-basic.el +++ b/lisp/org/oc-basic.el @@ -4,18 +4,20 @@ ;; Author: Nicolas Goaziou -;; This program is free software; you can redistribute it and/or modify +;; 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. -;; This program is distributed in the hope that it will be useful, +;; 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 this program. If not, see . +;; along with GNU Emacs. If not, see . ;;; Commentary: diff --git a/lisp/org/oc-biblatex.el b/lisp/org/oc-biblatex.el index a27f9e9bf10..224abaeeebb 100644 --- a/lisp/org/oc-biblatex.el +++ b/lisp/org/oc-biblatex.el @@ -4,18 +4,20 @@ ;; Author: Nicolas Goaziou -;; This program is free software; you can redistribute it and/or modify +;; 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. -;; This program is distributed in the hope that it will be useful, +;; 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 this program. If not, see . +;; along with GNU Emacs. If not, see . ;;; Commentary: diff --git a/lisp/org/oc-csl.el b/lisp/org/oc-csl.el index 5623efcc1b3..cf3538b870c 100644 --- a/lisp/org/oc-csl.el +++ b/lisp/org/oc-csl.el @@ -4,18 +4,20 @@ ;; Author: Nicolas Goaziou -;; This program is free software; you can redistribute it and/or modify +;; 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. -;; This program is distributed in the hope that it will be useful, +;; 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 this program. If not, see . +;; along with GNU Emacs. If not, see . ;;; Commentary: diff --git a/lisp/org/oc-natbib.el b/lisp/org/oc-natbib.el index 7e2127bd8d9..c012ff1db0a 100644 --- a/lisp/org/oc-natbib.el +++ b/lisp/org/oc-natbib.el @@ -4,18 +4,20 @@ ;; Author: Nicolas Goaziou -;; This program is free software; you can redistribute it and/or modify +;; 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. -;; This program is distributed in the hope that it will be useful, +;; 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 this program. If not, see . +;; along with GNU Emacs. If not, see . ;;; Commentary: diff --git a/lisp/org/oc.el b/lisp/org/oc.el index eb2b7a16953..bb2e04d400d 100644 --- a/lisp/org/oc.el +++ b/lisp/org/oc.el @@ -4,18 +4,20 @@ ;; Author: Nicolas Goaziou -;; This program is free software; you can redistribute it and/or modify +;; 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. -;; This program is distributed in the hope that it will be useful, +;; 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 this program. If not, see . +;; along with GNU Emacs. If not, see . ;;; Commentary: diff --git a/lisp/org/ol-doi.el b/lisp/org/ol-doi.el index dfde380209f..d2d16b27d51 100644 --- a/lisp/org/ol-doi.el +++ b/lisp/org/ol-doi.el @@ -1,21 +1,23 @@ ;;; ol-doi.el --- DOI links support in Org -*- lexical-binding: t; -*- -;; Copyright (C) 2021 Free Software Foundation, Inc. +;; Copyright (C) 2021 Free Software Foundation, Inc. ;; Author: Nicolas Goaziou -;; This program is free software; you can redistribute it and/or modify +;; 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. -;; This program is distributed in the hope that it will be useful, +;; 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 this program. If not, see . +;; along with GNU Emacs. If not, see . ;;; Commentary: diff --git a/lisp/org/ox-koma-letter.el b/lisp/org/ox-koma-letter.el index 96704dbb985..f6aa84aba5d 100644 --- a/lisp/org/ox-koma-letter.el +++ b/lisp/org/ox-koma-letter.el @@ -11,12 +11,12 @@ ;; This file is part of GNU Emacs. -;; This program is free software: you can redistribute it and/or modify +;; 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. -;; This program is distributed in the hope that it will be useful, +;; 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. diff --git a/lisp/shorthands.el b/lisp/shorthands.el index c72c04ab41d..b8204d62a2e 100644 --- a/lisp/shorthands.el +++ b/lisp/shorthands.el @@ -5,18 +5,20 @@ ;; Author: João Távora ;; Keywords: lisp -;; This program is free software; you can redistribute it and/or modify +;; 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. -;; This program is distributed in the hope that it will be useful, +;; 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 this program. If not, see . +;; along with GNU Emacs. If not, see . ;;; Commentary: diff --git a/lisp/textmodes/etc-authors-mode.el b/lisp/textmodes/etc-authors-mode.el index a591b2db978..8b5fefd3b7d 100644 --- a/lisp/textmodes/etc-authors-mode.el +++ b/lisp/textmodes/etc-authors-mode.el @@ -5,18 +5,20 @@ ;; Author: Stefan Kangas ;; Keywords: internal -;; This program is free software; you can redistribute it and/or modify +;; 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. -;; This program is distributed in the hope that it will be useful, +;; 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 this program. If not, see . +;; along with GNU Emacs. If not, see . ;;; Commentary: From a9052248da4296415260ea7710ab044e3f59ba77 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 2 Oct 2021 09:40:44 +0300 Subject: [PATCH 04/51] Improve documentation of 'shift-select-mode' * doc/emacs/mark.texi (Shift Selection): Document the 'permanent' value of 'shift-select-mode'. Add index entry for that variable. (Bug#50954) * etc/NEWS: Update the entry for 'shift-select-mode'. --- doc/emacs/mark.texi | 7 ++++++- etc/NEWS | 5 +++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/doc/emacs/mark.texi b/doc/emacs/mark.texi index 20cb8ee2c65..2461cb0f6af 100644 --- a/doc/emacs/mark.texi +++ b/doc/emacs/mark.texi @@ -409,9 +409,14 @@ region by dragging the mouse, you can continue to extend the region using shifted cursor motion commands. In either case, any unshifted cursor motion command deactivates the mark. +@vindex shift-select-mode To turn off shift-selection, set @code{shift-select-mode} to @code{nil}. Doing so does not disable setting the mark via mouse -commands. +commands. If you set @code{shift-select-mode} to the value +@code{permanent}, cursor motion keys that were not shift-translated +will not deactivate the mark, so, for example, the region set by prior +commands can be extended by shift-selection, and unshifted cursor +motion keys will extend the region set by shift-selection. @node Disabled Transient Mark @section Disabling Transient Mark Mode diff --git a/etc/NEWS b/etc/NEWS index f8c045f014f..cff306e2440 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -989,11 +989,12 @@ further tweak whether to complete or indent. --- ** 'indent-tabs-mode' is now a global minor mode instead of just a variable. ---- ++++ ** New choice 'permanent' for 'shift-select-mode'. When the mark was activated by shifted motion keys, non-shifted motion keys don't deactivate the mark after customizing 'shift-select-mode' -to 'permanent'. +to 'permanent'. Similarly, the active mark will not be deactivated by +typing shifted motion keys. +++ ** The "Edit => Clear" menu item now obeys a rectangular region. From 340e527bed83ff0382446132c871088ad61d1745 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 2 Oct 2021 11:06:18 +0300 Subject: [PATCH 05/51] Preload paren.el * lisp/Makefile.in (COMPILE_FIRST): Add the dependencies of comp.el, so that they are natively-compiled in advance. * lisp/loadup.el ("paren"): Preload paren.el. (Bug#50934) --- lisp/Makefile.in | 15 +++++++++++++-- lisp/loadup.el | 1 + 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lisp/Makefile.in b/lisp/Makefile.in index 60d1d10e5b2..3e764c5a787 100644 --- a/lisp/Makefile.in +++ b/lisp/Makefile.in @@ -91,8 +91,19 @@ COMPILE_FIRST = \ $(lisp)/emacs-lisp/byte-opt.elc \ $(lisp)/emacs-lisp/bytecomp.elc ifeq ($(HAVE_NATIVE_COMP),yes) -COMPILE_FIRST += $(lisp)/emacs-lisp/comp.elc -COMPILE_FIRST += $(lisp)/emacs-lisp/comp-cstr.elc +COMPILE_FIRST += \ + $(lisp)/emacs-lisp/comp.elc \ + $(lisp)/emacs-lisp/comp-cstr.elc \ + $(lisp)/emacs-lisp/cl-macs.elc \ + $(lisp)/emacs-lisp/rx.elc \ + $(lisp)/emacs-lisp/cl-seq.elc \ + $(lisp)/help-mode.elc \ + $(lisp)/emacs-lisp/cl-extra.elc \ + $(lisp)/emacs-lisp/gv.elc \ + $(lisp)/emacs-lisp/seq.elc \ + $(lisp)/emacs-lisp/cl-lib.elc \ + $(lisp)/emacs-lisp/warnings.elc \ + $(lisp)/emacs-lisp/subr-x.elc endif COMPILE_FIRST += $(lisp)/emacs-lisp/autoload.elc diff --git a/lisp/loadup.el b/lisp/loadup.el index af997441d2e..3fb6b813285 100644 --- a/lisp/loadup.el +++ b/lisp/loadup.el @@ -352,6 +352,7 @@ (load "vc/ediff-hook") (load "uniquify") (load "electric") +(load "paren") (load "shorthands") (setq load-source-file-function #'load-with-shorthands-and-code-conversion) From bd60fca2faa03034e89df68a69255656df6512ba Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sat, 2 Oct 2021 10:37:48 +0200 Subject: [PATCH 06/51] Fix ox-koma-letter compilation warnings * lisp/org/ox-koma-letter.el (org-koma-letter-export-block) (org-koma-letter-export-snippet): Fix warning about two unused parameter. --- lisp/org/ox-koma-letter.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/org/ox-koma-letter.el b/lisp/org/ox-koma-letter.el index f6aa84aba5d..6a895a6a24d 100644 --- a/lisp/org/ox-koma-letter.el +++ b/lisp/org/ox-koma-letter.el @@ -594,7 +594,7 @@ such as the one tagged with PS." ;;;; Export Block -(defun org-koma-letter-export-block (export-block contents info) +(defun org-koma-letter-export-block (export-block _contents _info) "Transcode an EXPORT-BLOCK element into KOMA Scrlttr2 code. CONTENTS is nil. INFO is a plist used as a communication channel." @@ -604,7 +604,7 @@ channel." ;;;; Export Snippet -(defun org-koma-letter-export-snippet (export-snippet contents info) +(defun org-koma-letter-export-snippet (export-snippet _contents _info) "Transcode an EXPORT-SNIPPET object into KOMA Scrlttr2 code. CONTENTS is nil. INFO is a plist used as a communication channel." From 13e59433869ec3ee6b8fc5e652e237702e05bf2c Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 2 Oct 2021 15:57:51 +0300 Subject: [PATCH 07/51] ; Fix a typo in a doc string * lisp/files.el (hack-local-variables--find-variables): Fix typo in the doc string. --- lisp/files.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/files.el b/lisp/files.el index 05875b48e39..19b88e6621d 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -3896,7 +3896,7 @@ inhibited." (hack-local-variables-apply)))))) (defun hack-local-variables--find-variables (&optional handle-mode) - "Return all local variables in the ucrrent buffer. + "Return all local variables in the current buffer. If HANDLE-MODE is nil, we gather all the specified local variables. If HANDLE-MODE is neither nil nor t, we do the same, except that any settings of `mode' are ignored. From 34894714177d1bb0a382e7f68d716dfe3aa08376 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 2 Oct 2021 17:38:55 +0300 Subject: [PATCH 08/51] Fix selection of fonts for Arabic on Posix platforms * lisp/international/fontset.el (script-representative-chars): Add U+06C1 to representative-characters for Arabic. (Bug#50951) --- lisp/international/fontset.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/international/fontset.el b/lisp/international/fontset.el index 4ec641dca8f..f0ead8a2744 100644 --- a/lisp/international/fontset.el +++ b/lisp/international/fontset.el @@ -157,7 +157,9 @@ (armenian #x531) (hebrew #x5D0) (vai #xA500) - (arabic #x628) + ;; U+06C1 prevents us from using bad fonts, like DejaVu Sans, + ;; for Arabic text. + (arabic #x628 #x6C1) (syriac #x710) (thaana #x78C) (devanagari #x915) From 7bc0cee115a7c9336469e9849728fc7499019692 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sat, 2 Oct 2021 17:25:24 +0200 Subject: [PATCH 09/51] Revert "* etc/TODO: Rearrange to start with "Simple tasks"." This reverts commit 879ef5b19ab1dd90284aef829ef306d56b4e5adb. Some of these items are a priority for the project and should be before other, less prioritized items, according to a private discussion with project co-maintainer Eli Zaretskii . --- etc/TODO | 148 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 75 insertions(+), 73 deletions(-) diff --git a/etc/TODO b/etc/TODO index d9149a521fb..0465bf1512f 100644 --- a/etc/TODO +++ b/etc/TODO @@ -29,6 +29,81 @@ are the ones we consider more important, but these also may be difficult to fix. Bugs with severity "minor" may be simpler, but this is not always true. +* Speed up Elisp execution + +** Speed up function calls +Change src/bytecode.c so that calls from byte-code functions to byte-code +functions don't go through Ffuncall/funcall_lambda/exec_byte_code but instead +stay within exec_byte_code. + +** Improve the byte-compiler to recognize immutable bindings +Recognize immutable (lexical) bindings and get rid of them if they're +used only once and/or they're bound to a constant expression. + +Such things aren't present in hand-written code, but macro expansion and +defsubst can often end up generating things like +(funcall (lambda (arg) (body)) actual) which then get optimized to +(let ((arg actual)) (body)) but should additionally get optimized further +when 'actual' is a constant/copyable expression. + +** Add an "indirect goto" byte-code +Such a byte-code can be used for local lambda expressions. +E.g. when you have code like + + (let ((foo (lambda (x) bar))) + (dosomething + (funcall foo toto) + (blabla (funcall foo titi)))) + +turn those 'funcalls' into jumps and their return into indirect jumps back. + +** Compile efficiently local recursive functions +Similar to the previous point, we should be able to handle something like + + (letrec ((loop () (blabla) (if (toto) (loop)))) + (loop)) + +which ideally should generate the same byte-code as + + (while (progn (blabla) (toto))) + +* Things that were planned for Emacs-24 + +** Concurrency +Including it as an "experimental" compile-time option sounds good. Of +course there might still be big questions around "which form of +concurrency" we'll want. + +** Better support for dynamic embedded graphics +I like this idea (my mpc.el code could use it for the volume widget), +though I wonder if the resulting efficiency will be sufficient. + +** Spread Semantic + +** Improve the "code snippets" support +Consolidate skeleton.el, tempo.el, and expand.el (any other?) and then +advertise/use/improve it. + +** Improve VC +Yes, there's a lot of work to be done there :-( + +** Random things that cross my mind right now that I'd like to see +Some of them from my local hacks, but it's not obvious at all whether +they'll make it. + +*** Prog-mode could/should provide a better fill-paragraph default +That default should use syntax-tables to recognize string/comment +boundaries. + +*** Provide more completion-at-point-functions +Make existing in-buffer completion use completion-at-point. + +*** "Functional" function-key-map +It would make it easy to add (and remove) mappings like +"FOO-mouse-4 -> FOO-scroll-down", "FOO-tab -> ?\FOO-\t", +"uppercase -> lowercase", "[fringe KEY...] -> [KEY]", +"H-FOO -> M-FOO", "C-x C-y FOO -> H-FOO", ... + * Simple tasks These don't require much Emacs knowledge and are suitable for anyone from beginners to experts. @@ -151,44 +226,6 @@ https://lists.gnu.org/r/emacs-devel/2008-08/msg00456.html * Important features -** Speed up Elisp execution - -*** Speed up function calls -Change src/bytecode.c so that calls from byte-code functions to byte-code -functions don't go through Ffuncall/funcall_lambda/exec_byte_code but instead -stay within exec_byte_code. - -*** Improve the byte-compiler to recognize immutable bindings -Recognize immutable (lexical) bindings and get rid of them if they're -used only once and/or they're bound to a constant expression. - -Such things aren't present in hand-written code, but macro expansion and -defsubst can often end up generating things like -(funcall (lambda (arg) (body)) actual) which then get optimized to -(let ((arg actual)) (body)) but should additionally get optimized further -when 'actual' is a constant/copyable expression. - -*** Add an "indirect goto" byte-code -Such a byte-code can be used for local lambda expressions. -E.g. when you have code like - - (let ((foo (lambda (x) bar))) - (dosomething - (funcall foo toto) - (blabla (funcall foo titi)))) - -turn those 'funcalls' into jumps and their return into indirect jumps back. - -*** Compile efficiently local recursive functions -Similar to the previous point, we should be able to handle something like - - (letrec ((loop () (blabla) (if (toto) (loop)))) - (loop)) - -which ideally should generate the same byte-code as - - (while (progn (blabla) (toto))) - ** "Emacs as word processor" https://lists.gnu.org/r/emacs-devel/2013-11/msg00515.html rms writes: @@ -446,15 +483,6 @@ consistency checks that make sure the new code computes the same results as the old code. And once that works well, we can remove the old code and old fields. -** Better support for dynamic embedded graphics -I like this idea (my mpc.el code could use it for the volume widget), -though I wonder if the resulting efficiency will be sufficient. - -** Concurrency -Including it as an "experimental" compile-time option sounds good. Of -course there might still be big questions around "which form of -concurrency" we'll want. - ** FFI (foreign function interface) See eg https://lists.gnu.org/r/emacs-devel/2013-10/msg00246.html @@ -862,32 +890,6 @@ The idea is to add an "X" of some kind, that when clicked deletes the window associated with that modeline. https://lists.gnu.org/r/emacs-devel/2007-09/msg02416.html -** Improve the "code snippets" support -Consolidate skeleton.el, tempo.el, and expand.el (any other?) and then -advertise/use/improve it. - -** Improve VC -Yes, there's a lot of work to be done there :-( - -** Spread Semantic - -** Random things that crossed Stefan Monnier's mind for Emacs 24 -Stefan Monnier writes: "Some of them from my local hacks, but it's not -obvious at all whether they'll make it." - -*** Prog-mode could/should provide a better fill-paragraph default -That default should use syntax-tables to recognize string/comment -boundaries. - -*** Provide more completion-at-point-functions -Make existing in-buffer completion use completion-at-point. - -*** "Functional" function-key-map -It would make it easy to add (and remove) mappings like -"FOO-mouse-4 -> FOO-scroll-down", "FOO-tab -> ?\FOO-\t", -"uppercase -> lowercase", "[fringe KEY...] -> [KEY]", -"H-FOO -> M-FOO", "C-x C-y FOO -> H-FOO", ... - * Things to be done for specific packages or features ** NeXTstep port From a5b4356d37dcdc4f229d2802494a6c0658f02576 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sat, 2 Oct 2021 17:25:29 +0200 Subject: [PATCH 10/51] Revert "; * etc/TODO: Move elpa.gnu.org items to the end." This reverts commit d73f0e96a7026808c01861f7525a2909279fc00d. These items are a priority for the project and should be before other, less prioritized items, according to a private discussion with project co-maintainer Eli Zaretskii . --- etc/TODO | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/etc/TODO b/etc/TODO index 0465bf1512f..db327c02a75 100644 --- a/etc/TODO +++ b/etc/TODO @@ -69,12 +69,12 @@ which ideally should generate the same byte-code as * Things that were planned for Emacs-24 -** Concurrency +** concurrency Including it as an "experimental" compile-time option sounds good. Of course there might still be big questions around "which form of concurrency" we'll want. -** Better support for dynamic embedded graphics +** better support for dynamic embedded graphics I like this idea (my mpc.el code could use it for the volume widget), though I wonder if the resulting efficiency will be sufficient. @@ -104,6 +104,23 @@ It would make it easy to add (and remove) mappings like "uppercase -> lowercase", "[fringe KEY...] -> [KEY]", "H-FOO -> M-FOO", "C-x C-y FOO -> H-FOO", ... +* Things related to elpa.gnu.org. + +** Move idlwave to elpa.gnu.org +Need to sync up the Emacs and external versions. +See + + +** Move Org mode to elpa.gnu.org +See + + +** Move verilog-mode to elpa.gnu.org +See + +** Move vhdl-mode to elpa.gnu.org +See + * Simple tasks These don't require much Emacs knowledge and are suitable for anyone from beginners to experts. @@ -1743,26 +1760,6 @@ Add a standard button-class named "link", and make all other link-like button classes inherit from it. Set the default face of the "link" button class to the standard "link" face. -* Things related to elpa.gnu.org. - -We need to figure out how to best include GNU ELPA packages in the -Emacs tarball before doing any of the items below. - -** Move idlwave to elpa.gnu.org -Need to sync up the Emacs and external versions. -See - - -** Move Org mode to elpa.gnu.org -See - - -** Move verilog-mode to elpa.gnu.org -See - -** Move vhdl-mode to elpa.gnu.org -See - * Wishlist items ** Maybe replace etags.c with a Lisp implementation. From 3dc094abeea40474b42c1f7002810011539769dc Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sat, 2 Oct 2021 17:26:28 +0200 Subject: [PATCH 11/51] ; Some minor tweaks to TODO * etc/TODO: Explain elpa.gnu.org items better. Delete fixed item about dynamic embedded graphics. (Bug#50937) --- etc/TODO | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/etc/TODO b/etc/TODO index db327c02a75..da15ea1f77e 100644 --- a/etc/TODO +++ b/etc/TODO @@ -69,12 +69,12 @@ which ideally should generate the same byte-code as * Things that were planned for Emacs-24 -** concurrency +** Concurrency Including it as an "experimental" compile-time option sounds good. Of course there might still be big questions around "which form of concurrency" we'll want. -** better support for dynamic embedded graphics +** Better support for dynamic embedded graphics I like this idea (my mpc.el code could use it for the volume widget), though I wonder if the resulting efficiency will be sufficient. @@ -106,6 +106,9 @@ It would make it easy to add (and remove) mappings like * Things related to elpa.gnu.org. +We need to figure out how to best include GNU ELPA packages in the +Emacs tarball before doing any of the items below. + ** Move idlwave to elpa.gnu.org Need to sync up the Emacs and external versions. See @@ -393,11 +396,6 @@ should invoke the 'shape' method. 'hbfont_shape' should be extended to pass to 'hb_shape_full' the required array of features, as mentioned in the above HarfBuzz discussion. -** Better support for displaying Emoji -Emacs is capable of displaying Emoji and some of the Emoji sequences, -provided that its fontsets are configured with a suitable font. To -make this easier out of the box, the following should be done: - *** Populate composition-function-table with Emoji rules The Unicode Character Database (UCD) includes several data files that define the valid Emoji sequences. These files should be imported into From f9111d8784bf12263abbe127cdfcbe5f409c9b3b Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 2 Oct 2021 10:37:42 -0700 Subject: [PATCH 12/51] The safe-local-variable property is a function (bug#50944) * lisp/org/oc-basic.el (org-cite-basic-sorting-field) (org-cite-basic-author-year-separator) (org-cite-basic-max-key-distance) (org-cite-basic-author-column-end) (org-cite-basic-column-separator) (org-cite-basic-mouse-over-key-face): * lisp/org/oc-biblatex.el (org-cite-biblatex-options): * lisp/org/oc-csl.el (org-cite-csl-link-cites) (org-cite-csl-html-hanging-indent) (org-cite-csl-html-label-width-per-char) (org-cite-csl-latex-hanging-indent): * lisp/org/oc.el (org-cite-adjust-note-numbers): * lisp/org/org-keys.el (org-return-follows-link): * lisp/org/org.el (org-fontify-todo-headline): * lisp/org/ox-html.el (org-html-equation-reference-format) (org-html-wrap-src-lines): * lisp/org/ox-latex.el (org-latex-reference-command) (org-latex-default-quote-environment): * lisp/textmodes/tildify.el (tildify-pattern) (tildify-space-string): Fix :safe property. --- lisp/org/oc-basic.el | 12 ++++++------ lisp/org/oc-biblatex.el | 2 +- lisp/org/oc-csl.el | 8 ++++---- lisp/org/oc.el | 2 +- lisp/org/org-keys.el | 2 +- lisp/org/org.el | 2 +- lisp/org/ox-html.el | 4 ++-- lisp/org/ox-latex.el | 4 ++-- lisp/textmodes/tildify.el | 4 ++-- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lisp/org/oc-basic.el b/lisp/org/oc-basic.el index bf0153d1d10..98242f3b841 100644 --- a/lisp/org/oc-basic.el +++ b/lisp/org/oc-basic.el @@ -89,42 +89,42 @@ :group 'org-cite :package-version '(Org . "9.5") :type 'symbol - :safe t) + :safe #'symbolp) (defcustom org-cite-basic-author-year-separator ", " "String used to separate cites in an author-year configuration." :group 'org-cite :package-version '(Org . "9.5") :type 'string - :safe t) + :safe #'stringp) (defcustom org-cite-basic-max-key-distance 2 "Maximum (Levenshtein) distance between a wrong key and its suggestions." :group 'org-cite :package-version '(Org . "9.5") :type 'integer - :safe t) + :safe #'integerp) (defcustom org-cite-basic-author-column-end 25 "Column where author field ends in completion table, as an integer." :group 'org-cite :package-version '(Org . "9.5") :type 'integer - :safe t) + :safe #'integerp) (defcustom org-cite-basic-column-separator " " "Column separator in completion table, as a string." :group 'org-cite :package-version '(Org . "9.5") :type 'string - :safe t) + :safe #'stringp) (defcustom org-cite-basic-mouse-over-key-face 'highlight "Face used when mouse is over a citation key." :group 'org-cite :package-version '(Org . "9.5") :type 'face - :safe t) + :safe #'facep) ;;; Internal variables diff --git a/lisp/org/oc-biblatex.el b/lisp/org/oc-biblatex.el index 224abaeeebb..f517e391398 100644 --- a/lisp/org/oc-biblatex.el +++ b/lisp/org/oc-biblatex.el @@ -80,7 +80,7 @@ If \"biblatex\" package is already required in the document, e.g., through :type '(choice (string :tag "Options (key=value,key2=value2...)") (const :tag "No option" nil)) - :safe t) + :safe #'string-or-null-p) ;;; Internal functions diff --git a/lisp/org/oc-csl.el b/lisp/org/oc-csl.el index cf3538b870c..1430779b982 100644 --- a/lisp/org/oc-csl.el +++ b/lisp/org/oc-csl.el @@ -146,7 +146,7 @@ directory. This variable is ignored when style file is absolute." :group 'org-cite :package-version '(Org . "9.5") :type 'boolean - :safe t) + :safe #'booleanp) (defcustom org-cite-csl-no-citelinks-backends '(ascii) "List of export back-ends for which cite linking is disabled. @@ -163,7 +163,7 @@ is also disabled." :group 'org-cite :package-version '(Org . "9.5") :type 'string - :safe t) + :safe #'stringp) (defcustom org-cite-csl-html-label-width-per-char "0.6em" "Character width in CSS units for calculating entry label widths. @@ -171,14 +171,14 @@ Used only when `second-field-align' is activated by the used CSL style." :group 'org-cite :package-version '(Org . "9.5") :type 'string - :safe t) + :safe #'stringp) (defcustom org-cite-csl-latex-hanging-indent "1.5em" "Size of hanging-indent for LaTeX output in valid LaTeX units." :group 'org-cite :package-version '(Org . "9.5") :type 'string - :safe t) + :safe #'stringp) ;;; Internal variables diff --git a/lisp/org/oc.el b/lisp/org/oc.el index bb2e04d400d..55627533687 100644 --- a/lisp/org/oc.el +++ b/lisp/org/oc.el @@ -234,7 +234,7 @@ When nil, the note number is not moved." :package-version '(Org . "9.5") :type '(choice (const :tag "Automatic note number location" t) (const :tag "Place note numbers manually" nil)) - :safe t) + :safe #'booleanp) (defcustom org-cite-note-rules '(("en-us" inside outside after) diff --git a/lisp/org/org-keys.el b/lisp/org/org-keys.el index 2984a4f5145..8fa551ad41c 100644 --- a/lisp/org/org-keys.el +++ b/lisp/org/org-keys.el @@ -300,7 +300,7 @@ implementation is bad." In tables, the special behavior of RET has precedence." :group 'org-link-follow :type 'boolean - :safe t) + :safe #'booleanp) ;;; Functions diff --git a/lisp/org/org.el b/lisp/org/org.el index 2ec6566c0b0..723de649429 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -3630,7 +3630,7 @@ When this is non-nil, the headline after the keyword is set to the :group 'org-appearance :package-version '(Org . "9.4") :type 'boolean - :safe t) + :safe #'booleanp) (defcustom org-fontify-done-headline t "Non-nil means change the face of a headline if it is marked DONE. diff --git a/lisp/org/ox-html.el b/lisp/org/ox-html.el index 60bb77d8188..a150b1fdb87 100644 --- a/lisp/org/ox-html.el +++ b/lisp/org/ox-html.el @@ -795,7 +795,7 @@ Most common values are: :group 'org-export-html :package-version '(Org . "9.4") :type 'string - :safe t) + :safe #'stringp) (defcustom org-html-with-latex org-export-with-latex "Non-nil means process LaTeX math snippets. @@ -903,7 +903,7 @@ numbers are enabled." :group 'org-export-html :package-version '(Org . "9.3") :type 'boolean - :safe t) + :safe #'booleanp) ;;;; Table diff --git a/lisp/org/ox-latex.el b/lisp/org/ox-latex.el index 993c2c6431d..3e3967033a5 100644 --- a/lisp/org/ox-latex.el +++ b/lisp/org/ox-latex.el @@ -413,7 +413,7 @@ to \"\\autoref{%s}\" or \"\\cref{%s}\" for example." :group 'org-export-latex :type 'string :package-version '(Org . "9.5") - :safe t) + :safe #'stringp) ;;;; Preamble @@ -793,7 +793,7 @@ default we use here encompasses both." :group 'org-export-latex :package-version '(Org . "9.5") :type 'string - :safe t) + :safe #'stringp) (defcustom org-latex-default-table-mode 'table "Default mode for tables. diff --git a/lisp/textmodes/tildify.el b/lisp/textmodes/tildify.el index 01e2ad72d88..2a4c8cff8f0 100644 --- a/lisp/textmodes/tildify.el +++ b/lisp/textmodes/tildify.el @@ -67,7 +67,7 @@ matching the white space). The pattern is matched case-sensitive regardless of the value of `case-fold-search' setting." :version "25.1" :type 'regexp - :safe t) + :safe #'stringp) (defcustom tildify-pattern-alist () "Alist specifying where to insert hard spaces. @@ -112,7 +112,7 @@ If nil, current major mode has no way to represent a hard space." " ") (const :tag "No-break space (U+00A0)" "\u00A0") (string :tag "Custom string")) - :safe t) + :safe #'string-or-null-p) (defcustom tildify-string-alist () "Alist specifying what is a hard space in the current major mode. From 62d6cecfcd1a67e15a436c5c2b975f327d9a8b50 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 2 Oct 2021 10:46:29 -0700 Subject: [PATCH 13/51] Remove bogus ":safe nil" custom properties * lisp/org/oc.el (org-cite-activate-processor) (org-cite-export-processors, org-cite-follow-processor) (org-cite-insert-processor): * lisp/org/ol.el (org-link-parameters, org-link-frame-setup) (org-link-shell-confirm-function) (org-link-shell-skip-confirm-regexp) (org-link-elisp-confirm-function) (org-link-elisp-skip-confirm-regexp): * lisp/org/org-num.el (org-num-format-function): Remove bogus ":safe nil" that do nothing but propagate a misunderstanding of the safe-local-variable property. --- lisp/org/oc.el | 12 ++++-------- lisp/org/ol.el | 18 ++++++------------ lisp/org/org-num.el | 3 +-- 3 files changed, 11 insertions(+), 22 deletions(-) diff --git a/lisp/org/oc.el b/lisp/org/oc.el index 55627533687..eb4079e6dd1 100644 --- a/lisp/org/oc.el +++ b/lisp/org/oc.el @@ -135,8 +135,7 @@ File names must be absolute." :group 'org-cite :package-version '(Org . "9.5") :type '(choice (const :tag "Default fontification" nil) - (symbol :tag "Citation processor")) - :safe nil) + (symbol :tag "Citation processor"))) (defcustom org-cite-export-processors '((t basic)) "Processor used for exporting citations, as a triplet, or nil. @@ -200,24 +199,21 @@ back-end." (string :tag "Use specific bibliography style")) (choice (const :tag "Default citation style" nil) - (string :tag "Use specific citation style"))))) - :safe nil) + (string :tag "Use specific citation style")))))) (defcustom org-cite-follow-processor 'basic "Processor used for following citations, as a symbol." :group 'org-cite :package-version '(Org . "9.5") :type '(choice (const :tag "No following" nil) - (symbol :tag "Citation processor")) - :safe nil) + (symbol :tag "Citation processor"))) (defcustom org-cite-insert-processor 'basic "Processor used for inserting citations, as a symbol." :group 'org-cite :package-version '(Org . "9.5") :type '(choice (const :tag "No insertion" nil) - (symbol :tag "Citation processor")) - :safe nil) + (symbol :tag "Citation processor"))) (defcustom org-cite-adjust-note-numbers t "When non-nil, allow process to modify location of note numbers. diff --git a/lisp/org/ol.el b/lisp/org/ol.el index e4a5a278dda..aa1849715c3 100644 --- a/lisp/org/ol.el +++ b/lisp/org/ol.el @@ -178,8 +178,7 @@ link. :group 'org-link :package-version '(Org . "9.1") :type '(alist :tag "Link display parameters" - :value-type plist) - :safe nil) + :value-type plist)) (defcustom org-link-descriptive t "Non-nil means Org displays descriptive links. @@ -335,8 +334,7 @@ another window." (cons (const wl) (choice (const wl) - (const wl-other-frame)))) - :safe nil) + (const wl-other-frame))))) (defcustom org-link-search-must-match-exact-headline 'query-to-create "Non-nil means internal fuzzy links can only match headlines. @@ -385,15 +383,13 @@ single keystroke rather than having to type \"yes\"." :type '(choice (const :tag "with yes-or-no (safer)" yes-or-no-p) (const :tag "with y-or-n (faster)" y-or-n-p) - (const :tag "no confirmation (dangerous)" nil)) - :safe nil) + (const :tag "no confirmation (dangerous)" nil))) (defcustom org-link-shell-skip-confirm-regexp "" "Regexp to skip confirmation for shell links." :group 'org-link-follow :version "24.1" - :type 'regexp - :safe nil) + :type 'regexp) (defcustom org-link-elisp-confirm-function 'yes-or-no-p "Non-nil means ask for confirmation before executing Emacs Lisp links. @@ -410,15 +406,13 @@ single keystroke rather than having to type \"yes\"." :type '(choice (const :tag "with yes-or-no (safer)" yes-or-no-p) (const :tag "with y-or-n (faster)" y-or-n-p) - (const :tag "no confirmation (dangerous)" nil)) - :safe nil) + (const :tag "no confirmation (dangerous)" nil))) (defcustom org-link-elisp-skip-confirm-regexp "" "A regexp to skip confirmation for Elisp links." :group 'org-link-follow :version "24.1" - :type 'regexp - :safe nil) + :type 'regexp) (defgroup org-link-store nil "Options concerning storing links in Org mode." diff --git a/lisp/org/org-num.el b/lisp/org/org-num.el index 408b86ff411..f00e6c463b8 100644 --- a/lisp/org/org-num.el +++ b/lisp/org/org-num.el @@ -99,8 +99,7 @@ Any `face' text property on the returned string overrides `org-num-face'." :group 'org-appearance :package-version '(Org . "9.3") - :type 'function - :safe nil) + :type 'function) (defcustom org-num-max-level nil "Level below which headlines are not numbered. From b6f6b593c6752fabf7cc7532f6a2fda5a5e8373e Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 2 Oct 2021 20:53:26 +0300 Subject: [PATCH 14/51] Fix 'apropos-compact-layout' * lisp/textmodes/fill.el (fill-region-as-paragraph): Fix filling paragraphs that end at EOB without a newline. (Bug#50974) --- lisp/textmodes/fill.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el index 81d908c95e7..decce88573b 100644 --- a/lisp/textmodes/fill.el +++ b/lisp/textmodes/fill.el @@ -768,7 +768,7 @@ space does not end a sentence, so don't break a line there." (setq first nil linebeg (+ (point) (length actual-fill-prefix)))) (move-to-column (current-fill-column)) - (if (when (< (point) to) + (if (when (and (< (point) to) (< linebeg to)) ;; Find the position where we'll break the line. ;; Use an immediately following space, if any. ;; However, note that `move-to-column' may overshoot From 4341e79a5fad3e5e668a3eeb1b688d1986011481 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 2 Oct 2021 10:59:48 -0700 Subject: [PATCH 15/51] Remove bogus ":safe t" custom properties * lisp/org/oc.el (org-cite-global-bibliography) (org-cite-note-rules, org-cite-punctuation-marks): * lisp/org/oc-csl.el (org-cite-csl-locales-dir) (org-cite-csl-styles-dir, org-cite-csl-no-citelinks-backends): * lisp/org/oc-natbib.el (org-cite-natbib-options): * lisp/org/org-keys.el (org-mouse-1-follows-link): Remove bogus ":safe t" properties that would largely need to be replaced by custom predicates. --- lisp/org/oc-csl.el | 11 +++++++---- lisp/org/oc-natbib.el | 3 +-- lisp/org/oc.el | 9 +++------ lisp/org/org-keys.el | 3 +-- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/lisp/org/oc-csl.el b/lisp/org/oc-csl.el index 1430779b982..b847fbbc4f6 100644 --- a/lisp/org/oc-csl.el +++ b/lisp/org/oc-csl.el @@ -127,7 +127,9 @@ If nil then only the fallback en-US locale will be available." :type '(choice (directory :tag "Locales directory") (const :tag "Use en-US locale only" nil)) - :safe t) + ;; It's not obvious to me that arbitrary locations are safe. +;;; :safe #'string-or-null-p + ) (defcustom org-cite-csl-styles-dir nil "Directory of CSL style files. @@ -138,7 +140,9 @@ directory. This variable is ignored when style file is absolute." :type '(choice (directory :tag "Styles directory") (const :tag "Use absolute file names" nil)) - :safe t) + ;; It's not obvious to me that arbitrary locations are safe. +;;; :safe #'string-or-null-p + ) ;;;; Citelinks (defcustom org-cite-csl-link-cites t @@ -154,8 +158,7 @@ Cite linking for export back-ends derived from any of the back-ends listed here, is also disabled." :group 'org-cite :package-version '(Org . "9.5") - :type '(repeat symbol) - :safe t) + :type '(repeat symbol)) ;;;; Output-specific variables (defcustom org-cite-csl-html-hanging-indent "1.5em" diff --git a/lisp/org/oc-natbib.el b/lisp/org/oc-natbib.el index c012ff1db0a..13cac9ed0b9 100644 --- a/lisp/org/oc-natbib.el +++ b/lisp/org/oc-natbib.el @@ -71,8 +71,7 @@ If \"natbib\" package is already required in the document, e.g., through (const :tag "order as above, but numerical citations are compressed if possible" sort&compress) (const :tag "display full author list on first citation, abbreviate the others" longnamesfirst) (const :tag "redefine \\thebibliography to issue \\section* instead of \\chapter*" sectionbib) - (const :tag "keep all the authors' names in a citation on one line" nonamebreak)) - :safe t) + (const :tag "keep all the authors' names in a citation on one line" nonamebreak))) ;;; Internal functions diff --git a/lisp/org/oc.el b/lisp/org/oc.el index eb4079e6dd1..bbf2195fbd8 100644 --- a/lisp/org/oc.el +++ b/lisp/org/oc.el @@ -127,8 +127,7 @@ File names must be absolute." :package-version '(Org . "9.5") :type '(choice (const :tag "No global bibliography" nil) (repeat :tag "List of bibliography files" - (file :tag "Bibliography"))) - :safe t) + (file :tag "Bibliography")))) (defcustom org-cite-activate-processor 'basic "Processor used for activating citations, as a symbol." @@ -295,8 +294,7 @@ This roughly follows the Oxford Guide to Style recommendations." (const :tag "Citation next to punctuation" same)) (choice :tag "Order of citation and punctuation" (const :tag "Citation first" before) - (const :tag "Citation last" after)))) - :safe t) + (const :tag "Citation last" after))))) (defcustom org-cite-punctuation-marks '("." "," ";" ":" "!" "?") "List of strings that can be moved around when placing note numbers. @@ -306,8 +304,7 @@ allowed to shuffle punctuation marks specified in this list in order to place note numbers according to rules defined in `org-cite-note-rules'." :group 'org-cite :package-version '(Org . "9.5") - :type '(repeat string) - :safe t) + :type '(repeat string)) ;;; Citation processors diff --git a/lisp/org/org-keys.el b/lisp/org/org-keys.el index 8fa551ad41c..a10db7e6667 100644 --- a/lisp/org/org-keys.el +++ b/lisp/org/org-keys.el @@ -279,8 +279,7 @@ before org.el is loaded." :type '(choice (const :tag "A double click follows the link" double) (const :tag "Unconditionally follow the link with mouse-1" t) - (integer :tag "mouse-1 click does not follow the link if longer than N ms" 450)) - :safe t) + (integer :tag "mouse-1 click does not follow the link if longer than N ms" 450))) (defcustom org-tab-follows-link nil "Non-nil means on links TAB will follow the link. From bb209cd5ab819c72784de7278092705e59ff41d5 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sat, 2 Oct 2021 14:27:55 -0400 Subject: [PATCH 16/51] Update to Org 9.5-30-g10dc9d The plan is to cut the Org 9.5.1 release and include it in Emacs 28.1, but in the meantime regularly sync changes from Org's bugfix branch to emacs-28. This sync includes files from Org 9.5's new etc/csl/ directory that should have been synced in bf9ec3d91a (Update to Org 9.5, 2021-09-29). --- etc/org/csl/README | 10 + etc/org/csl/chicago-author-date.csl | 658 ++++++++++++++++++++++++++++ etc/org/csl/locales-en-US.xml | 357 +++++++++++++++ lisp/org/ob-gnuplot.el | 2 +- lisp/org/ob-julia.el | 42 +- lisp/org/oc-csl.el | 24 +- lisp/org/org-macs.el | 9 +- lisp/org/org-src.el | 19 +- lisp/org/org-version.el | 2 +- lisp/org/org.el | 1 + 10 files changed, 1074 insertions(+), 50 deletions(-) create mode 100644 etc/org/csl/README create mode 100644 etc/org/csl/chicago-author-date.csl create mode 100644 etc/org/csl/locales-en-US.xml diff --git a/etc/org/csl/README b/etc/org/csl/README new file mode 100644 index 00000000000..a9212207ccf --- /dev/null +++ b/etc/org/csl/README @@ -0,0 +1,10 @@ +These data files are used by Org's oc-csl.el library. + +LICENSE INFORMATION + +chicago-author-date.csl +locales-en-US.xml + + Both of these files are part of the Citation Style Language (CSL) + project () and are released under the + Creative Commons Attribution-ShareAlike 3.0 Unported license. diff --git a/etc/org/csl/chicago-author-date.csl b/etc/org/csl/chicago-author-date.csl new file mode 100644 index 00000000000..8c133354b38 --- /dev/null +++ b/etc/org/csl/chicago-author-date.csl @@ -0,0 +1,658 @@ + + diff --git a/etc/org/csl/locales-en-US.xml b/etc/org/csl/locales-en-US.xml new file mode 100644 index 00000000000..be78c5e81fd --- /dev/null +++ b/etc/org/csl/locales-en-US.xml @@ -0,0 +1,357 @@ + + + + + Andrew Dunning + + + Sebastian Karcher + + + Rintze M. Zelle + + This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License + 2015-10-10T23:31:02+00:00 + + + + + + + + + + + + + + accessed + and + and others + anonymous + anon. + at + available at + by + circa + c. + cited + + edition + editions + + ed. + et al. + forthcoming + from + ibid. + in + in press + internet + interview + letter + no date + n.d. + online + presented at the + + reference + references + + + ref. + refs. + + retrieved + scale + version + + + AD + BC + + + + + + + + + + th + st + nd + rd + th + th + th + + + first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth + + + + book + books + + + chapter + chapters + + + column + columns + + + figure + figures + + + folio + folios + + + number + numbers + + + line + lines + + + note + notes + + + opus + opera + + + page + pages + + + page + pages + + + paragraph + paragraphs + + + part + parts + + + section + sections + + + sub verbo + sub verbis + + + verse + verses + + + volume + volumes + + + + + bk. + bks. + + + chap. + chaps. + + + col. + cols. + + + fig. + figs. + + + fol. + fols. + + + no. + nos. + + + l. + ll. + + + n. + nn. + + + op. + opp. + + + p. + pp. + + + p. + pp. + + + para. + paras. + + + pt. + pts. + + + sec. + secs. + + + s.v. + s.vv. + + + v. + vv. + + + vol. + vols. + + + + + + ¶¶ + + + § + §§ + + + + + director + directors + + + editor + editors + + + editor + editors + + + illustrator + illustrators + + + translator + translators + + + editor & translator + editors & translators + + + + + dir. + dirs. + + + ed. + eds. + + + ed. + eds. + + + ill. + ills. + + + tran. + trans. + + + ed. & tran. + eds. & trans. + + + + by + directed by + edited by + edited by + illustrated by + interview by + to + by + translated by + edited & translated by + + + dir. by + ed. by + ed. by + illus. by + trans. by + ed. & trans. by + + + January + February + March + April + May + June + July + August + September + October + November + December + + + Jan. + Feb. + Mar. + Apr. + May + Jun. + Jul. + Aug. + Sep. + Oct. + Nov. + Dec. + + + Spring + Summer + Autumn + Winter + + diff --git a/lisp/org/ob-gnuplot.el b/lisp/org/ob-gnuplot.el index 3c84e4da14f..8c4a5957b99 100644 --- a/lisp/org/ob-gnuplot.el +++ b/lisp/org/ob-gnuplot.el @@ -290,7 +290,7 @@ Pass PARAMS through to `orgtbl-to-generic' when exporting TABLE." (orgtbl-to-generic table (org-combine-plists - '(:sep "\t" :fmt org-babel-gnuplot-quote-tsv-field) + '(:sep "\t" :fmt org-babel-gnuplot-quote-tsv-field :raw t :backend ascii) params))))) data-file) diff --git a/lisp/org/ob-julia.el b/lisp/org/ob-julia.el index 434b414b614..4fae0d142b2 100644 --- a/lisp/org/ob-julia.el +++ b/lisp/org/ob-julia.el @@ -90,18 +90,13 @@ This function is called by `org-babel-execute-src-block'." (graphics-file (and (member "graphics" (assq :result-params params)) (org-babel-graphical-output-file params))) (colnames-p (unless graphics-file (cdr (assq :colnames params)))) - ;; (rownames-p (unless graphics-file (cdr (assq :rownames params)))) (full-body (org-babel-expand-body:julia body params graphics-file)) (result (org-babel-julia-evaluate session full-body result-type result-params (or (equal "yes" colnames-p) (org-babel-pick-name - (cdr (assq :colname-names params)) colnames-p)) - ;; (or (equal "yes" rownames-p) - ;; (org-babel-pick-name - ;; (cdr (assq :rowname-names params)) rownames-p)) - ))) + (cdr (assq :colname-names params)) colnames-p))))) (if graphics-file nil result)))) (defun org-babel-normalize-newline (result) @@ -135,12 +130,7 @@ This function is called by `org-babel-execute-src-block'." "Return list of julia statements assigning the block's variables." (let ((vars (org-babel--get-vars params))) (mapcar - (lambda (pair) - (org-babel-julia-assign-elisp - (car pair) (cdr pair) - ;; (equal "yes" (cdr (assq :colnames params))) - ;; (equal "yes" (cdr (assq :rownames params))) - )) + (lambda (pair) (org-babel-julia-assign-elisp (car pair) (cdr pair))) (mapcar (lambda (i) (cons (car (nth i vars)) @@ -156,7 +146,7 @@ This function is called by `org-babel-execute-src-block'." (concat "\"" (mapconcat #'identity (split-string s "\"") "\"\"") "\"") (format "%S" s))) -(defun org-babel-julia-assign-elisp (name value) ;; colnames-p rownames-p +(defun org-babel-julia-assign-elisp (name value) "Construct julia code assigning the elisp VALUE to a variable named NAME." (if (listp value) (let* ((lengths (mapcar #'length (cl-remove-if-not #'sequencep value))) @@ -164,11 +154,7 @@ This function is called by `org-babel-execute-src-block'." (min (if lengths (apply #'min lengths) 0))) ;; Ensure VALUE has an orgtbl structure (depth of at least 2). (unless (listp (car value)) (setq value (list value))) - (let ((file (orgtbl-to-csv value '(:fmt org-babel-julia-quote-csv-field))) - ;; (header (if (or (eq (nth 1 value) 'hline) colnames-p) - ;; "TRUE" "FALSE")) - ;; (row-names (if rownames-p "1" "NULL")) - ) + (let ((file (orgtbl-to-csv value '(:fmt org-babel-julia-quote-csv-field)))) (if (= max min) (format "%s = begin using CSV @@ -188,7 +174,7 @@ end" (let ((session (or session "*Julia*")) (ess-ask-for-ess-directory (and (bound-and-true-p ess-ask-for-ess-directory) - (not (cdr (assq :dir params)))))) + (not (cdr (assq :dir params)))))) (if (org-babel-comint-buffer-livep session) session ;; FIXME: Depending on `display-buffer-alist', (julia) may end up @@ -209,14 +195,6 @@ end" (buffer-name)))) (current-buffer)))))) - ; (defun org-babel-julia-associate-session (session) - ; "Associate julia code buffer with a julia session. - ; Make SESSION be the inferior ESS process associated with the - ; current code buffer." - ; (setq ess-local-process-name - ; (process-name (get-buffer-process session))) - ; (ess-make-buffer-current)) - (defun org-babel-julia-graphical-output-file (params) "Name of file to which julia should send graphical output." (and (member "graphics" (cdr (assq :result-params params))) @@ -259,16 +237,16 @@ end" end") (defun org-babel-julia-evaluate - (session body result-type result-params column-names-p) ;; row-names-p + (session body result-type result-params column-names-p) "Evaluate julia code in BODY." (if session (org-babel-julia-evaluate-session - session body result-type result-params column-names-p) ;; row-names-p + session body result-type result-params column-names-p) (org-babel-julia-evaluate-external-process - body result-type result-params column-names-p))) ;; row-names-p + body result-type result-params column-names-p))) (defun org-babel-julia-evaluate-external-process - (body result-type result-params column-names-p) ;; row-names-p + (body result-type result-params column-names-p) "Evaluate BODY in external julia process. If RESULT-TYPE equals 'output then return standard output as a string. If RESULT-TYPE equals 'value then return the value of the @@ -292,7 +270,7 @@ last statement in BODY, as elisp." (output (org-babel-eval org-babel-julia-command body)))) (defun org-babel-julia-evaluate-session - (session body result-type result-params column-names-p) ;; row-names-p + (session body result-type result-params column-names-p) "Evaluate BODY in SESSION. If RESULT-TYPE equals 'output then return standard output as a string. If RESULT-TYPE equals 'value then return the value of the diff --git a/lisp/org/oc-csl.el b/lisp/org/oc-csl.el index b847fbbc4f6..3d138807592 100644 --- a/lisp/org/oc-csl.el +++ b/lisp/org/oc-csl.el @@ -186,15 +186,21 @@ Used only when `second-field-align' is activated by the used CSL style." ;;; Internal variables (defconst org-cite-csl--etc-dir - (let* ((oc-root (file-name-directory (locate-library "oc"))) - (oc-etc-dir-1 (expand-file-name "../etc/csl/" oc-root))) - ;; package.el and straight will put all of org-mode/lisp/ in org-mode/. - ;; This will cause .. to resolve to the directory above Org. - ;; To make life easier for people using package.el or straight, we can - ;; check to see if ../etc/csl exists, and if it doesn't try ./etc/csl. - (if (file-exists-p oc-etc-dir-1) oc-etc-dir-1 - (expand-file-name "etc/csl/" oc-root))) - "Directory \"etc/\" from repository.") + (let ((oc-root (file-name-directory (locate-library "oc")))) + (cond + ;; First check whether it looks like we're running from the main + ;; Org repository. + ((let ((csl-org (expand-file-name "../etc/csl/" oc-root))) + (and (file-directory-p csl-org) csl-org))) + ;; Next look for the directory alongside oc.el because package.el + ;; and straight will put all of org-mode/lisp/ in org-mode/. + ((let ((csl-pkg (expand-file-name "etc/csl/" oc-root))) + (and (file-directory-p csl-pkg) csl-pkg))) + ;; Finally fall back the location used by shared system installs + ;; and when running directly from Emacs repository. + (t + (expand-file-name "org/csl/" data-directory)))) + "Directory containing CSL-related data files.") (defconst org-cite-csl--fallback-locales-dir org-cite-csl--etc-dir "Fallback CSL locale files directory.") diff --git a/lisp/org/org-macs.el b/lisp/org/org-macs.el index a8fb79ea3cd..0779c3a82c8 100644 --- a/lisp/org/org-macs.el +++ b/lisp/org/org-macs.el @@ -326,17 +326,19 @@ it for output." ;;; Indentation -(defun org-do-remove-indentation (&optional n) +(defun org-do-remove-indentation (&optional n skip-fl) "Remove the maximum common indentation from the buffer. When optional argument N is a positive integer, remove exactly -that much characters from indentation, if possible. Return nil -if it fails." +that much characters from indentation, if possible. When +optional argument SKIP-FL is non-nil, skip the first +line. Return nil if it fails." (catch :exit (goto-char (point-min)) ;; Find maximum common indentation, if not specified. (let ((n (or n (let ((min-ind (point-max))) (save-excursion + (when skip-fl (forward-line)) (while (re-search-forward "^[ \t]*\\S-" nil t) (let ((ind (current-indentation))) (if (zerop ind) (throw :exit nil) @@ -344,6 +346,7 @@ if it fails." min-ind)))) (if (zerop n) (throw :exit nil) ;; Remove exactly N indentation, but give up if not possible. + (when skip-fl (forward-line)) (while (not (eobp)) (let ((ind (progn (skip-chars-forward " \t") (current-column)))) (cond ((eolp) (delete-region (line-beginning-position) (point))) diff --git a/lisp/org/org-src.el b/lisp/org/org-src.el index 91a3d415dfa..8d02cf43450 100644 --- a/lisp/org/org-src.el +++ b/lisp/org/org-src.el @@ -38,6 +38,7 @@ (require 'org-keys) (declare-function org-mode "org" ()) +(declare-function org--get-expected-indentation "org" (element contentsp)) (declare-function org-element-at-point "org-element" ()) (declare-function org-element-class "org-element" (datum &optional parent)) (declare-function org-element-context "org-element" (&optional element)) @@ -327,7 +328,8 @@ a cons cell (LINE . COLUMN) or symbol `end'. See also (if (>= pos end) 'end (org-with-wide-buffer (goto-char (max beg pos)) - (cons (count-lines beg (line-beginning-position)) + (cons (count-lines (save-excursion (goto-char beg) (line-beginning-position)) + (line-beginning-position)) ;; Column is relative to the end of line to avoid problems of ;; comma escaping or colons appended in front of the line. (- (point) (min end (line-end-position))))))) @@ -445,6 +447,7 @@ Assume point is in the corresponding edit buffer." org-src--content-indentation 0)))) (use-tabs? (and (> org-src--tab-width 0) t)) + (preserve-fl (eq org-src--source-type 'latex-fragment)) (source-tab-width org-src--tab-width) (contents (org-with-wide-buffer (let ((eol (line-end-position))) @@ -466,7 +469,8 @@ Assume point is in the corresponding edit buffer." ;; Add INDENTATION-OFFSET to every line in buffer, ;; unless indentation is meant to be preserved. (when (> indentation-offset 0) - (while (not (eobp)) + (when preserve-fl (forward-line)) + (while (not (eobp)) (skip-chars-forward " \t") (when (or (not (eolp)) ; not a blank line (and (eq (point) (marker-position marker)) ; current line @@ -518,7 +522,13 @@ Leave point in edit buffer." (source-tab-width (if indent-tabs-mode tab-width 0)) (type (org-element-type datum)) (block-ind (org-with-point-at (org-element-property :begin datum) - (current-indentation))) + (cond + ((save-excursion (skip-chars-backward " \t") (bolp)) + (current-indentation)) + ((org-element-property :parent datum) + (org--get-expected-indentation + (org-element-property :parent datum) nil)) + (t (current-indentation))))) (content-ind org-edit-src-content-indentation) (blank-line (save-excursion (beginning-of-line) (looking-at-p "^[[:space:]]*$"))) @@ -548,7 +558,8 @@ Leave point in edit buffer." (insert contents) (remove-text-properties (point-min) (point-max) '(display nil invisible nil intangible nil)) - (unless preserve-ind (org-do-remove-indentation)) + (let ((lf (eq type 'latex-fragment))) + (unless preserve-ind (org-do-remove-indentation (and lf block-ind) lf))) (set-buffer-modified-p nil) (setq buffer-file-name nil) ;; Initialize buffer. diff --git a/lisp/org/org-version.el b/lisp/org/org-version.el index ef363dc3901..5bccbe497cc 100644 --- a/lisp/org/org-version.el +++ b/lisp/org/org-version.el @@ -11,7 +11,7 @@ Inserted by installing Org mode or when a release is made." (defun org-git-version () "The Git version of Org mode. Inserted by installing Org or when a release is made." - (let ((org-git-version "release_9.5")) + (let ((org-git-version "release_9.5-30-g10dc9d")) org-git-version)) (provide 'org-version) diff --git a/lisp/org/org.el b/lisp/org/org.el index 723de649429..bc0ea24bee7 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -5113,6 +5113,7 @@ stacked delimiters is N. Escaping delimiters is not possible." '(invisible t)) (add-text-properties (match-beginning 3) (match-end 3) '(invisible t))) + (goto-char (match-end 0)) (throw :exit t)))))))) (defun org-emphasize (&optional char) From 55dadbc57e5e89bd6aa67d26c5dc1a32a0a279fc Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Sat, 2 Oct 2021 22:22:41 +0300 Subject: [PATCH 17/51] * lisp/net/dictionary.el (context-menu-dictionary): Move menu item down. Place the dictionary menu item after middle-separator (bug#50552). --- lisp/net/dictionary.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lisp/net/dictionary.el b/lisp/net/dictionary.el index 86447c2c351..1d07989ef57 100644 --- a/lisp/net/dictionary.el +++ b/lisp/net/dictionary.el @@ -1382,10 +1382,12 @@ When you add this function to `context-menu-functions', the context menu will contain an item that searches the word at mouse click." (when (thing-at-mouse click 'word) - (define-key menu [dictionary-separator] menu-bar-separator) - (define-key menu [dictionary-search-word-at-mouse] + (define-key-after menu [dictionary-separator] menu-bar-separator + 'middle-separator) + (define-key-after menu [dictionary-search-word-at-mouse] '(menu-item "Dictionary Search" dictionary-search-word-at-mouse - :help "Search the word at mouse click in dictionary"))) + :help "Search the word at mouse click in dictionary") + 'dictionary-separator)) menu) (provide 'dictionary) From 6c01a213656cc1d38c9ac0b127583910a9296365 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sat, 2 Oct 2021 21:56:22 +0200 Subject: [PATCH 18/51] Clarify the purpose of internal--format-docstring-line * test/lisp/subr-tests.el (subr-test-internal--format-docstring-line): * lisp/subr.el (internal--format-docstring-line): Make it more clear that this function is not intended for the first line of a docstring. * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Add comment explaining why we use 'internal--format-docstring-line'. Problem pointed out by Stefan Monnier . --- lisp/emacs-lisp/cl-macs.el | 8 ++++++++ lisp/subr.el | 4 +++- test/lisp/subr-tests.el | 15 +++++++-------- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 527720c6e8d..1852471bcbb 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -3087,6 +3087,14 @@ To see the documentation for a defined struct type, use ;; and pred-check, so changing it is not straightforward. (push `(,defsym ,accessor (cl-x) ,(concat + ;; NB. This will produce incorrect results + ;; in some cases, as our coding conventions + ;; says that the first line must be a full + ;; sentence. However, if we don't word wrap + ;; we will have byte-compiler warnings about + ;; overly long docstrings. So we can't have + ;; a perfect result here, and choose to avoid + ;; the byte-compiler warnings. (internal--format-docstring-line "Access slot \"%s\" of `%s' struct CL-X." slot name) (if doc (concat "\n" doc) "")) diff --git a/lisp/subr.el b/lisp/subr.el index 1d2980802e0..a8fb52c9098 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -6437,7 +6437,9 @@ of fill.el (for example `fill-region')." (defun internal--format-docstring-line (string &rest objects) "Format a single line from a documentation string out of STRING and OBJECTS. Signal an error if STRING contains a newline. -This is intended for internal use only." +This is intended for internal use only. Avoid using this for the +first line of a docstring; the first line should be a complete +sentence (see Info node `(elisp) Documentation Tips')." (when (string-match "\n" string) (error "Unable to fill string containing newline: %S" string)) (internal--fill-string-single-line (apply #'format string objects))) diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index ed9a3d01498..0da1ae96873 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el @@ -769,15 +769,14 @@ See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19350." (ert-deftest subr-test-internal--format-docstring-line () (should - (string= (let ((fill-column 60)) + (string= (let ((fill-column 70)) (internal--format-docstring-line - "Emacs is the advanced, extensible, customizable, \ -self-documenting editor. This manual describes how to edit with Emacs and \ -some of the ways to customize it; it corresponds to GNU Emacs version 28.1.")) - "Emacs is the advanced, extensible, customizable, -self-documenting editor. This manual describes how to edit -with Emacs and some of the ways to customize it; it -corresponds to GNU Emacs version 28.1."))) + "In addition to any hooks its parent mode might have run, this \ +mode runs the hook ‘foo-bar-baz-very-long-name-indeed-mode-hook’, as the final \ +or penultimate step during initialization.")) + "In addition to any hooks its parent mode might have run, this mode +runs the hook ‘foo-bar-baz-very-long-name-indeed-mode-hook’, as the +final or penultimate step during initialization."))) (ert-deftest test-ensure-list () (should (equal (ensure-list nil) nil)) From b1a8a66fb0f28cba607831862fa673666a47bb2c Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sun, 3 Oct 2021 02:04:34 +0200 Subject: [PATCH 19/51] ; * etc/TODO: Fix previous commit; delete the right thing. --- etc/TODO | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/etc/TODO b/etc/TODO index da15ea1f77e..1efbd8d871c 100644 --- a/etc/TODO +++ b/etc/TODO @@ -74,10 +74,6 @@ Including it as an "experimental" compile-time option sounds good. Of course there might still be big questions around "which form of concurrency" we'll want. -** Better support for dynamic embedded graphics -I like this idea (my mpc.el code could use it for the volume widget), -though I wonder if the resulting efficiency will be sufficient. - ** Spread Semantic ** Improve the "code snippets" support @@ -396,6 +392,11 @@ should invoke the 'shape' method. 'hbfont_shape' should be extended to pass to 'hb_shape_full' the required array of features, as mentioned in the above HarfBuzz discussion. +** Better support for displaying Emoji +Emacs is capable of displaying Emoji and some of the Emoji sequences, +provided that its fontsets are configured with a suitable font. To +make this easier out of the box, the following should be done: + *** Populate composition-function-table with Emoji rules The Unicode Character Database (UCD) includes several data files that define the valid Emoji sequences. These files should be imported into From b47d7ce1b87ee8bbbb04ce2b784af57ece17177f Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 3 Oct 2021 11:28:27 +0200 Subject: [PATCH 20/51] Fix agent directory deletion * lisp/gnus/gnus-agent.el (gnus-agent-expire-unagentized-dirs): Delete directories in a simpler way that actually works (bug#50986). --- lisp/gnus/gnus-agent.el | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/lisp/gnus/gnus-agent.el b/lisp/gnus/gnus-agent.el index 19d05120045..6426d825465 100644 --- a/lisp/gnus/gnus-agent.el +++ b/lisp/gnus/gnus-agent.el @@ -3553,32 +3553,13 @@ articles in every agentized group? ")) (when (and to-remove (or gnus-expert-user (gnus-y-or-n-p - "gnus-agent-expire has identified local directories that are\ - not currently required by any agentized group. Do you wish to consider\ - deleting them?"))) - (while to-remove - (let ((dir (pop to-remove))) - (if (or gnus-expert-user + "gnus-agent-expire has identified local directories that are +not currently required by any agentized group. Do you wish to consider +deleting them?"))) + (dolist (dir to-remove) + (when (or gnus-expert-user (gnus-y-or-n-p (format "Delete %s? " dir))) - (let* (delete-recursive - files f - (delete-recursive - (lambda (f-or-d) - (ignore-errors - (if (file-directory-p f-or-d) - (condition-case nil - (delete-directory f-or-d) - (file-error - (setq files (directory-files f-or-d)) - (while files - (setq f (pop files)) - (or (member f '("." "..")) - (funcall delete-recursive - (nnheader-concat - f-or-d f)))) - (delete-directory f-or-d))) - (delete-file f-or-d)))))) - (funcall delete-recursive dir))))))))) + (delete-directory dir t))))))) ;;;###autoload (defun gnus-agent-batch () From 7fb27895090f8f9fe6cfa6311a77ec2c794adc84 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 3 Oct 2021 11:35:28 +0200 Subject: [PATCH 21/51] Fix substitution of pretty quotes in code in easy-mmode * lisp/emacs-lisp/easy-mmode.el (easy-mmode--arg-docstring): Adjust. (easy-mmode--mode-docstring): Avoid making quotes into pretty quotes in code (bug#50968). --- lisp/emacs-lisp/easy-mmode.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index d37bca24a0f..f752861d80a 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -93,7 +93,7 @@ Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number. To check whether the minor mode is enabled in the current buffer, -evaluate `%S'. +evaluate `%s'. The mode's hook is called both when the mode is enabled and when it is disabled.") @@ -109,7 +109,9 @@ it is disabled.") (docs-fc (bound-and-true-p emacs-lisp-docstring-fill-column)) (fill-column (if (integerp docs-fc) docs-fc 65)) (argdoc (format easy-mmode--arg-docstring mode-pretty-name - getter)) + ;; Avoid having quotes turn into pretty quotes. + (string-replace "'" "\\\\='" + (format "%S" getter)))) (filled (if (fboundp 'fill-region) (with-temp-buffer (insert argdoc) From b228ec9fab8ea5e09da4d3c3f41d7859d88afb7d Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 3 Oct 2021 14:34:08 +0300 Subject: [PATCH 22/51] Fix reading the tail of a file in shorthands.el * lisp/shorthands.el (hack-elisp-shorthands): Fix reading past 3000-character limit from EOF. (Bug#50946) --- lisp/shorthands.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/shorthands.el b/lisp/shorthands.el index b8204d62a2e..6162efd6095 100644 --- a/lisp/shorthands.el +++ b/lisp/shorthands.el @@ -40,7 +40,10 @@ except for extraction of the buffer-local value of (with-temp-buffer (while (and (< (buffer-size) 3000) (>= from 0)) (insert-file-contents fullname nil from to) - (setq to from from (- from 100))) + (setq to from + from (cond + ((= from 0) -1) + (t (max 0 (- from 100)))))) ;; FIXME: relies on the `hack-local-variables--find-variables' ;; detail of files.el. That function should be exported, ;; possibly be refactored into two parts, since we're only From 3dae1e33d19e2a7e0f879a38354944c9d567c9d3 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sun, 3 Oct 2021 14:27:26 +0200 Subject: [PATCH 23/51] Suppress superfluous error messages in Tramp * lisp/net/tramp-sshfs.el (tramp-sshfs-handle-insert-file-contents): * lisp/net/tramp.el (tramp-handle-insert-file-contents) (tramp-handle-lock-file): Suppress superfluous error message. --- lisp/net/tramp-sshfs.el | 7 ++++--- lisp/net/tramp.el | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lisp/net/tramp-sshfs.el b/lisp/net/tramp-sshfs.el index 0019ac014f8..688e408bfb0 100644 --- a/lisp/net/tramp-sshfs.el +++ b/lisp/net/tramp-sshfs.el @@ -222,9 +222,10 @@ arguments to pass to the OPERATION." (defun tramp-sshfs-handle-insert-file-contents (filename &optional visit beg end replace) "Like `insert-file-contents' for Tramp files." - (let ((result - (insert-file-contents - (tramp-fuse-local-file-name filename) visit beg end replace))) + (let* (signal-hook-function + (result + (insert-file-contents + (tramp-fuse-local-file-name filename) visit beg end replace))) (when visit (setq buffer-file-name filename)) (cons (expand-file-name filename) (cdr result)))) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 62628363b77..b69e143ff14 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3743,7 +3743,8 @@ User is always nil." (with-parsed-tramp-file-name filename nil (unwind-protect (if (not (file-exists-p filename)) - (tramp-compat-file-missing v filename) + (let ((tramp-verbose (if visit 0 tramp-verbose))) + (tramp-compat-file-missing v filename)) (with-tramp-progress-reporter v 3 (format-message "Inserting `%s'" filename) @@ -3920,7 +3921,8 @@ Return nil when there is no lockfile." (tramp-error v 'file-error "Unsafe lock file name"))) ;; Do the lock. - (let (create-lockfiles signal-hook-function) + (let ((tramp-verbose 0) + create-lockfiles signal-hook-function) (condition-case nil (make-symbolic-link info lockname 'ok-if-already-exists) (error From 17e6f3bee5a30f463082fad19d58de453ec9f490 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sun, 3 Oct 2021 17:01:30 +0200 Subject: [PATCH 24/51] ; Fix last change in tramp-sshfs.el --- lisp/net/tramp-sshfs.el | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lisp/net/tramp-sshfs.el b/lisp/net/tramp-sshfs.el index 688e408bfb0..68230ee1ffe 100644 --- a/lisp/net/tramp-sshfs.el +++ b/lisp/net/tramp-sshfs.el @@ -222,12 +222,14 @@ arguments to pass to the OPERATION." (defun tramp-sshfs-handle-insert-file-contents (filename &optional visit beg end replace) "Like `insert-file-contents' for Tramp files." - (let* (signal-hook-function - (result - (insert-file-contents - (tramp-fuse-local-file-name filename) visit beg end replace))) - (when visit (setq buffer-file-name filename)) - (cons (expand-file-name filename) (cdr result)))) + (setq filename (expand-file-name filename)) + (let (signal-hook-function result) + (unwind-protect + (setq result + (insert-file-contents + (tramp-fuse-local-file-name filename) visit beg end replace)) + (when visit (setq buffer-file-name filename)) + (cons filename (cdr result))))) (defun tramp-sshfs-handle-process-file (program &optional infile destination display &rest args) From e6fbc45b7b49a27ab4db348385762bafc330bcf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Sun, 3 Oct 2021 11:56:16 +0100 Subject: [PATCH 25/51] Font-lock shorthands in elisp-mode for quick visual recognition (bug#50959) Only the shorthanded prefix is font-locked. This allows the remainder of the font-lock logic to subsist (e.g. for macro-defining symbols). * lisp/shorthands.el (cl-lib): Require it when compiling. (elisp-shorthand-font-lock-face): New face. (shorthands--mismatch-from-end): New helper. (shorthands-font-lock-shorthands): New helper. * test/lisp/progmodes/elisp-mode-resources/simple-shorthand-test.el: Add some dummy test code. --- lisp/shorthands.el | 39 +++++++++++++++++++ .../simple-shorthand-test.el | 8 ++++ 2 files changed, 47 insertions(+) diff --git a/lisp/shorthands.el b/lisp/shorthands.el index 6162efd6095..f6570477776 100644 --- a/lisp/shorthands.el +++ b/lisp/shorthands.el @@ -26,6 +26,7 @@ ;;; Code: (require 'files) +(eval-when-compile (require 'cl-lib)) (defun hack-elisp-shorthands (fullname) "Return value of `elisp-shorthands' file-local variable in FULLNAME. @@ -57,4 +58,42 @@ value of `elisp-shorthands', when it processes that file's Elisp code." (let ((elisp-shorthands (hack-elisp-shorthands fullname))) (load-with-code-conversion fullname file noerror nomessage))) + +;; FIXME: move this all to progmodes/elisp-mode.el? OTOH it'd make +;; more sense there, OTOH all the elisp font-lock stuff is actually in +;; lisp/emacs-lisp/lisp-mode.el, which isn't right either. So +;; shorthand font-locking logic is probably better here for now. + +(defface elisp-shorthand-font-lock-face + '((t :inherit font-lock-keyword-face :foreground "cyan")) + "Face for highlighting shorthands in Emacs Lisp." + :version "28.1" + :group 'font-lock-faces) + +(defun shorthands--mismatch-from-end (str1 str2) + (cl-loop with l1 = (length str1) with l2 = (length str2) + for i from 1 + for i1 = (- l1 i) for i2 = (- l2 i) + while (and (>= i1 0) (>= i2 0) (eq (aref str1 i1) (aref str2 i2))) + finally (return (1- i)))) + +(defun shorthands-font-lock-shorthands (limit) + (when elisp-shorthands + (while (re-search-forward + (eval-when-compile + (concat "\\_<\\(" lisp-mode-symbol-regexp "\\)\\_>")) + limit t) + (let* ((existing (get-text-property (match-beginning 1) 'face)) + (probe (and (not (memq existing '(font-lock-comment-face + font-lock-string-face))) + (intern-soft (match-string 1)))) + (sname (and probe (symbol-name probe))) + (mm (and sname (shorthands--mismatch-from-end + (match-string 1) sname)))) + (unless (or (null mm) (= mm (length sname))) + (add-face-text-property (match-beginning 1) (1+ (- (match-end 1) mm)) + 'elisp-shorthand-font-lock-face)))))) + +(font-lock-add-keywords 'emacs-lisp-mode '((shorthands-font-lock-shorthands)) t) + ;;; shorthands.el ends here diff --git a/test/lisp/progmodes/elisp-mode-resources/simple-shorthand-test.el b/test/lisp/progmodes/elisp-mode-resources/simple-shorthand-test.el index ec568093af2..29ee36a3151 100644 --- a/test/lisp/progmodes/elisp-mode-resources/simple-shorthand-test.el +++ b/test/lisp/progmodes/elisp-mode-resources/simple-shorthand-test.el @@ -16,8 +16,16 @@ (defvar f-test-complete-me 42) +(elisp--foo-test3) + (defun #_f-test4--- () 84) +(defmacro f-define-test-5 ()) + +;; should be font locked with both shorthand +;; highlighting _and_ macro highlighting. +(f-define-test-5) + (when nil (f-test3) (f-test2) From 137fa2d71676044234ddf5a49c83585a0b9407b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Sun, 3 Oct 2021 12:14:41 +0100 Subject: [PATCH 26/51] Rename elisp-shorthands to read-symbol-shorthands The new name fits better in the family of variables that affect the Lisp reader. Suggested-by: Po Lu * doc/lispref/symbols.texi (Shorthands): Mention read-symbol-shorthands * lisp/shorthands.el (hack-read-symbol-shorthands) (hack-read-symbol-shorthands) (shorthands-font-lock-shorthands): Use read-symbol-shorthands * lisp/progmodes/elisp-mode.el (elisp--completion-local-symbols) (elisp--completion-local-symbols) (elisp-shorthands): Use read-symbol-shorthands * src/lread.c: (syms_of_lread): Define Vread_symbol_shorthands (oblookup_considering_shorthand): Use Vread_symbol_shorthands. * test/lisp/progmodes/elisp-mode-tests.el (elisp-shorthand-read-buffer): (elisp-shorthand-read-from-string): Use read-symbol-shorthands * test/lisp/progmodes/elisp-mode-resources/simple-shorthand-test.el Use new symbol name read-symbol-shorthands. --- doc/lispref/symbols.texi | 18 ++++++------- lisp/progmodes/elisp-mode.el | 12 ++++----- lisp/shorthands.el | 20 +++++++------- src/lread.c | 26 +++++++++---------- .../simple-shorthand-test.el | 8 +++--- test/lisp/progmodes/elisp-mode-tests.el | 4 +-- 6 files changed, 44 insertions(+), 44 deletions(-) diff --git a/doc/lispref/symbols.texi b/doc/lispref/symbols.texi index 8ae2d1fc88b..9c33e2c8ec2 100644 --- a/doc/lispref/symbols.texi +++ b/doc/lispref/symbols.texi @@ -666,7 +666,7 @@ different things. However, this practice commonly originates very long symbols names, which are inconvenient to type and read after a while. Shorthands solve these issues in a clean way. -@defvar elisp-shorthands +@defvar read-symbol-shorthands This variable's value is an alist whose elements have the form @code{(@var{shorthand-prefix} . @var{longhand-prefix})}. Each element instructs the Lisp reader to read every symbol form which starts with @@ -704,7 +704,7 @@ alleviate that. (snu-split "\\(\r\n\\|[\n\r]\\)" s)) ;; Local Variables: -;; elisp-shorthands: (("snu-" . "some-nice-string-utils-")) +;; read-symbol-shorthands: (("snu-" . "some-nice-string-utils-")) ;; End: @end lisp @@ -719,19 +719,19 @@ waiting for ElDoc (@pxref{Lisp Doc, , Local Variables in Files, emacs, The GNU Emacs Manual}) to hint at the true full name of the symbol under point in the echo area. -Since @code{elisp-shorthands} is a file-local variable, it is possible -that multiple libraries depending on +Since @code{read-symbol-shorthands} is a file-local variable, it is +possible that multiple libraries depending on @file{some-nice-string-utils-lines.el} refer to the same symbols under @emph{different} shorthands, or not using shorthands at all. In the -next example, the @file{my-tricks.el} library refers to the -symbol @code{some-nice-string-utils-lines} using the -@code{sns-} prefix instead of @code{snu-}. +next example, the @file{my-tricks.el} library refers to the symbol +@code{some-nice-string-utils-lines} using the @code{sns-} prefix +instead of @code{snu-}. @example (defun t-reverse-lines (s) (string-join (reverse (sns-lines s)) "\n") ;; Local Variables: -;; elisp-shorthands: (("t-" . "my-tricks-") -;; ("sns-" . "some-nice-string-utils-")) +;; read-symbol-shorthands: (("t-" . "my-tricks-") +;; ("sns-" . "some-nice-string-utils-")) ;; End: @end example diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index acf7123225f..c7474b25a78 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -548,7 +548,7 @@ in `completion-at-point-functions' (which see)." (lambda (s) (push s retval) (cl-loop - for (shorthand . longhand) in elisp-shorthands + for (shorthand . longhand) in read-symbol-shorthands for full-name = (symbol-name s) when (string-prefix-p longhand full-name) do (let ((sym (make-symbol @@ -559,17 +559,17 @@ in `completion-at-point-functions' (which see)." (push sym retval) retval)))) retval))) - (cond ((null elisp-shorthands) obarray) + (cond ((null read-symbol-shorthands) obarray) ((and obarray-cache - (gethash (cons (current-buffer) elisp-shorthands) + (gethash (cons (current-buffer) read-symbol-shorthands) obarray-cache))) (obarray-cache - (puthash (cons (current-buffer) elisp-shorthands) + (puthash (cons (current-buffer) read-symbol-shorthands) (obarray-plus-shorthands) obarray-cache)) (t (setq obarray-cache (make-hash-table :test #'equal)) - (puthash (cons (current-buffer) elisp-shorthands) + (puthash (cons (current-buffer) read-symbol-shorthands) (obarray-plus-shorthands) obarray-cache))))) @@ -2126,7 +2126,7 @@ Runs in a batch-mode Emacs. Interactively use variable (pp collected))) -(put 'elisp-shorthands 'safe-local-variable #'consp) +(put 'read-symbol-shorthands 'safe-local-variable #'consp) (provide 'elisp-mode) ;;; elisp-mode.el ends here diff --git a/lisp/shorthands.el b/lisp/shorthands.el index f6570477776..c31ef3d2168 100644 --- a/lisp/shorthands.el +++ b/lisp/shorthands.el @@ -28,13 +28,13 @@ (require 'files) (eval-when-compile (require 'cl-lib)) -(defun hack-elisp-shorthands (fullname) - "Return value of `elisp-shorthands' file-local variable in FULLNAME. +(defun hack-read-symbol-shorthands (fullname) + "Return value of `read-symbol-shorthands' file-local variable in FULLNAME. FULLNAME is the absolute file name of an Elisp .el file which -potentially specifies a file-local value for `elisp-shorthands'. -The Elisp code in FULLNAME isn't read or evaluated in any way, -except for extraction of the buffer-local value of -`elisp-shorthands'." +potentially specifies a file-local value for +`read-symbol-shorthands'. The Elisp code in FULLNAME isn't read +or evaluated in any way, except for extraction of the +buffer-local value of `read-symbol-shorthands'." (let* ((size (nth 7 (file-attributes fullname))) (from (max 0 (- size 3000))) (to size)) @@ -49,13 +49,13 @@ except for extraction of the buffer-local value of ;; detail of files.el. That function should be exported, ;; possibly be refactored into two parts, since we're only ;; interested in basic "Local Variables" parsing. - (alist-get 'elisp-shorthands (hack-local-variables--find-variables))))) + (alist-get 'read-symbol-shorthands (hack-local-variables--find-variables))))) (defun load-with-shorthands-and-code-conversion (fullname file noerror nomessage) "Like `load-with-code-conversion', but also consider Elisp shorthands. This function uses shorthands defined in the file FULLNAME's local -value of `elisp-shorthands', when it processes that file's Elisp code." - (let ((elisp-shorthands (hack-elisp-shorthands fullname))) +value of `read-symbol-shorthands', when it processes that file's Elisp code." + (let ((read-symbol-shorthands (hack-read-symbol-shorthands fullname))) (load-with-code-conversion fullname file noerror nomessage))) @@ -78,7 +78,7 @@ value of `elisp-shorthands', when it processes that file's Elisp code." finally (return (1- i)))) (defun shorthands-font-lock-shorthands (limit) - (when elisp-shorthands + (when read-symbol-shorthands (while (re-search-forward (eval-when-compile (concat "\\_<\\(" lisp-mode-symbol-regexp "\\)\\_>")) diff --git a/src/lread.c b/src/lread.c index af0a7994592..07580d11d13 100644 --- a/src/lread.c +++ b/src/lread.c @@ -4626,29 +4626,29 @@ oblookup (Lisp_Object obarray, register const char *ptr, ptrdiff_t size, ptrdiff return tem; } -/* Like 'oblookup', but considers 'Velisp_shorthands', potentially - recognizing that IN is shorthand for some other longhand name, - which is then then placed in OUT. In that case, memory is - malloc'ed for OUT (which the caller must free) while SIZE_OUT and - SIZE_BYTE_OUT respectively hold the character and byte sizes of the - transformed symbol name. If IN is not recognized shorthand for any - other symbol, OUT is set to point to NULL and 'oblookup' is - called. */ +/* Like 'oblookup', but considers 'Vread_symbol_shorthands', + potentially recognizing that IN is shorthand for some other + longhand name, which is then then placed in OUT. In that case, + memory is malloc'ed for OUT (which the caller must free) while + SIZE_OUT and SIZE_BYTE_OUT respectively hold the character and byte + sizes of the transformed symbol name. If IN is not recognized + shorthand for any other symbol, OUT is set to point to NULL and + 'oblookup' is called. */ Lisp_Object oblookup_considering_shorthand (Lisp_Object obarray, const char *in, ptrdiff_t size, ptrdiff_t size_byte, char **out, ptrdiff_t *size_out, ptrdiff_t *size_byte_out) { - Lisp_Object tail = Velisp_shorthands; + Lisp_Object tail = Vread_symbol_shorthands; /* First, assume no transformation will take place. */ *out = NULL; - /* Then, iterate each pair in Velisp_shorthands. */ + /* Then, iterate each pair in Vread_symbol_shorthands. */ FOR_EACH_TAIL_SAFE (tail) { Lisp_Object pair = XCAR (tail); - /* Be lenient to 'elisp-shorthands': if some element isn't a + /* Be lenient to 'read-symbol-shorthands': if some element isn't a cons, or some member of that cons isn't a string, just skip to the next element. */ if (!CONSP (pair)) @@ -5446,10 +5446,10 @@ that are loaded before your customizations are read! */); DEFSYM (Qchar_from_name, "char-from-name"); - DEFVAR_LISP ("elisp-shorthands", Velisp_shorthands, + DEFVAR_LISP ("read-symbol-shorthands", Vread_symbol_shorthands, doc: /* Alist of known symbol-name shorthands. This variable's value can only be set via file-local variables. See Info node `(elisp)Shorthands' for more details. */); - Velisp_shorthands = Qnil; + Vread_symbol_shorthands = Qnil; DEFSYM (Qobarray_cache, "obarray-cache"); } diff --git a/test/lisp/progmodes/elisp-mode-resources/simple-shorthand-test.el b/test/lisp/progmodes/elisp-mode-resources/simple-shorthand-test.el index 29ee36a3151..14c8e845d11 100644 --- a/test/lisp/progmodes/elisp-mode-resources/simple-shorthand-test.el +++ b/test/lisp/progmodes/elisp-mode-resources/simple-shorthand-test.el @@ -1,17 +1,17 @@ (defun f-test () - (let ((elisp-shorthands '(("foo-" . "bar-")))) + (let ((read-symbol-shorthands '(("foo-" . "bar-")))) (with-temp-buffer (insert "(foo-bar)") (goto-char (point-min)) (read (current-buffer))))) (defun f-test2 () - (let ((elisp-shorthands '(("foo-" . "bar-")))) + (let ((read-symbol-shorthands '(("foo-" . "bar-")))) (read-from-string "(foo-bar)"))) (defun f-test3 () - (let ((elisp-shorthands '(("foo-" . "bar-")))) + (let ((read-symbol-shorthands '(("foo-" . "bar-")))) (intern "foo-bar"))) (defvar f-test-complete-me 42) @@ -34,5 +34,5 @@ ;; Local Variables: -;; elisp-shorthands: (("f-" . "elisp--foo-")) +;; read-symbol-shorthands: (("f-" . "elisp--foo-")) ;; End: diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el index a3449c2b333..ad39cebfc8b 100644 --- a/test/lisp/progmodes/elisp-mode-tests.el +++ b/test/lisp/progmodes/elisp-mode-tests.el @@ -1026,7 +1026,7 @@ evaluation of BODY." (shorthand-sname (format "s-%s" gsym)) (expected (intern (format "shorthand-longhand-%s" gsym)))) (cl-assert (not (intern-soft shorthand-sname))) - (should (equal (let ((elisp-shorthands + (should (equal (let ((read-symbol-shorthands '(("s-" . "shorthand-longhand-")))) (with-temp-buffer (insert shorthand-sname) @@ -1040,7 +1040,7 @@ evaluation of BODY." (shorthand-sname (format "s-%s" gsym)) (expected (intern (format "shorthand-longhand-%s" gsym)))) (cl-assert (not (intern-soft shorthand-sname))) - (should (equal (let ((elisp-shorthands + (should (equal (let ((read-symbol-shorthands '(("s-" . "shorthand-longhand-")))) (car (read-from-string shorthand-sname))) expected)) From c1b1e1f5455260d457ca9024d253fb2157d0a48f Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 3 Oct 2021 19:05:49 +0300 Subject: [PATCH 27/51] Define HAVE_NATIVE_COMP in src/Makefile.in * src/Makefile.in (HAVE_NATIVE_COMP): Define. Reported by Ken Brown . --- src/Makefile.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Makefile.in b/src/Makefile.in index 34335cfa96d..46faeb60098 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -55,6 +55,8 @@ lwlibdir = ../lwlib # Configuration files for .o files to depend on. config_h = config.h $(srcdir)/conf_post.h +HAVE_NATIVE_COMP = @HAVE_NATIVE_COMP@ + ## ns-app if NS self contained app, else empty. OTHER_FILES = @OTHER_FILES@ From 7a6d34cd1f1ea2eb053578521632420d6ff9c0db Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sun, 3 Oct 2021 18:33:32 +0200 Subject: [PATCH 28/51] * etc/themes/light-blue-theme.el: Add "Maintainer: emacs-devel". --- etc/themes/light-blue-theme.el | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/themes/light-blue-theme.el b/etc/themes/light-blue-theme.el index 62528856da0..f49b37a15fd 100644 --- a/etc/themes/light-blue-theme.el +++ b/etc/themes/light-blue-theme.el @@ -3,6 +3,7 @@ ;; Copyright (C) 2011-2021 Free Software Foundation, Inc. ;; Author: Drew Adams +;; Maintainer: emacs-devel@gnu.org ;; This file is part of GNU Emacs. From 3863919a00e5f6c7cf9d4fe9e1b1a96fd5c18173 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sun, 3 Oct 2021 18:55:35 +0200 Subject: [PATCH 29/51] Fix unmounting in Tramp * doc/misc/tramp.texi (FUSE setup): Add tramp-fuse-unmount-on-cleanup. * lisp/net/tramp.el (tramp-file-name-unify): New defun. (tramp-file-name-equal-p): * lisp/net/tramp-cache.el (tramp-get-connection-property) (tramp-set-connection-property, tramp-flush-connection-property) (tramp-flush-connection-properties): Use it. * lisp/net/tramp-fuse.el (tramp-fuse-get-fusermount): New defun. (tramp-fuse-mount-points): New defvar. (tramp-fuse-unmount): Use it. Delete VEC from `tramp-fuse-mount-points'. Delete mount point. (tramp-fuse-unmount-on-cleanup): New user option. (tramp-fuse-cleanup, tramp-fuse-cleanup-all): New defuns. (top): Adapt `tramp-fuse-unload-hook', `tramp-cleanup-connection-hook', `tramp-cleanup-all-connections-hook' and `kill-emacs-hook'. * lisp/net/tramp-rclone.el (tramp-rclone-maybe-open-connection): * lisp/net/tramp-sshfs.el (tramp-sshfs-maybe-open-connection): Add VEC to `tramp-fuse-mount-points'. * test/lisp/net/tramp-tests.el (tramp-fuse-unmount-on-cleanup): Declare. (tramp-test39-make-lock-file-name): Use it. --- doc/misc/tramp.texi | 5 ++++ lisp/net/tramp-cache.el | 28 +++----------------- lisp/net/tramp-fuse.el | 51 +++++++++++++++++++++++++++++++++--- lisp/net/tramp-rclone.el | 1 + lisp/net/tramp-sshfs.el | 1 + lisp/net/tramp.el | 22 +++++++++++----- test/lisp/net/tramp-tests.el | 6 ++--- 7 files changed, 76 insertions(+), 38 deletions(-) diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index e1bf2f2bae5..95c744eef6e 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -2629,6 +2629,11 @@ Example: @end group @end lisp +@vindex tramp-fuse-unmount-on-cleanup +The user option @code{tramp-fuse-unmount-on-cleanup}, when set to +non-@code{nil}, controls, whether a mount point is unmounted on +connection cleanup or on Emacs exiting. + @anchor{Setup of rclone method} @subsection @option{rclone} setup diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el index 5a00915f4f0..f1c656ec209 100644 --- a/lisp/net/tramp-cache.el +++ b/lisp/net/tramp-cache.el @@ -319,12 +319,7 @@ KEY identifies the connection, it is either a process or a used to cache connection properties of the local machine. If KEY is `tramp-cache-undefined', or if the value is not set for the connection, return DEFAULT." - ;; Unify key by removing localname and hop from `tramp-file-name' - ;; structure. Work with a copy in order to avoid side effects. - (when (tramp-file-name-p key) - (setq key (copy-tramp-file-name key)) - (setf (tramp-file-name-localname key) nil - (tramp-file-name-hop key) nil)) + (setq key (tramp-file-name-unify key)) (let* ((hash (tramp-get-hash-table key)) (cached (if (hash-table-p hash) (gethash property hash tramp-cache-undefined) @@ -350,12 +345,7 @@ used to cache connection properties of the local machine. If KEY is `tramp-cache-undefined', nothing is set. PROPERTY is set persistent when KEY is a `tramp-file-name' structure. Return VALUE." - ;; Unify key by removing localname and hop from `tramp-file-name' - ;; structure. Work with a copy in order to avoid side effects. - (when (tramp-file-name-p key) - (setq key (copy-tramp-file-name key)) - (setf (tramp-file-name-localname key) nil - (tramp-file-name-hop key) nil)) + (setq key (tramp-file-name-unify key)) (when-let ((hash (tramp-get-hash-table key))) (puthash property value hash)) (setq tramp-cache-data-changed @@ -379,12 +369,7 @@ KEY identifies the connection, it is either a process or a `tramp-file-name' structure. A special case is nil, which is used to cache connection properties of the local machine. PROPERTY is set persistent when KEY is a `tramp-file-name' structure." - ;; Unify key by removing localname and hop from `tramp-file-name' - ;; structure. Work with a copy in order to avoid side effects. - (when (tramp-file-name-p key) - (setq key (copy-tramp-file-name key)) - (setf (tramp-file-name-localname key) nil - (tramp-file-name-hop key) nil)) + (setq key (tramp-file-name-unify key)) (when-let ((hash (tramp-get-hash-table key))) (remhash property hash)) (setq tramp-cache-data-changed @@ -397,12 +382,7 @@ PROPERTY is set persistent when KEY is a `tramp-file-name' structure." KEY identifies the connection, it is either a process or a `tramp-file-name' structure. A special case is nil, which is used to cache connection properties of the local machine." - ;; Unify key by removing localname and hop from `tramp-file-name' - ;; structure. Work with a copy in order to avoid side effects. - (when (tramp-file-name-p key) - (setq key (copy-tramp-file-name key)) - (setf (tramp-file-name-localname key) nil - (tramp-file-name-hop key) nil)) + (setq key (tramp-file-name-unify key)) (tramp-message key 7 "%s %s" key (when-let ((hash (gethash key tramp-cache-data))) diff --git a/lisp/net/tramp-fuse.el b/lisp/net/tramp-fuse.el index 8c5afa7cf93..d2bac2d0ee2 100644 --- a/lisp/net/tramp-fuse.el +++ b/lisp/net/tramp-fuse.el @@ -175,15 +175,30 @@ mount) (match-string 1 mount))))))) +(defun tramp-fuse-get-fusermount () + "Determine the local `fusermount' command." + ;; We use key nil for local connection properties. + (with-tramp-connection-property nil "fusermount" + (or (executable-find "fusermount3") + (executable-find "fusermount")))) + +(defvar tramp-fuse-mount-points nil + "List of fuse volume determined by a VEC.") + (defun tramp-fuse-unmount (vec) "Unmount fuse volume determined by VEC." - (let ((default-directory tramp-compat-temporary-file-directory) - (command (format "fusermount3 -u %s" (tramp-fuse-mount-point vec)))) + (let* ((default-directory tramp-compat-temporary-file-directory) + (mount-point (tramp-fuse-mount-point vec)) + (command (format "%s -u %s" (tramp-fuse-get-fusermount) mount-point))) (tramp-message vec 6 "%s\n%s" command (shell-command-to-string command)) (tramp-flush-connection-property (tramp-get-connection-process vec) "mounted") + (setq tramp-fuse-mount-points + (delete (tramp-file-name-unify vec) tramp-fuse-mount-points)) ;; Give the caches a chance to expire. - (sleep-for 1))) + (sleep-for 1) + (when (tramp-compat-directory-empty-p mount-point) + (delete-directory mount-point)))) (defun tramp-fuse-local-file-name (filename) "Return local mount name of FILENAME." @@ -205,6 +220,36 @@ (substring localname 1) localname) (tramp-fuse-mount-point v))))))) +(defcustom tramp-fuse-unmount-on-cleanup nil + "Whether fuse volumes shall be unmounted on cleanup." + :group 'tramp + :version "28.1" + :type 'boolean) + +(defun tramp-fuse-cleanup (vec) + "Cleanup fuse volume determined by VEC." + (and tramp-fuse-unmount-on-cleanup + (member (tramp-file-name-unify vec) tramp-fuse-mount-points) + (tramp-fuse-unmount vec))) + +(defun tramp-fuse-cleanup-all () + "Unmount all fuse volumes used by Tramp." + (and tramp-fuse-unmount-on-cleanup + (mapc #'tramp-fuse-unmount tramp-fuse-mount-points))) + +;; Add cleanup hooks. +(add-hook 'tramp-cleanup-connection-hook #'tramp-fuse-cleanup) +(add-hook 'tramp-cleanup-all-connections-hook #'tramp-fuse-cleanup-all) +(add-hook 'kill-emacs-hook #'tramp-fuse-cleanup-all) +(add-hook 'tramp-fuse-unload-hook + (lambda () + (remove-hook 'tramp-cleanup-connection-hook + #'tramp-fuse-cleanup) + (remove-hook 'tramp-cleanup-all-connections-hook + #'tramp-fuse-cleanup-all) + (remove-hook 'kill-emacs-hook + #'tramp-fuse-cleanup-all))) + (add-hook 'tramp-unload-hook (lambda () (unload-feature 'tramp-fuse 'force))) diff --git a/lisp/net/tramp-rclone.el b/lisp/net/tramp-rclone.el index 49e366c01c6..812e06f3f11 100644 --- a/lisp/net/tramp-rclone.el +++ b/lisp/net/tramp-rclone.el @@ -386,6 +386,7 @@ connection if a previous connection has died for some reason." (tramp-cleanup-connection vec 'keep-debug 'keep-password)) ;; Mark it as connected. + (add-to-list 'tramp-fuse-mount-points (tramp-file-name-unify vec)) (tramp-set-connection-property (tramp-get-connection-process vec) "connected" t)))) diff --git a/lisp/net/tramp-sshfs.el b/lisp/net/tramp-sshfs.el index 68230ee1ffe..2be0485fbf1 100644 --- a/lisp/net/tramp-sshfs.el +++ b/lisp/net/tramp-sshfs.el @@ -371,6 +371,7 @@ connection if a previous connection has died for some reason." vec 'file-error "Error mounting %s" (tramp-fuse-mount-spec vec)))) ;; Mark it as connected. + (add-to-list 'tramp-fuse-mount-points (tramp-file-name-unify vec)) (tramp-set-connection-property (tramp-get-connection-process vec) "connected" t))) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index b69e143ff14..c0f1cb161ec 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1450,16 +1450,24 @@ If nil, return `tramp-default-port'." (put #'tramp-file-name-port-or-default 'tramp-suppress-trace t) +(defun tramp-file-name-unify (vec) + "Unify VEC by removing localname and hop from `tramp-file-name' structure. +Objects returned by this function compare `equal' if they refer to the +same connection. Make a copy in order to avoid side effects." + (when (tramp-file-name-p vec) + (setq vec (copy-tramp-file-name vec)) + (setf (tramp-file-name-localname vec) nil + (tramp-file-name-hop vec) nil)) + vec) + +(put #'tramp-file-name-unify 'tramp-suppress-trace t) + ;; Comparison of file names is performed by `tramp-equal-remote'. (defun tramp-file-name-equal-p (vec1 vec2) "Check, whether VEC1 and VEC2 denote the same `tramp-file-name'." (and (tramp-file-name-p vec1) (tramp-file-name-p vec2) - (string-equal (tramp-file-name-method vec1) - (tramp-file-name-method vec2)) - (string-equal (tramp-file-name-user-domain vec1) - (tramp-file-name-user-domain vec2)) - (string-equal (tramp-file-name-host-port vec1) - (tramp-file-name-host-port vec2)))) + (equal (tramp-file-name-unify vec1) + (tramp-file-name-unify vec2)))) (defun tramp-get-method-parameter (vec param) "Return the method parameter PARAM. @@ -3846,7 +3854,7 @@ User is always nil." (delete-file (tramp-make-tramp-file-name v remote-copy 'nohop)))) ;; Result. - (cons (expand-file-name filename) (cdr result))))) + (cons filename (cdr result))))) (defun tramp-get-lock-file (file) "Read lockfile info of FILE. diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 9a1c9d659b4..ebedbaf45f2 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -69,6 +69,7 @@ (defvar tramp-connection-properties) (defvar tramp-copy-size-limit) (defvar tramp-display-escape-sequence-regexp) +(defvar tramp-fuse-unmount-on-cleanup) (defvar tramp-inline-compress-start-size) (defvar tramp-persistency-file-name) (defvar tramp-remote-path) @@ -5884,10 +5885,7 @@ Use direct async.") tramp-allow-unsafe-temporary-files (inhibit-message t) ;; tramp-rclone.el and tramp-sshfs.el cache the mounted files. - (tramp-cleanup-connection-hook - (append - (and (tramp--test-fuse-p) '(tramp-fuse-unmount)) - tramp-cleanup-connection-hook)) + (tramp-fuse-unmount-on-cleanup t) auto-save-default noninteractive) From 931a7276c036c25b5cde8971a3b0cb65873156b2 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Sun, 3 Oct 2021 20:13:29 +0300 Subject: [PATCH 30/51] * lisp/tab-line.el (tab-line-format): Add face-modified to the cache key. When tab-line-tab-face-functions contains tab-line-tab-face-modified, add 'buffer-modified-p' status to the cache-key, so the cache will expire when the buffer modification status will change. https://lists.gnu.org/archive/html/emacs-devel/2021-10/msg00129.html --- lisp/tab-line.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/tab-line.el b/lisp/tab-line.el index 4a751b384e5..890d1243e73 100644 --- a/lisp/tab-line.el +++ b/lisp/tab-line.el @@ -574,7 +574,10 @@ For use in `tab-line-tab-face-functions'." ;; handle tab-line scrolling (window-parameter nil 'tab-line-hscroll) ;; for setting face 'tab-line-tab-current' - (eq (selected-window) (old-selected-window)))) + (eq (selected-window) (old-selected-window)) + (and (memq 'tab-line-tab-face-modified + tab-line-tab-face-functions) + (buffer-file-name) (buffer-modified-p)))) (cache (window-parameter nil 'tab-line-cache))) ;; Enable auto-hscroll again after it was disabled on manual scrolling. ;; The moment to enable it is when the window-buffer was updated. From 0c341e6e84101251c0e40300519869f24415600d Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Sun, 3 Oct 2021 20:16:32 +0300 Subject: [PATCH 31/51] * lisp/tab-bar.el (tab-bar-detach-tab): Handle frame selected by make-frame. (tab-bar-move-window-to-tab): New command. (tab-bar-new-tab-to): Handle the value 'window' of tab-bar-new-tab-choice. https://lists.gnu.org/archive/html/emacs-devel/2021-09/msg02197.html --- lisp/tab-bar.el | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 634328e223b..68afb539fa3 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -1211,13 +1211,26 @@ Interactively, ARG selects the ARGth different frame to move to." "Detach tab number FROM-NUMBER to a new frame. Interactively or without argument, detach current tab." (interactive (list (1+ (tab-bar--current-tab-index)))) - (let* ((tab (nth (1- (or from-number 1)) (funcall tab-bar-tabs-function))) - (tab-name (alist-get 'name tab)) + (let* ((tabs (funcall tab-bar-tabs-function)) + (tab-index (1- (or from-number (1+ (tab-bar--current-tab-index tabs))))) + (tab-name (alist-get 'name (nth tab-index tabs))) + ;; On some window managers, `make-frame' selects the new frame, + ;; so previously selected frame is saved to `from-frame'. + (from-frame (selected-frame)) (new-frame (make-frame `((name . ,tab-name))))) - (tab-bar-move-tab-to-frame nil nil from-number new-frame nil) + (tab-bar-move-tab-to-frame nil from-frame from-number new-frame nil) (with-selected-frame new-frame (tab-bar-close-tab)))) +(defun tab-bar-move-window-to-tab () + "Detach the selected window to a new tab." + (interactive) + (let ((tab-bar-new-tab-choice 'window)) + (tab-bar-new-tab)) + (tab-bar-switch-to-recent-tab) + (delete-window) + (tab-bar-switch-to-recent-tab)) + (defcustom tab-bar-new-tab-to 'right "Defines where to create a new tab. @@ -1264,9 +1277,10 @@ After the tab is created, the hooks in (select-window (minibuffer-selected-window))) (let ((ignore-window-parameters t)) (delete-other-windows)) - ;; Create a new window to get rid of old window parameters - ;; (e.g. prev/next buffers) of old window. - (split-window) (delete-window) + (unless (eq tab-bar-new-tab-choice 'window) + ;; Create a new window to get rid of old window parameters + ;; (e.g. prev/next buffers) of old window. + (split-window) (delete-window)) (let ((buffer (if (functionp tab-bar-new-tab-choice) (funcall tab-bar-new-tab-choice) From 121a5abeaee85e7955786d838f07103ce074a63b Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Sun, 3 Oct 2021 20:35:49 +0300 Subject: [PATCH 32/51] Move context-menu selection items Defun/List/Symbol to prog-mode (bug#9054) * lisp/mouse.el (context-menu-functions): Add context-menu-middle-separator to choices. (context-menu-region): Move Defun/List/Symbol selection items to prog-context-menu. * lisp/progmodes/prog-mode.el (prog-context-menu): Move Defun/List/Symbol selection items from context-menu-region. Include text-mode select menu only in strings and comments. * lisp/textmodes/text-mode.el (text-mode-menu): New function. (text-mode): Add text-mode-menu to context-menu-functions. --- lisp/mouse.el | 13 +------------ lisp/progmodes/prog-mode.el | 22 ++++++++++++++++++++++ lisp/textmodes/text-mode.el | 25 ++++++++++++++++++++++++- 3 files changed, 47 insertions(+), 13 deletions(-) diff --git a/lisp/mouse.el b/lisp/mouse.el index 5d4e05fa25e..bb47d04a3a8 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -290,6 +290,7 @@ and should return the same menu with changes such as added new menu items." :type '(repeat (choice (function-item context-menu-undo) (function-item context-menu-region) + (function-item context-menu-middle-separator) (function-item context-menu-toolbar) (function-item context-menu-global) (function-item context-menu-local) @@ -478,14 +479,6 @@ Some context functions add menu items below the separator." `(menu-item "All" ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'buffer)) :help "Mark the whole buffer for a subsequent cut/copy")) - (define-key-after submenu [mark-defun] - `(menu-item "Defun" - ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'defun)) - :help "Mark the defun at click for a subsequent cut/copy")) - (define-key-after submenu [mark-list] - `(menu-item "List" - ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'list)) - :help "Mark the list at click for a subsequent cut/copy")) (when (let* ((pos (posn-point (event-end click))) (char (when pos (char-after pos)))) (or (and char (eq (char-syntax char) ?\")) @@ -498,10 +491,6 @@ Some context functions add menu items below the separator." `(menu-item "Line" ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'line)) :help "Mark the line at click for a subsequent cut/copy")) - (define-key-after submenu [mark-symbol] - `(menu-item "Symbol" - ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'symbol)) - :help "Mark the symbol at click for a subsequent cut/copy")) (when (region-active-p) (define-key-after submenu [mark-none] `(menu-item "None" diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el index 6c09dcf881d..4f15686dc87 100644 --- a/lisp/progmodes/prog-mode.el +++ b/lisp/progmodes/prog-mode.el @@ -68,6 +68,28 @@ `(menu-item "Find Definition" xref-find-definitions-at-mouse :help ,(format "Find definition of `%s'" identifier)) 'prog-separator))) + + (when (thing-at-mouse click 'symbol) + (define-key-after menu [select-region mark-symbol] + `(menu-item "Symbol" + ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'symbol)) + :help "Mark the symbol at click for a subsequent cut/copy") + 'mark-whole-buffer)) + (define-key-after menu [select-region mark-list] + `(menu-item "List" + ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'list)) + :help "Mark the list at click for a subsequent cut/copy") + 'mark-whole-buffer) + (define-key-after menu [select-region mark-defun] + `(menu-item "Defun" + ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'defun)) + :help "Mark the defun at click for a subsequent cut/copy") + 'mark-whole-buffer) + + ;; Include text-mode select menu only in strings and comments. + (when (nth 8 (save-excursion (syntax-ppss (posn-point (event-end click))))) + (text-mode-menu menu click)) + menu) (defvar prog-mode-map diff --git a/lisp/textmodes/text-mode.el b/lisp/textmodes/text-mode.el index 74c6d412a65..3243bd31c4c 100644 --- a/lisp/textmodes/text-mode.el +++ b/lisp/textmodes/text-mode.el @@ -95,6 +95,28 @@ inherit all the commands defined in this map.") :style toggle :selected (memq 'turn-on-auto-fill text-mode-hook)])) +(defun text-mode-menu (menu click) + "Populate MENU with text selection commands at CLICK." + + (when (thing-at-mouse click 'word) + (define-key-after menu [select-region mark-word] + `(menu-item "Word" + ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'word)) + :help "Mark the word at click for a subsequent cut/copy") + 'mark-whole-buffer)) + (define-key-after menu [select-region mark-sentence] + `(menu-item "Sentence" + ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'sentence)) + :help "Mark the sentence at click for a subsequent cut/copy") + 'mark-whole-buffer) + (define-key-after menu [select-region mark-paragraph] + `(menu-item "Paragraph" + ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'paragraph)) + :help "Mark the paragraph at click for a subsequent cut/copy") + 'mark-whole-buffer) + + menu) + (define-derived-mode text-mode nil "Text" "Major mode for editing text written for humans to read. @@ -104,7 +126,8 @@ You can thus get the full benefit of adaptive filling \\{text-mode-map} Turning on Text mode runs the normal hook `text-mode-hook'." (setq-local text-mode-variant t) - (setq-local require-final-newline mode-require-final-newline)) + (setq-local require-final-newline mode-require-final-newline) + (add-hook 'context-menu-functions 'text-mode-menu 10 t)) (define-derived-mode paragraph-indent-text-mode text-mode "Parindent" "Major mode for editing text, with leading spaces starting a paragraph. From 5deeb0947d3663b78c2fb975d1252b85e12fce86 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Sun, 3 Oct 2021 19:36:53 +0200 Subject: [PATCH 33/51] * src/Makefile.in: Simplify conditionals. --- src/Makefile.in | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/Makefile.in b/src/Makefile.in index 46faeb60098..c4e57ca63be 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -450,14 +450,9 @@ FIRSTFILE_OBJ=@FIRSTFILE_OBJ@ ALLOBJS = $(FIRSTFILE_OBJ) $(VMLIMIT_OBJ) $(obj) $(otherobj) # Must be first, before dep inclusion! -ifeq ($(HAVE_NATIVE_COMP),yes) -ifeq ($(NATIVE_DISABLED),) -all: emacs$(EXEEXT) $(pdmp) $(OTHER_FILES) ../native-lisp -else -all: emacs$(EXEEXT) $(pdmp) $(OTHER_FILES) -endif -else all: emacs$(EXEEXT) $(pdmp) $(OTHER_FILES) +ifeq ($(HAVE_NATIVE_COMP):$(NATIVE_DISABLED),yes:) +all: ../native-lisp endif .PHONY: all @@ -785,8 +780,7 @@ tags: TAGS ../lisp/TAGS $(lwlibdir)/TAGS @$(MAKE) $(AM_V_NO_PD) -C ../lisp EMACS="$(bootstrap_exe)"\ THEFILE=$< $ Date: Sun, 3 Oct 2021 18:13:23 +0000 Subject: [PATCH 34/51] Clarify (elisp) insert-file-contents with BEG or END not on character boundary * doc/lispref/files.texi (Reading from files): When the argument BEG or END to insert-file-contents are at a byte position not at a character boundary, clarify that raw bytes get inserted, and how to handle this awkwardness in Lisp. Also clarify that insert-file-contents-literally is intended to insert raw bytes into the buffer. Fix the outdated example that states it inserts 500 characters, when it actually inserts 500 bytes. --- doc/lispref/files.texi | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi index 2dc808e6945..e73f53b040d 100644 --- a/doc/lispref/files.texi +++ b/doc/lispref/files.texi @@ -563,7 +563,17 @@ In this case, @var{visit} must be @code{nil}. For example, @end example @noindent -inserts the first 500 characters of a file. +inserts the characters coded by the first 500 bytes of a file. + +If @var{beg} or @var{end} fails to be at a character boundary, Emacs's +character code conversion will insert one or more raw-text characters +(@pxref{Coding System Basics}) into the buffer. If you want to read +part of a file this way, you are recommended to bind +@code{coding-system-for-read} to a suitable value around the call to +this function (@pxref{Specifying Coding Systems}), and to write Lisp +code which will check for raw-text characters at the boundaries, read +the rest of these characters from the file, and convert them back to +valid characters. If the argument @var{replace} is non-@code{nil}, it means to replace the contents of the buffer (actually, just the accessible portion) with the @@ -577,10 +587,11 @@ with @code{insert-file-contents}, as long as @var{replace} and @end defun @defun insert-file-contents-literally filename &optional visit beg end replace -This function works like @code{insert-file-contents} except that it -does not run @code{after-insert-file-functions}, and does not do -format decoding, character code conversion, automatic uncompression, -and so on. +This function works like @code{insert-file-contents} except that each +byte in the file is handled separately, being converted into a +raw-text character if needed. It does not run +@code{after-insert-file-functions}, and does not do format decoding, +character code conversion, automatic uncompression, and so on. @end defun If you want to pass a file name to another process so that another From fc32a3bd958797ad4392a97b66e52bff420ac399 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 3 Oct 2021 21:30:34 +0300 Subject: [PATCH 35/51] ; * doc/lispref/files.texi (Reading from Files): Fix wording. --- doc/lispref/files.texi | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi index e73f53b040d..1e05153f3c0 100644 --- a/doc/lispref/files.texi +++ b/doc/lispref/files.texi @@ -565,15 +565,15 @@ In this case, @var{visit} must be @code{nil}. For example, @noindent inserts the characters coded by the first 500 bytes of a file. -If @var{beg} or @var{end} fails to be at a character boundary, Emacs's -character code conversion will insert one or more raw-text characters -(@pxref{Coding System Basics}) into the buffer. If you want to read -part of a file this way, you are recommended to bind -@code{coding-system-for-read} to a suitable value around the call to -this function (@pxref{Specifying Coding Systems}), and to write Lisp -code which will check for raw-text characters at the boundaries, read -the rest of these characters from the file, and convert them back to -valid characters. +If @var{beg} or @var{end} happens to be in the middle of a character's +multibyte sequence, Emacs's character code conversion will insert one +or more eight-bit characters (a.k.a.@: ``raw bytes'') +(@pxref{Character Sets}) into the buffer. If you want to read part of +a file this way, we recommend to bind @code{coding-system-for-read} to +a suitable value around the call to this function (@pxref{Specifying +Coding Systems}), and to write Lisp code which will check for raw +bytes at the boundaries, read the entire sequence of these bytes, and +convert them back to valid characters. If the argument @var{replace} is non-@code{nil}, it means to replace the contents of the buffer (actually, just the accessible portion) with the @@ -588,8 +588,8 @@ with @code{insert-file-contents}, as long as @var{replace} and @defun insert-file-contents-literally filename &optional visit beg end replace This function works like @code{insert-file-contents} except that each -byte in the file is handled separately, being converted into a -raw-text character if needed. It does not run +byte in the file is handled separately, being converted into an +eight-bit character if needed. It does not run @code{after-insert-file-functions}, and does not do format decoding, character code conversion, automatic uncompression, and so on. @end defun From 732c70a0d9d8db6a2fd77a52185f9a76743b05a9 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 3 Oct 2021 11:42:20 -0700 Subject: [PATCH 36/51] Simplify socket symlink-attack checking This is a minor bugfix cleanup (Bug#33847#161). * lib-src/emacsclient.c: Move "#include " to inside "#ifdef SOCKETS_IN_FILE_SYSTEM", which is more accurate and simpler than having a separate "#ifndef WINDOWSNT". (O_PATH): Likewise. --- lib-src/emacsclient.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 018e81e4222..cff3cec2a79 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -80,9 +80,6 @@ char *w32_getenv (const char *); #include #include -#ifndef WINDOWSNT -# include -#endif #include #include #include @@ -94,10 +91,6 @@ char *w32_getenv (const char *); # pragma GCC diagnostic ignored "-Wformat-truncation=2" #endif -#if !defined O_PATH && !defined WINDOWSNT -# define O_PATH O_SEARCH -#endif - /* Name used to invoke this program. */ static char const *progname; @@ -1135,6 +1128,12 @@ process_grouping (void) #ifdef SOCKETS_IN_FILE_SYSTEM +# include + +# ifndef O_PATH +# define O_PATH O_SEARCH +# endif + /* A local socket address. The union avoids the need to cast. */ union local_sockaddr { From 0bb42ef80357c86ea7dd6a2bccaff111bc83b65d Mon Sep 17 00:00:00 2001 From: Stephen Gildea Date: Sun, 3 Oct 2021 12:22:23 -0700 Subject: [PATCH 37/51] ; * lisp/time-stamp.el (time-stamp-format): Doc string. --- lisp/time-stamp.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/time-stamp.el b/lisp/time-stamp.el index e1ea922d040..178e490fb7d 100644 --- a/lisp/time-stamp.el +++ b/lisp/time-stamp.el @@ -59,7 +59,7 @@ with %, as follows. %#p `am' or `pm' %P gives uppercase: `AM' or `PM' %02S seconds %w day number of week, Sunday is 0 -%02y 2-digit year: `03' %Y 4-digit year: `2003' +%02y 2-digit year %Y 4-digit year %Z time zone name: `EST' %#Z gives lowercase: `est' %5z time zone offset: `-0500' (since Emacs 27; see note below) From 483142615864e990b2ec45e61681d7ab44096335 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 3 Oct 2021 22:35:04 +0300 Subject: [PATCH 38/51] Fix recipe for 'native-lisp' directory * src/Makefile.in (../native-lisp): If the directory native-lisp exists, do nothing. --- src/Makefile.in | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Makefile.in b/src/Makefile.in index c4e57ca63be..25c7865d4a1 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -804,10 +804,12 @@ elnlisp := $(addprefix ${lispsource}/,${elnlisp}) $(lisp:.elc=.eln) THEFILE=$< $ Date: Sun, 3 Oct 2021 16:05:40 +0100 Subject: [PATCH 39/51] Simplify hack-read-symbol-shorthands again (bug#50946) * lisp/loadup.el (load-source-file-function): Don't set twice. * lisp/shorthands.el (hack-read-symbol-shorthands): Simplify. (load-with-shorthands-and-code-conversion): Remove. * lisp/international/mule.el (load-with-code-conversion): Call hack-read-symbol-shorthands-function. Set up shorthands. (hack-read-symbol-shorthands-function): New variable. --- lisp/international/mule.el | 25 +++++++++++++++++++------ lisp/loadup.el | 1 - lisp/shorthands.el | 37 +++++++++---------------------------- 3 files changed, 28 insertions(+), 35 deletions(-) diff --git a/lisp/international/mule.el b/lisp/international/mule.el index 2a855b56736..5022a17db5a 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el @@ -294,6 +294,9 @@ attribute." (apply 'define-charset-internal name (mapcar 'cdr attrs)))) +(defvar hack-read-symbol-shorthands-function nil + "Holds function to compute `read-symbol-shorthands'.") + (defun load-with-code-conversion (fullname file &optional noerror nomessage) "Execute a file of Lisp code named FILE whose absolute name is FULLNAME. The file contents are decoded before evaluation if necessary. @@ -319,7 +322,8 @@ Return t if file exists." (let ((load-true-file-name fullname) (load-file-name fullname) (set-auto-coding-for-load t) - (inhibit-file-name-operation nil)) + (inhibit-file-name-operation nil) + shorthands) (with-current-buffer buffer ;; So that we don't get completely screwed if the ;; file is encoded in some complicated character set, @@ -328,6 +332,13 @@ Return t if file exists." ;; Don't let deactivate-mark remain set. (let (deactivate-mark) (insert-file-contents fullname)) + (setq shorthands + ;; We need this indirection because hacking local + ;; variables in too early seems to have cause + ;; recursive load loops (bug#50946). Thus it + ;; remains nil until it is save to do so. + (and hack-read-symbol-shorthands-function + (funcall hack-read-symbol-shorthands-function))) ;; If the loaded file was inserted with no-conversion or ;; raw-text coding system, make the buffer unibyte. ;; Otherwise, eval-buffer might try to interpret random @@ -338,11 +349,13 @@ Return t if file exists." (set-buffer-multibyte nil)) ;; Make `kill-buffer' quiet. (set-buffer-modified-p nil)) - ;; Have the original buffer current while we eval. - (eval-buffer buffer nil - ;; This is compatible with what `load' does. - (if dump-mode file fullname) - nil t)) + ;; Have the original buffer current while we eval, + ;; but consider shorthands of the eval'ed one. + (let ((read-symbol-shorthands shorthands)) + (eval-buffer buffer nil + ;; This is compatible with what `load' does. + (if dump-mode file fullname) + nil t))) (let (kill-buffer-hook kill-buffer-query-functions) (kill-buffer buffer))) (do-after-load-evaluation fullname) diff --git a/lisp/loadup.el b/lisp/loadup.el index 3fb6b813285..3a55d2c8057 100644 --- a/lisp/loadup.el +++ b/lisp/loadup.el @@ -355,7 +355,6 @@ (load "paren") (load "shorthands") -(setq load-source-file-function #'load-with-shorthands-and-code-conversion) (load "emacs-lisp/eldoc") (load "cus-start") ;Late to reduce customize-rogue (needs loaddefs.el anyway) diff --git a/lisp/shorthands.el b/lisp/shorthands.el index c31ef3d2168..e9f5880ab29 100644 --- a/lisp/shorthands.el +++ b/lisp/shorthands.el @@ -26,37 +26,18 @@ ;;; Code: (require 'files) +(require 'mule) (eval-when-compile (require 'cl-lib)) -(defun hack-read-symbol-shorthands (fullname) - "Return value of `read-symbol-shorthands' file-local variable in FULLNAME. -FULLNAME is the absolute file name of an Elisp .el file which -potentially specifies a file-local value for -`read-symbol-shorthands'. The Elisp code in FULLNAME isn't read -or evaluated in any way, except for extraction of the -buffer-local value of `read-symbol-shorthands'." - (let* ((size (nth 7 (file-attributes fullname))) - (from (max 0 (- size 3000))) - (to size)) - (with-temp-buffer - (while (and (< (buffer-size) 3000) (>= from 0)) - (insert-file-contents fullname nil from to) - (setq to from - from (cond - ((= from 0) -1) - (t (max 0 (- from 100)))))) - ;; FIXME: relies on the `hack-local-variables--find-variables' - ;; detail of files.el. That function should be exported, - ;; possibly be refactored into two parts, since we're only - ;; interested in basic "Local Variables" parsing. - (alist-get 'read-symbol-shorthands (hack-local-variables--find-variables))))) +(defun hack-read-symbol-shorthands () + "Compute `read-symbol-shorthands' from Local Variables section." + ;; FIXME: relies on the `hack-local-variables--find-variables' + ;; detail of files.el. That function should be exported, + ;; possibly be refactored into two parts, since we're only + ;; interested in basic "Local Variables" parsing. + (alist-get 'read-symbol-shorthands (hack-local-variables--find-variables))) -(defun load-with-shorthands-and-code-conversion (fullname file noerror nomessage) - "Like `load-with-code-conversion', but also consider Elisp shorthands. -This function uses shorthands defined in the file FULLNAME's local -value of `read-symbol-shorthands', when it processes that file's Elisp code." - (let ((read-symbol-shorthands (hack-read-symbol-shorthands fullname))) - (load-with-code-conversion fullname file noerror nomessage))) +(setq hack-read-symbol-shorthands-function #'hack-read-symbol-shorthands) ;; FIXME: move this all to progmodes/elisp-mode.el? OTOH it'd make From cc3fc94f09332e5cca28fea1f19a93c8d45fd0f8 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 3 Oct 2021 16:31:50 -0700 Subject: [PATCH 40/51] Pacify gcc 11.2.1 -Wanalyzer-null-argument * src/gtkutil.c (xg_item_label_same_p): Clarify boolean expression to pacify -Wanalyzer-null-argument with GCC 11.2.1 20210728 (Red Hat 11.2.1-1). --- src/gtkutil.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gtkutil.c b/src/gtkutil.c index 313cfc82c26..e87845caf70 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -2932,8 +2932,9 @@ xg_item_label_same_p (GtkMenuItem *witem, const char *label) char *utf8_label = get_utf8_string (label); const char *old_label = witem ? xg_get_menu_item_label (witem) : 0; - bool is_same = (!old_label == !utf8_label - && (!old_label || strcmp (utf8_label, old_label) == 0)); + bool is_same = (old_label + ? utf8_label && strcmp (utf8_label, old_label) == 0 + : !utf8_label); if (utf8_label) g_free (utf8_label); From fd274d7d24ec35d64974b007cfe881c0e07edf9d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 3 Oct 2021 16:37:13 -0700 Subject: [PATCH 41/51] Pacify -Wanalyzer-null-argument in lisp_malloc * src/alloc.c (lisp_malloc): Document that NBYTES must be positive, and omit a needless runtime check. This pacifies a false alarm with gcc 11.2.1 -Wanalyzer-possible-null-dereference. --- src/alloc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/alloc.c b/src/alloc.c index 0895a0f52aa..0c04d5cde05 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -988,7 +988,8 @@ record_xmalloc (size_t size) /* Like malloc but used for allocating Lisp data. NBYTES is the number of bytes to allocate, TYPE describes the intended use of the - allocated memory block (for strings, for conses, ...). */ + allocated memory block (for strings, for conses, ...). + NBYTES must be positive. */ #if ! USE_LSB_TAG void *lisp_malloc_loser EXTERNALLY_VISIBLE; @@ -1030,7 +1031,7 @@ lisp_malloc (size_t nbytes, bool clearit, enum mem_type type) #endif MALLOC_UNBLOCK_INPUT; - if (!val && nbytes) + if (!val) memory_full (nbytes); MALLOC_PROBE (nbytes); return val; From 6d9b3c0eaab2d553b2fea127f2f2b9fa44f44450 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 3 Oct 2021 17:22:30 -0700 Subject: [PATCH 42/51] Port systhreads.h to C2x * src/systhread.h: Put NODISCARD at the start of extern declarations, not at the end. This is needed by C2x. This patch also pacifies gcc 11.2.1 -Wattributes. --- src/systhread.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/systhread.h b/src/systhread.h index 0f47d7c1a8a..601505f4f86 100644 --- a/src/systhread.h +++ b/src/systhread.h @@ -101,14 +101,11 @@ extern void sys_cond_signal (sys_cond_t *); extern void sys_cond_broadcast (sys_cond_t *); extern void sys_cond_destroy (sys_cond_t *); -extern sys_thread_t sys_thread_self (void) - NODISCARD; -extern bool sys_thread_equal (sys_thread_t, sys_thread_t) - NODISCARD; +NODISCARD extern sys_thread_t sys_thread_self (void); +NODISCARD extern bool sys_thread_equal (sys_thread_t, sys_thread_t); -extern bool sys_thread_create (sys_thread_t *, thread_creation_function *, - void *) - NODISCARD; +NODISCARD extern bool sys_thread_create (sys_thread_t *, + thread_creation_function *, void *); extern void sys_thread_yield (void); extern void sys_thread_set_name (const char *); From 2a00634880adb20071686906ebb183326f2060e0 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 3 Oct 2021 17:45:20 -0700 Subject: [PATCH 43/51] Port pdumper.c maybe_unused to C2x MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Port pdumper.c to C2x, and pacify gcc 11.2.1 -Wattributes -Wunused. * src/pdumper.c (dump_tailq_prepend): Omit ATTRIBUTE_UNUSED, since it’s always used. (dump_tailq_append): Remove; unused. --- src/pdumper.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/src/pdumper.c b/src/pdumper.c index 2291fced5d7..11c680d77b7 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -799,7 +799,7 @@ dump_tailq_length (const struct dump_tailq *tailq) return tailq->length; } -static void ATTRIBUTE_UNUSED +static void dump_tailq_prepend (struct dump_tailq *tailq, Lisp_Object value) { Lisp_Object link = Fcons (value, tailq->head); @@ -809,24 +809,6 @@ dump_tailq_prepend (struct dump_tailq *tailq, Lisp_Object value) tailq->length += 1; } -static void ATTRIBUTE_UNUSED -dump_tailq_append (struct dump_tailq *tailq, Lisp_Object value) -{ - Lisp_Object link = Fcons (value, Qnil); - if (NILP (tailq->head)) - { - eassert (NILP (tailq->tail)); - tailq->head = tailq->tail = link; - } - else - { - eassert (!NILP (tailq->tail)); - XSETCDR (tailq->tail, link); - tailq->tail = link; - } - tailq->length += 1; -} - static bool dump_tailq_empty_p (struct dump_tailq *tailq) { From 7e871dcd27bdb827573ca97e609632e178e76f64 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 3 Oct 2021 17:52:04 -0700 Subject: [PATCH 44/51] Remove encode_terminal_code UNINITs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * src/term.c (encode_terminal_code): Clarify by removing a couple of UNINITs and testing the local variable ‘cmp’ instead of retesting src->u.cmp.automatic. This pacifies gcc 11.2.1 -Wanalyzer-null-dereference. --- src/term.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/term.c b/src/term.c index 7d9fe8cee30..0858f816851 100644 --- a/src/term.c +++ b/src/term.c @@ -549,13 +549,14 @@ encode_terminal_code (struct glyph *src, int src_len, { if (src->type == COMPOSITE_GLYPH) { - struct composition *cmp UNINIT; - Lisp_Object gstring UNINIT; + struct composition *cmp; + Lisp_Object gstring; int i; nbytes = buf - encode_terminal_src; if (src->u.cmp.automatic) { + cmp = NULL; gstring = composition_gstring_from_id (src->u.cmp.id); required = src->slice.cmp.to - src->slice.cmp.from + 1; } @@ -575,7 +576,7 @@ encode_terminal_code (struct glyph *src, int src_len, buf = encode_terminal_src + nbytes; } - if (src->u.cmp.automatic) + if (!cmp) for (i = src->slice.cmp.from; i <= src->slice.cmp.to; i++) { Lisp_Object g = LGSTRING_GLYPH (gstring, i); From 87153cc9151fe2398c243cf49eb27584c166c58a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 3 Oct 2021 17:58:16 -0700 Subject: [PATCH 45/51] Tweak x_hide_tip for consistency * src/xfns.c (x_hide_tip, Fx_show_tip): Be consistent about using !NILP (tip_frame) instead of FRAMEP (tip_frame). The two expressions are logically equivalent since tip_frame is either a frame or nil, !NILP is a bit faster, and making things consistent pacifies gcc 11.2.1 -Wanalyzer-null-dereference. --- src/xfns.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/xfns.c b/src/xfns.c index 0d0335c2997..785ae3baca5 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -6222,7 +6222,7 @@ Otherwise, the return value is a vector with the following fields: static void compute_tip_xy (struct frame *, Lisp_Object, Lisp_Object, Lisp_Object, int, int, int *, int *); -/* The frame of the currently visible tooltip. */ +/* The frame of the currently visible tooltip, or nil if none. */ static Lisp_Object tip_frame; /* The window-system window corresponding to the frame of the @@ -6710,7 +6710,7 @@ x_hide_tip (bool delete) if ((NILP (tip_last_frame) && NILP (tip_frame)) || (!x_gtk_use_system_tooltips && !delete - && FRAMEP (tip_frame) + && !NILP (tip_frame) && FRAME_LIVE_P (XFRAME (tip_frame)) && !FRAME_VISIBLE_P (XFRAME (tip_frame)))) /* Either there's no tooltip to hide or it's an already invisible @@ -6727,7 +6727,7 @@ x_hide_tip (bool delete) specbind (Qinhibit_quit, Qt); /* Try to hide the GTK+ system tip first. */ - if (FRAMEP (tip_last_frame)) + if (!NILP (tip_last_frame)) { struct frame *f = XFRAME (tip_last_frame); @@ -6745,7 +6745,7 @@ x_hide_tip (bool delete) tip_last_frame = Qnil; /* Now look whether there's an Emacs tip around. */ - if (FRAMEP (tip_frame)) + if (!NILP (tip_frame)) { struct frame *f = XFRAME (tip_frame); @@ -6775,7 +6775,7 @@ x_hide_tip (bool delete) #else /* not USE_GTK */ if (NILP (tip_frame) || (!delete - && FRAMEP (tip_frame) + && !NILP (tip_frame) && FRAME_LIVE_P (XFRAME (tip_frame)) && !FRAME_VISIBLE_P (XFRAME (tip_frame)))) return Qnil; @@ -6788,7 +6788,7 @@ x_hide_tip (bool delete) specbind (Qinhibit_redisplay, Qt); specbind (Qinhibit_quit, Qt); - if (FRAMEP (tip_frame)) + if (!NILP (tip_frame)) { struct frame *f = XFRAME (tip_frame); @@ -6931,7 +6931,7 @@ Text larger than the specified size is clipped. */) } #endif /* USE_GTK */ - if (FRAMEP (tip_frame) && FRAME_LIVE_P (XFRAME (tip_frame))) + if (!NILP (tip_frame) && FRAME_LIVE_P (XFRAME (tip_frame))) { if (FRAME_VISIBLE_P (XFRAME (tip_frame)) && EQ (frame, tip_last_frame) @@ -7016,7 +7016,7 @@ Text larger than the specified size is clipped. */) tip_last_string = string; tip_last_parms = parms; - if (!FRAMEP (tip_frame) || !FRAME_LIVE_P (XFRAME (tip_frame))) + if (NILP (tip_frame) || !FRAME_LIVE_P (XFRAME (tip_frame))) { /* Add default values to frame parameters. */ if (NILP (Fassq (Qname, parms))) From c0793cd9dea407e244537f77361cfbe5077181db Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Mon, 4 Oct 2021 01:08:03 +0200 Subject: [PATCH 46/51] Don't use some obsolete names in documentation * admin/notes/bugtracker: Use non-obsolete name 'mail-dont-reply-to-names'. * admin/notes/multi-tty: Mention new variable name 'x-selection-value'. * doc/lispintro/emacs-lisp-intro.texi (Point and mark) (Point and mark, Design @value{COUNT-WORDS}): Avoid using obsolete name 'count-lines-region'. * doc/lispref/hooks.texi (Standard Hooks): Remove reference to obsolete abnormal hook 'completion-annotate-function'. * doc/misc/efaq.texi (SPC no longer completes file names): Remove reference to obsolete 'minibuffer-local-filename-must-match-map'; setting it has no effect. * doc/misc/gnus.texi (NNTP): Remove reference to obsolete variable 'nntp-authinfo-file'. * doc/misc/reftex.texi (Table of Contents, Creating Citations) (Options - Table of Contents, Options - Referencing Labels) (Options - Creating Citations, Options - Index Support) (Options - Index Support, Changes): Don't use obsolete names. * doc/misc/speedbar.texi (Minor Display Modes) (Major Display Modes): Make variable name suggestions more in line with existing non-obsolete variable. * lisp/textmodes/reftex-cite.el (reftex-select-bib-mode-map): * lisp/textmodes/reftex-ref.el (reftex-offer-label-menu): Don't use obsolete variable names. * lisp/progmodes/which-func.el (which-func-mode): Doc fix. --- admin/notes/bugtracker | 2 +- admin/notes/multi-tty | 2 +- doc/lispintro/emacs-lisp-intro.texi | 7 +++---- doc/lispref/hooks.texi | 1 - doc/misc/efaq.texi | 3 --- doc/misc/gnus.texi | 4 +--- doc/misc/reftex.texi | 26 +++++++++++++------------- doc/misc/speedbar.texi | 6 +++--- lisp/progmodes/which-func.el | 3 ++- lisp/textmodes/reftex-cite.el | 4 ++-- lisp/textmodes/reftex-ref.el | 4 ++-- 11 files changed, 28 insertions(+), 34 deletions(-) diff --git a/admin/notes/bugtracker b/admin/notes/bugtracker index 9eb65e1f864..deb06f552cc 100644 --- a/admin/notes/bugtracker +++ b/admin/notes/bugtracker @@ -84,7 +84,7 @@ generate a new report. The only time to send mail to the bug list address is to create a new report. Gnus users can add the following to message-dont-reply-to-names; -similarly with Rmail and rmail-dont-reply-to-names: +similarly with Rmail and mail-dont-reply-to-names: "\\(emacs-pretest-bug\\|bug-gnu-emacs\\|bug-\\(e\\|gnu\\)macs\\)@gnu\\.org\\|\ \\(submit\\|control\\|owner\\)@debbugs\\.gnu\\.org" diff --git a/admin/notes/multi-tty b/admin/notes/multi-tty index 1a337b9d799..fa4df820ae4 100644 --- a/admin/notes/multi-tty +++ b/admin/notes/multi-tty @@ -474,7 +474,7 @@ THINGS TO DO definition. Exceptions found so far: x-select-text and - x-cut-buffer-or-selection-value. + x-selection-value (old name: x-cut-buffer-or-selection-value). ** Have a look at fatal_error_hook. diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi index 7c7005b3483..9dbf854171c 100644 --- a/doc/lispintro/emacs-lisp-intro.texi +++ b/doc/lispintro/emacs-lisp-intro.texi @@ -4201,7 +4201,7 @@ times. The part of the buffer between point and mark is called @dfn{the region}. Numerous commands work on the region, including -@code{center-region}, @code{count-lines-region}, @code{kill-region}, and +@code{center-region}, @code{count-words-region}, @code{kill-region}, and @code{print-region}. The @code{save-excursion} special form saves the location of point and @@ -4214,7 +4214,7 @@ evaluated. In Emacs, a function frequently moves point as part of its internal workings even though a user would not expect this. For example, -@code{count-lines-region} moves point. To prevent the user from being +@code{count-words-region} moves point. To prevent the user from being bothered by jumps that are both unexpected and (from the user's point of view) unnecessary, @code{save-excursion} is often used to keep point in the location expected by the user. The use of @@ -13473,8 +13473,7 @@ The template for an interactive function definition is, as always: What we need to do is fill in the slots. -The name of the function should be self-explanatory and similar to the -existing @code{count-lines-region} name. This makes the name easier +The name of the function should be self-explanatory and easy to remember. @code{count-words-region} is the obvious choice. Since that name is now used for the standard Emacs command to count words, we will name our implementation @code{@value{COUNT-WORDS}}. diff --git a/doc/lispref/hooks.texi b/doc/lispref/hooks.texi index 394928454b0..feec8b24f46 100644 --- a/doc/lispref/hooks.texi +++ b/doc/lispref/hooks.texi @@ -262,7 +262,6 @@ after-set-visited-file-name-hook auto-coding-functions choose-completion-string-functions completing-read-function -completion-annotate-function completion-at-point-functions completion-list-insert-choice-function deactivate-current-input-method-function diff --git a/doc/misc/efaq.texi b/doc/misc/efaq.texi index f80ccc080a0..18342e65b0a 100644 --- a/doc/misc/efaq.texi +++ b/doc/misc/efaq.texi @@ -4136,9 +4136,6 @@ You can get the old behavior by binding @kbd{SPC} to @lisp (define-key minibuffer-local-filename-completion-map (kbd "SPC") 'minibuffer-complete-word) - -(define-key minibuffer-local-filename-must-match-map (kbd "SPC") - 'minibuffer-complete-word) @end lisp @c ------------------------------------------------------------ diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 9e433e11c81..0c065584c45 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -13875,11 +13875,9 @@ present in this hook. @item nntp-authinfo-function @vindex nntp-authinfo-function @findex nntp-send-authinfo -@vindex nntp-authinfo-file This function will be used to send @samp{AUTHINFO} to the @acronym{NNTP} server. The default function is @code{nntp-send-authinfo}, which looks -through your @file{~/.authinfo} (or whatever you've set the -@code{nntp-authinfo-file} variable to) for applicable entries. If none +through your @file{~/.authinfo} for applicable entries. If none are found, it will prompt you for a login name and a password. The format of the @file{~/.authinfo} file is (almost) the same as the @code{ftp} @file{~/.netrc} file, which is defined in the @code{ftp} diff --git a/doc/misc/reftex.texi b/doc/misc/reftex.texi index 8ca5fcca5ba..8bde241e18f 100644 --- a/doc/misc/reftex.texi +++ b/doc/misc/reftex.texi @@ -658,9 +658,9 @@ variable @code{reftex-auto-recenter-toc}. @end table -@vindex reftex-toc-map +@vindex reftex-toc-mode-map In order to define additional commands for the @file{*toc*} buffer, the -keymap @code{reftex-toc-map} may be used. +keymap @code{reftex-toc-mode-map} may be used. @findex reftex-toc-recenter @vindex reftex-auto-recenter-toc @@ -1021,9 +1021,9 @@ document and let you select a label from there (@pxref{LaTeX xr Package,,xr}). @end table -@vindex reftex-select-label-map +@vindex reftex-select-label-mode-map In order to define additional commands for the selection process, the -keymap @code{reftex-select-label-map} may be used. +keymap @code{reftex-select-label-mode-map} may be used. @node Builtin Label Environments @section Builtin Label Environments @@ -1871,9 +1871,9 @@ entries. @end table -@vindex reftex-select-bib-map +@vindex reftex-select-bib-mode-map In order to define additional commands for this selection process, the -keymap @code{reftex-select-bib-map} may be used. +keymap @code{reftex-select-bib-mode-map} may be used. Note that if you do not use Emacs to edit the @BibTeX{} database files, @RefTeX{} will ask if the related buffers should be updated once it @@ -3960,7 +3960,7 @@ Normal hook which is run when a @file{*toc*} buffer is created. @end deffn -@deffn Keymap reftex-toc-map +@deffn Keymap reftex-toc-mode-map The keymap which is active in the @file{*toc*} buffer. (@pxref{Table of Contents}). @end deffn @@ -4425,7 +4425,7 @@ Normal hook which is run when a selection buffer enters @code{reftex-select-label-mode}. @end deffn -@deffn Keymap reftex-select-label-map +@deffn Keymap reftex-select-label-mode-map The keymap which is active in the labels selection process (@pxref{Referencing Labels}). @end deffn @@ -4586,7 +4586,7 @@ Normal hook which is run when a selection buffer enters @code{reftex-select-bib-mode}. @end deffn -@deffn Keymap reftex-select-bib-map +@deffn Keymap reftex-select-bib-mode-map The keymap which is active in the citation-key selection process (@pxref{Creating Citations}). @end deffn @@ -4792,7 +4792,7 @@ into blocks. Sorting will then preserve blocks, so that lines are re-arranged only within blocks. @end defopt -@defopt reftex-index-phrases-map +@defopt reftex-index-phrases-mode-map Keymap for the Index Phrases buffer. @end defopt @@ -4824,7 +4824,7 @@ the document. This flag can be toggled from within the @file{*Index*} buffer with the @kbd{f} key. @end defopt -@deffn Keymap reftex-index-map +@deffn Keymap reftex-index-mode-map The keymap which is active in the @file{*Index*} buffer (@pxref{Index Support}). @end deffn @@ -5813,8 +5813,8 @@ buffer). @noindent @b{Version 3.12} @itemize @bullet @item -There are 3 new keymaps for customization: @code{reftex-toc-map}, -@code{reftex-select-label-map}, @code{reftex-select-bib-map}. +There are 3 new keymaps for customization: @code{reftex-toc-mode-map}, +@code{reftex-select-label-mode-map}, @code{reftex-select-bib-mode-map}. @item Refontification uses more standard font-lock stuff. @item diff --git a/doc/misc/speedbar.texi b/doc/misc/speedbar.texi index 9991917b3fd..70d4b054166 100644 --- a/doc/misc/speedbar.texi +++ b/doc/misc/speedbar.texi @@ -896,7 +896,7 @@ augmented with speedbar. @enumerate @item -Create the keymap variable @code{@var{name}-speedbar-key-map}. +Create the keymap variable @code{@var{name}-speedbar-mode-map}. @item Create a function, named whatever you like, which assigns values into your @@ -904,7 +904,7 @@ keymap. Use this command to create the keymap before assigning bindings: @smallexample - (setq @var{name}-speedbar-key-map (speedbar-make-specialized-keymap)) + (setq @var{name}-speedbar-mode-map (speedbar-make-specialized-keymap)) @end smallexample This function creates a special keymap for use in speedbar. @@ -977,7 +977,7 @@ Next, register your extension like this; @example (speedbar-add-expansion-list '("MyExtension" MyExtension-speedbar-menu-items - MyExtension-speedbar-key-map + MyExtension-speedbar-mode-map MyExtension-speedbar-buttons)) @end example diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el index 8946e2c3f42..176f599649f 100644 --- a/lisp/progmodes/which-func.el +++ b/lisp/progmodes/which-func.el @@ -185,7 +185,8 @@ and you want to simplify them for the mode line (defvar-local which-func-mode nil "Non-nil means display current function name in mode line. -This makes a difference only if `which-function-mode' is non-nil.") +This makes a difference only if variable `which-function-mode' is +non-nil.") (add-hook 'after-change-major-mode-hook #'which-func-ff-hook t) diff --git a/lisp/textmodes/reftex-cite.el b/lisp/textmodes/reftex-cite.el index 8a54b1a301f..e1475934ddb 100644 --- a/lisp/textmodes/reftex-cite.el +++ b/lisp/textmodes/reftex-cite.el @@ -814,7 +814,7 @@ in order to only add another reference in the same cite command." (interactive) (reftex-citation nil ?t)) -(defvar reftex-select-bib-map) +(defvar reftex-select-bib-mode-map) (defvar reftex--found-list) (defun reftex-offer-bib-menu () "Offer bib menu and return list of selected items." @@ -870,7 +870,7 @@ in order to only add another reference in the same cite command." (reftex-select-item reftex-citation-prompt reftex-citation-help - reftex-select-bib-map + reftex-select-bib-mode-map nil 'reftex-bibtex-selection-callback nil)) (setq key (car rtn) diff --git a/lisp/textmodes/reftex-ref.el b/lisp/textmodes/reftex-ref.el index 9d5bc5a8f0f..a5d83c34d67 100644 --- a/lisp/textmodes/reftex-ref.el +++ b/lisp/textmodes/reftex-ref.el @@ -533,7 +533,7 @@ When called with 2 \\[universal-argument] prefix args, disable magic word recogn (cons (cdr cell) (- (match-end 0) (match-end 1))) nil))) -(defvar reftex-select-label-map) +(defvar reftex-select-label-mode-map) (defun reftex-offer-label-menu (typekey) ;; Offer a menu with the appropriate labels. (let* ((buf (current-buffer)) @@ -605,7 +605,7 @@ When called with 2 \\[universal-argument] prefix args, disable magic word recogn (reftex-select-item reftex-select-label-prompt reftex-select-label-help - reftex-select-label-map + reftex-select-label-mode-map offset 'reftex-show-label-location follow)) (setq key (car rtn) From 317eb2d5b54e6c65a3bdcf2964d2b8d2232b4a13 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Mon, 4 Oct 2021 03:26:17 +0200 Subject: [PATCH 47/51] Improve structure of TODO * etc/TODO: Various improvements to the document structure according to discussion with the maintainers. --- etc/TODO | 151 +++++++++++++++++++++++++++---------------------------- 1 file changed, 75 insertions(+), 76 deletions(-) diff --git a/etc/TODO b/etc/TODO index 1efbd8d871c..540d8a7ff54 100644 --- a/etc/TODO +++ b/etc/TODO @@ -29,95 +29,25 @@ are the ones we consider more important, but these also may be difficult to fix. Bugs with severity "minor" may be simpler, but this is not always true. -* Speed up Elisp execution - -** Speed up function calls -Change src/bytecode.c so that calls from byte-code functions to byte-code -functions don't go through Ffuncall/funcall_lambda/exec_byte_code but instead -stay within exec_byte_code. - -** Improve the byte-compiler to recognize immutable bindings -Recognize immutable (lexical) bindings and get rid of them if they're -used only once and/or they're bound to a constant expression. - -Such things aren't present in hand-written code, but macro expansion and -defsubst can often end up generating things like -(funcall (lambda (arg) (body)) actual) which then get optimized to -(let ((arg actual)) (body)) but should additionally get optimized further -when 'actual' is a constant/copyable expression. - -** Add an "indirect goto" byte-code -Such a byte-code can be used for local lambda expressions. -E.g. when you have code like - - (let ((foo (lambda (x) bar))) - (dosomething - (funcall foo toto) - (blabla (funcall foo titi)))) - -turn those 'funcalls' into jumps and their return into indirect jumps back. - -** Compile efficiently local recursive functions -Similar to the previous point, we should be able to handle something like - - (letrec ((loop () (blabla) (if (toto) (loop)))) - (loop)) - -which ideally should generate the same byte-code as - - (while (progn (blabla) (toto))) - -* Things that were planned for Emacs-24 - -** Concurrency -Including it as an "experimental" compile-time option sounds good. Of -course there might still be big questions around "which form of -concurrency" we'll want. - -** Spread Semantic - -** Improve the "code snippets" support -Consolidate skeleton.el, tempo.el, and expand.el (any other?) and then -advertise/use/improve it. - -** Improve VC -Yes, there's a lot of work to be done there :-( - -** Random things that cross my mind right now that I'd like to see -Some of them from my local hacks, but it's not obvious at all whether -they'll make it. - -*** Prog-mode could/should provide a better fill-paragraph default -That default should use syntax-tables to recognize string/comment -boundaries. - -*** Provide more completion-at-point-functions -Make existing in-buffer completion use completion-at-point. - -*** "Functional" function-key-map -It would make it easy to add (and remove) mappings like -"FOO-mouse-4 -> FOO-scroll-down", "FOO-tab -> ?\FOO-\t", -"uppercase -> lowercase", "[fringe KEY...] -> [KEY]", -"H-FOO -> M-FOO", "C-x C-y FOO -> H-FOO", ... - -* Things related to elpa.gnu.org. +* High Priority Items +** Things related to elpa.gnu.org. We need to figure out how to best include GNU ELPA packages in the Emacs tarball before doing any of the items below. -** Move idlwave to elpa.gnu.org +*** Move idlwave to elpa.gnu.org Need to sync up the Emacs and external versions. See -** Move Org mode to elpa.gnu.org +*** Move Org mode to elpa.gnu.org See -** Move verilog-mode to elpa.gnu.org +*** Move verilog-mode to elpa.gnu.org See -** Move vhdl-mode to elpa.gnu.org +*** Move vhdl-mode to elpa.gnu.org See * Simple tasks @@ -242,6 +172,44 @@ https://lists.gnu.org/r/emacs-devel/2008-08/msg00456.html * Important features +** Speed up Elisp execution + +*** Speed up function calls +Change src/bytecode.c so that calls from byte-code functions to byte-code +functions don't go through Ffuncall/funcall_lambda/exec_byte_code but instead +stay within exec_byte_code. + +*** Improve the byte-compiler to recognize immutable bindings +Recognize immutable (lexical) bindings and get rid of them if they're +used only once and/or they're bound to a constant expression. + +Such things aren't present in hand-written code, but macro expansion and +defsubst can often end up generating things like +(funcall (lambda (arg) (body)) actual) which then get optimized to +(let ((arg actual)) (body)) but should additionally get optimized further +when 'actual' is a constant/copyable expression. + +** Add an "indirect goto" byte-code +Such a byte-code can be used for local lambda expressions. +E.g. when you have code like + + (let ((foo (lambda (x) bar))) + (dosomething + (funcall foo toto) + (blabla (funcall foo titi)))) + +turn those 'funcalls' into jumps and their return into indirect jumps back. + +*** Compile efficiently local recursive functions +Similar to the previous point, we should be able to handle something like + + (letrec ((loop () (blabla) (if (toto) (loop)))) + (loop)) + +which ideally should generate the same byte-code as + + (while (progn (blabla) (toto))) + ** "Emacs as word processor" https://lists.gnu.org/r/emacs-devel/2013-11/msg00515.html rms writes: @@ -392,6 +360,11 @@ should invoke the 'shape' method. 'hbfont_shape' should be extended to pass to 'hb_shape_full' the required array of features, as mentioned in the above HarfBuzz discussion. +** Concurrency +Stefan Monnier writes: "Including it as an 'experimental' compile-time +option sounds good. Of course there might still be big questions +around 'which form of concurrency' we'll want." + ** Better support for displaying Emoji Emacs is capable of displaying Emoji and some of the Emoji sequences, provided that its fontsets are configured with a suitable font. To @@ -669,6 +642,13 @@ could also be a button that you could use to view the advice. ** Add a function to get the insertion-type of the markers in an overlay +** Improve VC +Yes, there's a lot of work to be done there :-( + +** Improve the "code snippets" support +Consolidate skeleton.el, tempo.el, and expand.el (any other?) and then +advertise/use/improve it. + ** ange-ftp *** Make ange-ftp understand sftp @@ -906,6 +886,25 @@ The idea is to add an "X" of some kind, that when clicked deletes the window associated with that modeline. https://lists.gnu.org/r/emacs-devel/2007-09/msg02416.html +** Random things that were planned for Emacs-24 + +Stefan Monnier writes: "Random things that cross my mind right now +that I'd like to see. Some of them from my local hacks, but it's not +obvious at all whether they'll make it." + +*** Prog-mode could/should provide a better fill-paragraph default +That default should use syntax-tables to recognize string/comment +boundaries. + +*** Provide more completion-at-point-functions +Make existing in-buffer completion use completion-at-point. + +*** "Functional" function-key-map +It would make it easy to add (and remove) mappings like +"FOO-mouse-4 -> FOO-scroll-down", "FOO-tab -> ?\FOO-\t", +"uppercase -> lowercase", "[fringe KEY...] -> [KEY]", +"H-FOO -> M-FOO", "C-x C-y FOO -> H-FOO", ... + * Things to be done for specific packages or features ** NeXTstep port From d00f3d4c05713254b3fec19601f6944442b956ff Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 3 Oct 2021 20:04:09 -0700 Subject: [PATCH 48/51] Port unused decls to C2x * src/conf_post.h (ATTRIBUTE_UNUSED): Remove. All uses replaced by MAYBE_UNUSED, and moved to start as needed for C2x. --- src/conf_post.h | 1 - src/process.c | 2 +- src/unexcw.c | 6 +++--- src/xterm.c | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/conf_post.h b/src/conf_post.h index 8558dc466cc..2c6fbb0dba5 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -293,7 +293,6 @@ extern int emacs_setenv_TZ (char const *); ATTRIBUTE_FORMAT ((PRINTF_ARCHETYPE, string_index, first_to_check)) #define ARG_NONNULL ATTRIBUTE_NONNULL -#define ATTRIBUTE_UNUSED MAYBE_UNUSED /* Declare NAME to be a pointer to an object of type TYPE, initialized to the address ADDR, which may be of a different type. Accesses diff --git a/src/process.c b/src/process.c index 58347a154a3..221d4c7f6c3 100644 --- a/src/process.c +++ b/src/process.c @@ -4004,7 +4004,7 @@ usage: (make-network-process &rest ARGS) */) if (!NILP (host)) { - ptrdiff_t portstringlen ATTRIBUTE_UNUSED; + MAYBE_UNUSED ptrdiff_t portstringlen; /* SERVICE can either be a string or int. Convert to a C string for later use by getaddrinfo. */ diff --git a/src/unexcw.c b/src/unexcw.c index 7a80b05963b..157e9f45607 100644 --- a/src/unexcw.c +++ b/src/unexcw.c @@ -48,7 +48,7 @@ static exe_header_t * read_exe_header (int fd, exe_header_t * exe_header_buffer) { int i; - int ret ATTRIBUTE_UNUSED; + MAYBE_UNUSED int ret; assert (fd >= 0); assert (exe_header_buffer != 0); @@ -111,7 +111,7 @@ fixup_executable (int fd) exe_header_t exe_header_buffer; exe_header_t *exe_header; int i; - int ret ATTRIBUTE_UNUSED; + MAYBE_UNUSED int ret; int found_data = 0; int found_bss = 0; @@ -269,7 +269,7 @@ unexec (const char *outfile, const char *infile) int fd_in; int fd_out; int ret; - int ret2 ATTRIBUTE_UNUSED; + MAYBE_UNUSED int ret2; infile = add_exe_suffix_if_necessary (infile, infile_buffer); outfile = add_exe_suffix_if_necessary (outfile, outfile_buffer); diff --git a/src/xterm.c b/src/xterm.c index ae3af598da6..cf1e97a8b93 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -4049,7 +4049,7 @@ x_delete_glyphs (struct frame *f, int n) /* Like XClearArea, but check that WIDTH and HEIGHT are reasonable. If they are <= 0, this is probably an error. */ -static ATTRIBUTE_UNUSED void +MAYBE_UNUSED static void x_clear_area1 (Display *dpy, Window window, int x, int y, int width, int height, int exposures) { From 595e506c829156c72206c6db95b04c54bae1d025 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Thu, 30 Sep 2021 01:49:42 +0200 Subject: [PATCH 49/51] * lisp/erc/erc.el (erc-user-mode): Set "+i" by default. --- lisp/erc/erc.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index c4077d48ab0..308812f0eb2 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -188,10 +188,12 @@ parameters and authentication." It is not strictly necessary to provide this, since ERC will prompt you for it.") -(defcustom erc-user-mode nil +(defcustom erc-user-mode "+i" + ;; +i "Invisible". Hides user from global /who and /names. "Initial user modes to be set after a connection is established." :group 'erc - :type '(choice (const nil) string function)) + :type '(choice (const nil) string function) + :version "28.1") (defcustom erc-prompt-for-password t From e1fb731393f0f47a910836915c410989c8d06a8f Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 3 Oct 2021 20:11:57 -0700 Subject: [PATCH 50/51] Tweak x_connection_closed when I/O error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * src/xterm.c (x_connection_closed): Don’t dereference dpyinfo in the unlikely case where it is null and ioerror is true. This pacifies gcc 11.2.1 -Wanalyzer-null-dereference. --- src/xterm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/xterm.c b/src/xterm.c index cf1e97a8b93..89885e0d889 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -10133,8 +10133,9 @@ x_connection_closed (Display *dpy, const char *error_message, bool ioerror) frame on it. */ dpyinfo->reference_count++; dpyinfo->terminal->reference_count++; + if (ioerror) + dpyinfo->display = 0; } - if (ioerror) dpyinfo->display = 0; /* First delete frames whose mini-buffers are on frames that are on the dead display. */ From 3b8dda6c903e8e103a26ce812fc9400b301a09ae Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 3 Oct 2021 20:30:26 -0700 Subject: [PATCH 51/51] Add safety check in x_menu_show * src/xmenu.c (x_menu_show): Explicitly check whether save_wv can be null here. Looks like it can be but I am not 100% sure, so play it safe and add a FIXME comment. --- src/xmenu.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/xmenu.c b/src/xmenu.c index a6762236bc4..709e455dd05 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -1603,6 +1603,14 @@ x_menu_show (struct frame *f, int x, int y, int menuflags, STRINGP (help) ? help : Qnil); if (prev_wv) prev_wv->next = wv; + else if (!save_wv) + { + /* This call to 'abort' pacifies gcc 11.2.1 when Emacs + is configured with --enable-gcc-warnings. FIXME: If + save_wv can be null, do something better; otherwise, + explain why save_wv cannot be null. */ + abort (); + } else save_wv->contents = wv; if (!NILP (descrip))