From 3711339f92be0c50633aefae991d8fa4a135fe33 Mon Sep 17 00:00:00 2001 From: Alan Third Date: Fri, 1 Jan 2021 10:36:39 +0000 Subject: [PATCH 01/96] Fix crash in ns_mouse_position (bug#45541) * src/nsterm.m (ns_mouse_position): Explicitly initialize f to NULL. ; Do not merge to master --- src/nsterm.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nsterm.m b/src/nsterm.m index b75c6c7ef56..b8658a05daf 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -2480,7 +2480,7 @@ so some key presses (TAB) are swallowed by the system. */ id view; NSPoint view_position; Lisp_Object frame, tail; - struct frame *f; + struct frame *f = NULL; struct ns_display_info *dpyinfo; NSTRACE ("ns_mouse_position"); From 7384ec6416cbcea12a65db058e5a65e40d3a157f Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 1 Jan 2021 13:52:37 +0200 Subject: [PATCH 02/96] Add warning comments abound binding keys in Isearch maps * lisp/isearch.el (isearch-mode-map) (minibuffer-local-isearch-map): Add comments which warn against wantonly rebinding unbound keys. --- lisp/isearch.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lisp/isearch.el b/lisp/isearch.el index ac0ebc735d5..cbe72efb801 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -655,6 +655,10 @@ This is like `describe-bindings', but displays only Isearch keys." (if isearch-success 'isearch-abort binding)))) map)) +;; Note: Before adding more key bindings to this map, please keep in +;; mind that any unbound key exits Isearch and runs the command bound +;; to it in the local or global map. So in effect every key unbound +;; in this map is implicitly bound. (defvar isearch-mode-map (let ((i 0) (map (make-keymap))) @@ -819,6 +823,10 @@ This is like `describe-bindings', but displays only Isearch keys." :image '(isearch-tool-bar-image "left-arrow"))) map)) +;; Note: Before adding more key bindings to this map, please keep in +;; mind that any unbound key exits Isearch and runs the command bound +;; to it in the local or global map. So in effect every key unbound +;; in this map is implicitly bound. (defvar minibuffer-local-isearch-map (let ((map (make-sparse-keymap))) (set-keymap-parent map minibuffer-local-map) From f0deca159d006f23da8f179cbf4ec96cbfa883df Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Fri, 1 Jan 2021 06:16:29 -0800 Subject: [PATCH 03/96] ; Auto-commit of loaddefs files. --- lisp/ldefs-boot.el | 382 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 339 insertions(+), 43 deletions(-) diff --git a/lisp/ldefs-boot.el b/lisp/ldefs-boot.el index ecba0f5f41c..7d4c7b84bfd 100644 --- a/lisp/ldefs-boot.el +++ b/lisp/ldefs-boot.el @@ -12098,13 +12098,13 @@ Set the base remapping of FACE in the current buffer to SPECS. This causes the remappings specified by `face-remap-add-relative' to apply on top of the face specification given by SPECS. -The remaining arguments, SPECS, should form a list of faces. -Each list element should be either a face name or a property list +The remaining arguments, SPECS, specify the base of the remapping. +Each one of SPECS should be either a face name or a property list of face attribute/value pairs, like in a `face' text property. -If SPECS is empty, call `face-remap-reset-base' to use the normal -definition of FACE as the base remapping; note that this is -different from SPECS containing a single value nil, which means +If SPECS is empty or a single face `eq' to FACE, call `face-remap-reset-base' +to use the normal definition of FACE as the base remapping; note that +this is different from SPECS containing a single value nil, which means not to inherit from the global definition of FACE at all. \(fn FACE &rest SPECS)" nil nil) @@ -23319,7 +23319,7 @@ Coloring: ;;;### (autoloads nil "org" "org/org.el" (0 0 0 0)) ;;; Generated autoloads from org/org.el -(push (purecopy '(org 9 4 3)) package--builtin-versions) +(push (purecopy '(org 9 4 4)) package--builtin-versions) (autoload 'org-babel-do-load-languages "org" "\ Load the languages defined in `org-babel-load-languages'. @@ -23517,10 +23517,278 @@ Call the customize function with org as argument." t nil) ;;;*** -;;;### (autoloads "actual autoloads are elsewhere" "org-agenda" "org/org-agenda.el" -;;;;;; (0 0 0 0)) +;;;### (autoloads nil "org-agenda" "org/org-agenda.el" (0 0 0 0)) ;;; Generated autoloads from org/org-agenda.el +(autoload 'org-toggle-sticky-agenda "org-agenda" "\ +Toggle `org-agenda-sticky'. + +\(fn &optional ARG)" t nil) + +(autoload 'org-agenda "org-agenda" "\ +Dispatch agenda commands to collect entries to the agenda buffer. +Prompts for a command to execute. Any prefix arg will be passed +on to the selected command. The default selections are: + +a Call `org-agenda-list' to display the agenda for current day or week. +t Call `org-todo-list' to display the global todo list. +T Call `org-todo-list' to display the global todo list, select only + entries with a specific TODO keyword (the user gets a prompt). +m Call `org-tags-view' to display headlines with tags matching + a condition (the user is prompted for the condition). +M Like `m', but select only TODO entries, no ordinary headlines. +e Export views to associated files. +s Search entries for keywords. +S Search entries for keywords, only with TODO keywords. +/ Multi occur across all agenda files and also files listed + in `org-agenda-text-search-extra-files'. +< Restrict agenda commands to buffer, subtree, or region. + Press several times to get the desired effect. +> Remove a previous restriction. +# List \"stuck\" projects. +! Configure what \"stuck\" means. +C Configure custom agenda commands. + +More commands can be added by configuring the variable +`org-agenda-custom-commands'. In particular, specific tags and TODO keyword +searches can be pre-defined in this way. + +If the current buffer is in Org mode and visiting a file, you can also +first press `<' once to indicate that the agenda should be temporarily +\(until the next use of `\\[org-agenda]') restricted to the current file. +Pressing `<' twice means to restrict to the current subtree or region +\(if active). + +\(fn &optional ARG ORG-KEYS RESTRICTION)" t nil) + +(autoload 'org-batch-agenda "org-agenda" "\ +Run an agenda command in batch mode and send the result to STDOUT. +If CMD-KEY is a string of length 1, it is used as a key in +`org-agenda-custom-commands' and triggers this command. If it is a +longer string it is used as a tags/todo match string. +Parameters are alternating variable names and values that will be bound +before running the agenda command. + +\(fn CMD-KEY &rest PARAMETERS)" nil t) + +(autoload 'org-batch-agenda-csv "org-agenda" "\ +Run an agenda command in batch mode and send the result to STDOUT. +If CMD-KEY is a string of length 1, it is used as a key in +`org-agenda-custom-commands' and triggers this command. If it is a +longer string it is used as a tags/todo match string. +Parameters are alternating variable names and values that will be bound +before running the agenda command. + +The output gives a line for each selected agenda item. Each +item is a list of comma-separated values, like this: + +category,head,type,todo,tags,date,time,extra,priority-l,priority-n + +category The category of the item +head The headline, without TODO kwd, TAGS and PRIORITY +type The type of the agenda entry, can be + todo selected in TODO match + tagsmatch selected in tags match + diary imported from diary + deadline a deadline on given date + scheduled scheduled on given date + timestamp entry has timestamp on given date + closed entry was closed on given date + upcoming-deadline warning about deadline + past-scheduled forwarded scheduled item + block entry has date block including g. date +todo The todo keyword, if any +tags All tags including inherited ones, separated by colons +date The relevant date, like 2007-2-14 +time The time, like 15:00-16:50 +extra String with extra planning info +priority-l The priority letter if any was given +priority-n The computed numerical priority +agenda-day The day in the agenda where this is listed + +\(fn CMD-KEY &rest PARAMETERS)" nil t) + +(autoload 'org-store-agenda-views "org-agenda" "\ +Store agenda views. + +\(fn &rest PARAMETERS)" t nil) + +(autoload 'org-batch-store-agenda-views "org-agenda" "\ +Run all custom agenda commands that have a file argument. + +\(fn &rest PARAMETERS)" nil t) + +(autoload 'org-agenda-list "org-agenda" "\ +Produce a daily/weekly view from all files in variable `org-agenda-files'. +The view will be for the current day or week, but from the overview buffer +you will be able to go to other days/weeks. + +With a numeric prefix argument in an interactive call, the agenda will +span ARG days. Lisp programs should instead specify SPAN to change +the number of days. SPAN defaults to `org-agenda-span'. + +START-DAY defaults to TODAY, or to the most recent match for the weekday +given in `org-agenda-start-on-weekday'. + +When WITH-HOUR is non-nil, only include scheduled and deadline +items if they have an hour specification like [h]h:mm. + +\(fn &optional ARG START-DAY SPAN WITH-HOUR)" t nil) + +(autoload 'org-search-view "org-agenda" "\ +Show all entries that contain a phrase or words or regular expressions. + +With optional prefix argument TODO-ONLY, only consider entries that are +TODO entries. The argument STRING can be used to pass a default search +string into this function. If EDIT-AT is non-nil, it means that the +user should get a chance to edit this string, with cursor at position +EDIT-AT. + +The search string can be viewed either as a phrase that should be found as +is, or it can be broken into a number of snippets, each of which must match +in a Boolean way to select an entry. The default depends on the variable +`org-agenda-search-view-always-boolean'. +Even if this is turned off (the default) you can always switch to +Boolean search dynamically by preceding the first word with \"+\" or \"-\". + +The default is a direct search of the whole phrase, where each space in +the search string can expand to an arbitrary amount of whitespace, +including newlines. + +If using a Boolean search, the search string is split on whitespace and +each snippet is searched separately, with logical AND to select an entry. +Words prefixed with a minus must *not* occur in the entry. Words without +a prefix or prefixed with a plus must occur in the entry. Matching is +case-insensitive. Words are enclosed by word delimiters (i.e. they must +match whole words, not parts of a word) if +`org-agenda-search-view-force-full-words' is set (default is nil). + +Boolean search snippets enclosed by curly braces are interpreted as +regular expressions that must or (when preceded with \"-\") must not +match in the entry. Snippets enclosed into double quotes will be taken +as a whole, to include whitespace. + +- If the search string starts with an asterisk, search only in headlines. +- If (possibly after the leading star) the search string starts with an + exclamation mark, this also means to look at TODO entries only, an effect + that can also be achieved with a prefix argument. +- If (possibly after star and exclamation mark) the search string starts + with a colon, this will mean that the (non-regexp) snippets of the + Boolean search must match as full words. + +This command searches the agenda files, and in addition the files +listed in `org-agenda-text-search-extra-files' unless a restriction lock +is active. + +\(fn &optional TODO-ONLY STRING EDIT-AT)" t nil) + +(autoload 'org-todo-list "org-agenda" "\ +Show all (not done) TODO entries from all agenda file in a single list. +The prefix arg can be used to select a specific TODO keyword and limit +the list to these. When using `\\[universal-argument]', you will be prompted +for a keyword. A numeric prefix directly selects the Nth keyword in +`org-todo-keywords-1'. + +\(fn &optional ARG)" t nil) + +(autoload 'org-tags-view "org-agenda" "\ +Show all headlines for all `org-agenda-files' matching a TAGS criterion. +The prefix arg TODO-ONLY limits the search to TODO entries. + +\(fn &optional TODO-ONLY MATCH)" t nil) + +(autoload 'org-agenda-list-stuck-projects "org-agenda" "\ +Create agenda view for projects that are stuck. +Stuck projects are project that have no next actions. For the definitions +of what a project is and how to check if it stuck, customize the variable +`org-stuck-projects'. + +\(fn &rest IGNORE)" t nil) + +(autoload 'org-diary "org-agenda" "\ +Return diary information from org files. +This function can be used in a \"sexp\" diary entry in the Emacs calendar. +It accesses org files and extracts information from those files to be +listed in the diary. The function accepts arguments specifying what +items should be listed. For a list of arguments allowed here, see the +variable `org-agenda-entry-types'. + +The call in the diary file should look like this: + + &%%(org-diary) ~/path/to/some/orgfile.org + +Use a separate line for each org file to check. Or, if you omit the file name, +all files listed in `org-agenda-files' will be checked automatically: + + &%%(org-diary) + +If you don't give any arguments (as in the example above), the default value +of `org-agenda-entry-types' is used: (:deadline :scheduled :timestamp :sexp). +So the example above may also be written as + + &%%(org-diary :deadline :timestamp :sexp :scheduled) + +The function expects the lisp variables `entry' and `date' to be provided +by the caller, because this is how the calendar works. Don't use this +function from a program - use `org-agenda-get-day-entries' instead. + +\(fn &rest ARGS)" nil nil) + +(autoload 'org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item "org-agenda" "\ +Do we have a reason to ignore this TODO entry because it has a time stamp? + +\(fn &optional END)" nil nil) + +(autoload 'org-agenda-set-restriction-lock "org-agenda" "\ +Set restriction lock for agenda to current subtree or file. +When in a restricted subtree, remove it. + +The restriction will span over the entire file if TYPE is `file', +or if type is '(4), or if the cursor is before the first headline +in the file. Otherwise, only apply the restriction to the current +subtree. + +\(fn &optional TYPE)" t nil) + +(autoload 'org-calendar-goto-agenda "org-agenda" "\ +Compute the Org agenda for the calendar date displayed at the cursor. +This is a command that has to be installed in `calendar-mode-map'." t nil) + +(autoload 'org-agenda-to-appt "org-agenda" "\ +Activate appointments found in `org-agenda-files'. + +With a `\\[universal-argument]' prefix, refresh the list of appointments. + +If FILTER is t, interactively prompt the user for a regular +expression, and filter out entries that don't match it. + +If FILTER is a string, use this string as a regular expression +for filtering entries out. + +If FILTER is a function, filter out entries against which +calling the function returns nil. This function takes one +argument: an entry from `org-agenda-get-day-entries'. + +FILTER can also be an alist with the car of each cell being +either `headline' or `category'. For example: + + \\='((headline \"IMPORTANT\") + (category \"Work\")) + +will only add headlines containing IMPORTANT or headlines +belonging to the \"Work\" category. + +ARGS are symbols indicating what kind of entries to consider. +By default `org-agenda-to-appt' will use :deadline*, :scheduled* +\(i.e., deadlines and scheduled items with a hh:mm specification) +and :timestamp entries. See the docstring of `org-diary' for +details and examples. + +If an entry has a APPT_WARNTIME property, its value will be used +to override `appt-message-warning-time'. + +\(fn &optional REFRESH FILTER &rest ARGS)" t nil) + (if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-agenda" '("org-"))) ;;;*** @@ -23549,10 +23817,48 @@ Call the customize function with org as argument." t nil) ;;;*** -;;;### (autoloads "actual autoloads are elsewhere" "org-capture" -;;;;;; "org/org-capture.el" (0 0 0 0)) +;;;### (autoloads nil "org-capture" "org/org-capture.el" (0 0 0 0)) ;;; Generated autoloads from org/org-capture.el +(autoload 'org-capture-string "org-capture" "\ +Capture STRING with the template selected by KEYS. + +\(fn STRING &optional KEYS)" t nil) + +(autoload 'org-capture "org-capture" "\ +Capture something. +\\ +This will let you select a template from `org-capture-templates', and +then file the newly captured information. The text is immediately +inserted at the target location, and an indirect buffer is shown where +you can edit it. Pressing `\\[org-capture-finalize]' brings you back to the previous +state of Emacs, so that you can continue your work. + +When called interactively with a `\\[universal-argument]' prefix argument GOTO, don't +capture anything, just go to the file/headline where the selected +template stores its notes. + +With a `\\[universal-argument] \\[universal-argument]' prefix argument, go to the last note stored. + +When called with a `C-0' (zero) prefix, insert a template at point. + +When called with a `C-1' (one) prefix, force prompting for a date when +a datetree entry is made. + +ELisp programs can set KEYS to a string associated with a template +in `org-capture-templates'. In this case, interactive selection +will be bypassed. + +If `org-capture-use-agenda-date' is non-nil, capturing from the +agenda will use the date at point as the default date. Then, a +`C-1' prefix will tell the capture process to use the HH:MM time +of the day at point (if any) or the current HH:MM time. + +\(fn &optional GOTO KEYS)" t nil) + +(autoload 'org-capture-import-remember-templates "org-capture" "\ +Set `org-capture-templates' to be similar to `org-remember-templates'." t nil) + (if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-capture" '("org-capture-"))) ;;;*** @@ -38331,19 +38637,10 @@ Zone out, completely." t nil) ;;;;;; "eshell/em-unix.el" "eshell/em-xtra.el" "facemenu.el" "faces.el" ;;;;;; "files.el" "font-core.el" "font-lock.el" "format.el" "frame.el" ;;;;;; "help.el" "hfy-cmap.el" "ibuf-ext.el" "indent.el" "international/characters.el" -;;;;;; "international/charprop.el" "international/charscript.el" -;;;;;; "international/cp51932.el" "international/eucjp-ms.el" "international/mule-cmds.el" -;;;;;; "international/mule-conf.el" "international/mule.el" "international/uni-bidi.el" -;;;;;; "international/uni-brackets.el" "international/uni-category.el" -;;;;;; "international/uni-combining.el" "international/uni-comment.el" -;;;;;; "international/uni-decimal.el" "international/uni-decomposition.el" -;;;;;; "international/uni-digit.el" "international/uni-lowercase.el" -;;;;;; "international/uni-mirrored.el" "international/uni-name.el" -;;;;;; "international/uni-numeric.el" "international/uni-old-name.el" -;;;;;; "international/uni-special-lowercase.el" "international/uni-special-titlecase.el" -;;;;;; "international/uni-special-uppercase.el" "international/uni-titlecase.el" -;;;;;; "international/uni-uppercase.el" "isearch.el" "jit-lock.el" -;;;;;; "jka-cmpr-hook.el" "language/burmese.el" "language/cham.el" +;;;;;; "international/charscript.el" "international/cp51932.el" +;;;;;; "international/eucjp-ms.el" "international/mule-cmds.el" +;;;;;; "international/mule-conf.el" "international/mule.el" "isearch.el" +;;;;;; "jit-lock.el" "jka-cmpr-hook.el" "language/burmese.el" "language/cham.el" ;;;;;; "language/chinese.el" "language/cyrillic.el" "language/czech.el" ;;;;;; "language/english.el" "language/ethiopic.el" "language/european.el" ;;;;;; "language/georgian.el" "language/greek.el" "language/hebrew.el" @@ -38376,26 +38673,25 @@ Zone out, completely." t nil) ;;;;;; "minibuffer.el" "mouse.el" "net/tramp-loaddefs.el" "newcomment.el" ;;;;;; "obarray.el" "org/ob-core.el" "org/ob-lob.el" "org/ob-matlab.el" ;;;;;; "org/ob-tangle.el" "org/ob.el" "org/ol-bbdb.el" "org/ol-irc.el" -;;;;;; "org/ol.el" "org/org-agenda.el" "org/org-archive.el" "org/org-attach.el" -;;;;;; "org/org-capture.el" "org/org-clock.el" "org/org-colview.el" -;;;;;; "org/org-compat.el" "org/org-datetree.el" "org/org-duration.el" -;;;;;; "org/org-element.el" "org/org-feed.el" "org/org-footnote.el" -;;;;;; "org/org-goto.el" "org/org-id.el" "org/org-indent.el" "org/org-install.el" -;;;;;; "org/org-keys.el" "org/org-lint.el" "org/org-list.el" "org/org-macs.el" -;;;;;; "org/org-mobile.el" "org/org-num.el" "org/org-plot.el" "org/org-refile.el" -;;;;;; "org/org-table.el" "org/org-timer.el" "org/ox-ascii.el" "org/ox-beamer.el" -;;;;;; "org/ox-html.el" "org/ox-icalendar.el" "org/ox-latex.el" -;;;;;; "org/ox-md.el" "org/ox-odt.el" "org/ox-org.el" "org/ox-publish.el" -;;;;;; "org/ox-texinfo.el" "org/ox.el" "progmodes/elisp-mode.el" -;;;;;; "progmodes/prog-mode.el" "ps-mule.el" "register.el" "replace.el" -;;;;;; "rfn-eshadow.el" "select.el" "simple.el" "startup.el" "subdirs.el" -;;;;;; "subr.el" "tab-bar.el" "textmodes/fill.el" "textmodes/page.el" -;;;;;; "textmodes/paragraphs.el" "textmodes/reftex-auc.el" "textmodes/reftex-cite.el" -;;;;;; "textmodes/reftex-dcr.el" "textmodes/reftex-global.el" "textmodes/reftex-index.el" -;;;;;; "textmodes/reftex-parse.el" "textmodes/reftex-ref.el" "textmodes/reftex-sel.el" -;;;;;; "textmodes/reftex-toc.el" "textmodes/text-mode.el" "uniquify.el" -;;;;;; "vc/ediff-hook.el" "vc/vc-hooks.el" "version.el" "widget.el" -;;;;;; "window.el") (0 0 0 0)) +;;;;;; "org/ol.el" "org/org-archive.el" "org/org-attach.el" "org/org-clock.el" +;;;;;; "org/org-colview.el" "org/org-compat.el" "org/org-datetree.el" +;;;;;; "org/org-duration.el" "org/org-element.el" "org/org-feed.el" +;;;;;; "org/org-footnote.el" "org/org-goto.el" "org/org-id.el" "org/org-indent.el" +;;;;;; "org/org-install.el" "org/org-keys.el" "org/org-lint.el" +;;;;;; "org/org-list.el" "org/org-macs.el" "org/org-mobile.el" "org/org-num.el" +;;;;;; "org/org-plot.el" "org/org-refile.el" "org/org-table.el" +;;;;;; "org/org-timer.el" "org/ox-ascii.el" "org/ox-beamer.el" "org/ox-html.el" +;;;;;; "org/ox-icalendar.el" "org/ox-latex.el" "org/ox-md.el" "org/ox-odt.el" +;;;;;; "org/ox-org.el" "org/ox-publish.el" "org/ox-texinfo.el" "org/ox.el" +;;;;;; "progmodes/elisp-mode.el" "progmodes/prog-mode.el" "ps-mule.el" +;;;;;; "register.el" "replace.el" "rfn-eshadow.el" "select.el" "simple.el" +;;;;;; "startup.el" "subdirs.el" "subr.el" "tab-bar.el" "textmodes/fill.el" +;;;;;; "textmodes/page.el" "textmodes/paragraphs.el" "textmodes/reftex-auc.el" +;;;;;; "textmodes/reftex-cite.el" "textmodes/reftex-dcr.el" "textmodes/reftex-global.el" +;;;;;; "textmodes/reftex-index.el" "textmodes/reftex-parse.el" "textmodes/reftex-ref.el" +;;;;;; "textmodes/reftex-sel.el" "textmodes/reftex-toc.el" "textmodes/text-mode.el" +;;;;;; "uniquify.el" "vc/ediff-hook.el" "vc/vc-hooks.el" "version.el" +;;;;;; "widget.el" "window.el") (0 0 0 0)) ;;;*** From ec1e1f80e6fa6a219f78969e495c0d1022bd0750 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 29 Dec 2020 02:19:03 +0100 Subject: [PATCH 04/96] Add a reference between the Strings node and Search/Replace * doc/lispref/strings.texi (Creating Strings): Mention string-replace/replace-regexp-in-string (bug#45516). (cherry picked from commit b9359d4183a1a6923122d3aa12b922ab89693354) --- doc/lispref/strings.texi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi index 0f0ce13dfe4..a033168a00d 100644 --- a/doc/lispref/strings.texi +++ b/doc/lispref/strings.texi @@ -120,7 +120,10 @@ character (i.e., an integer), @code{nil} otherwise. @cindex string creation The following functions create strings, either from scratch, or by -putting strings together, or by taking them apart. +putting strings together, or by taking them apart. (For functions that +create strings based on searching the contents of other strings (like +@code{string-replace} and @code{replace-regexp-in-string}), see +@ref{Search and Replace}.) @defun make-string count character &optional multibyte This function returns a string made up of @var{count} repetitions of From a7c2793efe503ad7ad9f2d6fc73555da3a4cdaea Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 2 Jan 2021 10:27:28 +0200 Subject: [PATCH 05/96] Fix last change * doc/lispref/strings.texi (Creating Strings): Improve wording of last change. (Bug#45516) --- doc/lispref/strings.texi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi index a033168a00d..e4981cd6030 100644 --- a/doc/lispref/strings.texi +++ b/doc/lispref/strings.texi @@ -120,9 +120,9 @@ character (i.e., an integer), @code{nil} otherwise. @cindex string creation The following functions create strings, either from scratch, or by -putting strings together, or by taking them apart. (For functions that -create strings based on searching the contents of other strings (like -@code{string-replace} and @code{replace-regexp-in-string}), see +putting strings together, or by taking them apart. (For functions +that create strings based on the modified contents of other strings, +like @code{string-replace} and @code{replace-regexp-in-string}, see @ref{Search and Replace}.) @defun make-string count character &optional multibyte From 70484f92a1807897dcd16189442a45385c6e7bbb Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 2 Jan 2021 12:42:16 +0200 Subject: [PATCH 06/96] Fix syntax of symbol and punctuation characters * lisp/international/characters.el: Adjust syntax of punctuation and symbol charcaters to follow that of Unicode properties. (Bug#44974) --- lisp/international/characters.el | 76 +++++++++++++++++++++----------- 1 file changed, 50 insertions(+), 26 deletions(-) diff --git a/lisp/international/characters.el b/lisp/international/characters.el index 64460b411a2..88f2e20dcca 100644 --- a/lisp/international/characters.el +++ b/lisp/international/characters.el @@ -317,6 +317,7 @@ with L, LRE, or LRO Unicode bidi character type.") (modify-syntax-entry #x5be ".") ; MAQAF (modify-syntax-entry #x5c0 ".") ; PASEQ (modify-syntax-entry #x5c3 ".") ; SOF PASUQ +(modify-syntax-entry #x5c6 ".") ; NUN HAFUKHA (modify-syntax-entry #x5f3 ".") ; GERESH (modify-syntax-entry #x5f4 ".") ; GERSHAYIM @@ -521,6 +522,9 @@ with L, LRE, or LRO Unicode bidi character type.") ;; syntax: ¢£¤¥¨ª¯²³´¶¸¹º.) There should be a well-defined way of ;; relating Unicode categories to Emacs syntax codes. + ;; FIXME: We should probably just use the Unicode properties to set + ;; up the syntax table. + ;; NBSP isn't semantically interchangeable with other whitespace chars, ;; so it's more like punctuation. (set-case-syntax ?  "." tbl) @@ -558,7 +562,7 @@ with L, LRE, or LRO Unicode bidi character type.") (setq c (1+ c))) ;; Latin Extended Additional - (modify-category-entry '(#x1e00 . #x1ef9) ?l) + (modify-category-entry '(#x1E00 . #x1EF9) ?l) ;; Latin Extended-C (setq c #x2C60) @@ -579,13 +583,13 @@ with L, LRE, or LRO Unicode bidi character type.") (setq c (1+ c))) ;; Greek - (modify-category-entry '(#x0370 . #x03ff) ?g) + (modify-category-entry '(#x0370 . #x03FF) ?g) ;; Armenian (setq c #x531) ;; Greek Extended - (modify-category-entry '(#x1f00 . #x1fff) ?g) + (modify-category-entry '(#x1F00 . #x1FFF) ?g) ;; cyrillic (modify-category-entry '(#x0400 . #x04FF) ?y) @@ -605,40 +609,43 @@ with L, LRE, or LRO Unicode bidi character type.") (while (<= c #x200F) (set-case-syntax c "." tbl) (setq c (1+ c))) - ;; Fixme: These aren't all right: (setq c #x2010) - (while (<= c #x2016) - (set-case-syntax c "_" tbl) - (setq c (1+ c))) - ;; Punctuation syntax for quotation marks (like `) - (while (<= c #x201f) - (set-case-syntax c "." tbl) - (setq c (1+ c))) - ;; Fixme: These aren't all right: - (while (<= c #x2027) - (set-case-syntax c "_" tbl) - (setq c (1+ c))) - (while (<= c #x206F) + ;; Fixme: What to do with characters that have Pi and Pf + ;; Unicode properties? + (while (<= c #x2017) (set-case-syntax c "." tbl) (setq c (1+ c))) + ;; Punctuation syntax for quotation marks (like `) + (while (<= c #x201F) + (set-case-syntax c "." tbl) + (setq c (1+ c))) + (while (<= c #x2027) + (set-case-syntax c "." tbl) + (setq c (1+ c))) + (setq c #x2030) + (while (<= c #x205E) + (set-case-syntax c "." tbl) + (setq c (1+ c))) + (let ((chars '(?‹ ?› ?⁄ ?⁒))) + (while chars + (modify-syntax-entry (car chars) "_") + (setq chars (cdr chars)))) - ;; Fixme: The following blocks might be better as symbol rather than - ;; punctuation. ;; Arrows (setq c #x2190) (while (<= c #x21FF) - (set-case-syntax c "." tbl) + (set-case-syntax c "_" tbl) (setq c (1+ c))) ;; Mathematical Operators (while (<= c #x22FF) - (set-case-syntax c "." tbl) + (set-case-syntax c "_" tbl) (setq c (1+ c))) ;; Miscellaneous Technical (while (<= c #x23FF) - (set-case-syntax c "." tbl) + (set-case-syntax c "_" tbl) (setq c (1+ c))) ;; Control Pictures - (while (<= c #x243F) + (while (<= c #x244F) (set-case-syntax c "_" tbl) (setq c (1+ c))) @@ -652,13 +659,13 @@ with L, LRE, or LRO Unicode bidi character type.") ;; Supplemental Mathematical Operators (setq c #x2A00) (while (<= c #x2AFF) - (set-case-syntax c "." tbl) + (set-case-syntax c "_" tbl) (setq c (1+ c))) ;; Miscellaneous Symbols and Arrows (setq c #x2B00) (while (<= c #x2BFF) - (set-case-syntax c "." tbl) + (set-case-syntax c "_" tbl) (setq c (1+ c))) ;; Coptic @@ -676,17 +683,34 @@ with L, LRE, or LRO Unicode bidi character type.") ;; Symbols for Legacy Computing (setq c #x1FB00) + (while (<= c #x1FBCA) + (set-case-syntax c "_" tbl) + (setq c (1+ c))) + ;; FIXME: Should these be digits? (while (<= c #x1FBFF) (set-case-syntax c "." tbl) (setq c (1+ c))) ;; Fullwidth Latin - (setq c #xff21) - (while (<= c #xff3a) + (setq c #xFF01) + (while (<= c #xFF0F) + (set-case-syntax c "." tbl) + (setq c (1+ c))) + (set-case-syntax #xFF04 "_" tbl) + (set-case-syntax #xFF0B "_" tbl) + (setq c #xFF21) + (while (<= c #xFF3A) (modify-category-entry c ?l) (modify-category-entry (+ c #x20) ?l) (setq c (1+ c))) + ;; Halfwidth Latin + (setq c #xFF64) + (while (<= c #xFF65) + (set-case-syntax c "." tbl) + (setq c (1+ c))) + (set-case-syntax #xFF61 "." tbl) + ;; Combining diacritics (modify-category-entry '(#x300 . #x362) ?^) ;; Combining marks From 70e6c0850eae29eeb2b9a850bcf9023e88caaa7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Sat, 2 Jan 2021 11:18:40 +0000 Subject: [PATCH 07/96] ; * lisp/progmodes/flymake.el: Bump version to 1.1.0. --- lisp/progmodes/flymake.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 5ba9460eee9..fddc13f56b1 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -4,7 +4,7 @@ ;; Author: Pavel Kobyakov ;; Maintainer: João Távora -;; Version: 1.0.9 +;; Version: 1.1.0 ;; Keywords: c languages tools ;; Package-Requires: ((emacs "26.1") (eldoc "1.1.0")) From 72b048bb9650283f40c93735a5ab50f62e0f4118 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 2 Jan 2021 13:36:54 +0200 Subject: [PATCH 08/96] Fix last change in characters.el * lisp/international/characters.el: Adjust syntax of more characters to follow that of Unicode properties. (Bug#44974) --- lisp/international/characters.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lisp/international/characters.el b/lisp/international/characters.el index 88f2e20dcca..6924e1c06db 100644 --- a/lisp/international/characters.el +++ b/lisp/international/characters.el @@ -226,6 +226,7 @@ with L, LRE, or LRO Unicode bidi character type.") ;; JISX0208 +;; Note: Some of these have their syntax updated later below. (map-charset-chars #'modify-syntax-entry 'japanese-jisx0208 "_" #x2121 #x227E) (map-charset-chars #'modify-syntax-entry 'japanese-jisx0208 "_" #x2821 #x287E) (let ((chars '(?ー ?゛ ?゜ ?ヽ ?ヾ ?ゝ ?ゞ ?〃 ?仝 ?々 ?〆 ?〇))) @@ -681,6 +682,13 @@ with L, LRE, or LRO Unicode bidi character type.") (set-case-syntax c "." tbl) (setq c (1+ c))) + ;; Ideographic punctuation + (setq c #x3001) + (while (<= c #x3003) + (set-case-syntax c "." tbl) + (setq c (1+ c))) + (set-case-syntax #x30FB "." tbl) + ;; Symbols for Legacy Computing (setq c #x1FB00) (while (<= c #x1FBCA) @@ -698,6 +706,10 @@ with L, LRE, or LRO Unicode bidi character type.") (setq c (1+ c))) (set-case-syntax #xFF04 "_" tbl) (set-case-syntax #xFF0B "_" tbl) + (set-case-syntax #xFF1A "." tbl) + (set-case-syntax #xFF1B "." tbl) + (set-case-syntax #xFF1F "." tbl) + (set-case-syntax #xFF20 "." tbl) (setq c #xFF21) (while (<= c #xFF3A) (modify-category-entry c ?l) From df605870fde7e31d2ca76fd7e69961ba94604a34 Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Sat, 2 Jan 2021 13:30:53 +0100 Subject: [PATCH 09/96] Simplify TTY allocation. The 'process-tty-name' already provides the TTY name, we don't have interrogate the TTY host. * test/src/process-tests.el (process-tests/fd-setsize-no-crash/make-serial-process): Use 'process-tty-name' instead of having the TTY host print its TTY name. Check whether TTY names are unique. (process-tests--new-pty, process-tests--with-temp-file): Remove; no longer used. --- test/src/process-tests.el | 71 +++++++-------------------------------- 1 file changed, 12 insertions(+), 59 deletions(-) diff --git a/test/src/process-tests.el b/test/src/process-tests.el index cddf955853e..e1e25068e4a 100644 --- a/test/src/process-tests.el +++ b/test/src/process-tests.el @@ -512,18 +512,6 @@ FD_SETSIZE." (delete-process (pop ,processes)) ,@body))))) -(defmacro process-tests--with-temp-file (var &rest body) - "Bind VAR to the name of a new regular file and evaluate BODY. -Afterwards, delete the file." - (declare (indent 1) (debug (symbolp body))) - (cl-check-type var symbol) - (let ((file (make-symbol "file"))) - `(let ((,file (make-temp-file "emacs-test-"))) - (unwind-protect - (let ((,var ,file)) - ,@body) - (delete-file ,file))))) - (defmacro process-tests--with-temp-directory (var &rest body) "Bind VAR to the name of a new directory and evaluate BODY. Afterwards, delete the directory." @@ -654,12 +642,6 @@ FD_SETSIZE file descriptors (Bug#24325)." "Check that Emacs doesn't crash when trying to use more than FD_SETSIZE file descriptors (Bug#24325)." (with-timeout (60 (ert-fail "Test timed out")) - (skip-unless (file-executable-p shell-file-name)) - (skip-unless (executable-find "tty")) - (skip-unless (executable-find "sleep")) - ;; `process-tests--new-pty' probably only works with GNU Bash. - (skip-unless (string-equal - (file-name-nondirectory shell-file-name) "bash")) (process-tests--with-processes processes ;; In order to use `make-serial-process', we need to create some ;; pseudoterminals. The easiest way to do that is to start a @@ -667,14 +649,22 @@ FD_SETSIZE file descriptors (Bug#24325)." ;; ensure that the terminal stays around while we connect to it. ;; Create the host processes before the dummy pipes so we have a ;; high chance of succeeding here. - (let ((tty-names ())) - (dotimes (_ 10) - (cl-destructuring-bind - (host tty-name) (process-tests--new-pty) + (let ((sleep (executable-find "sleep")) + (tty-names ())) + (skip-unless sleep) + (dotimes (i 10) + (let* ((host (make-process :name (format "tty host %d" i) + :command (list sleep "60") + :buffer nil + :coding 'utf-8-unix + :connection-type 'pty + :noquery t)) + (tty-name (process-tty-name host))) (should (processp host)) (push host processes) (should tty-name) (should (file-exists-p tty-name)) + (should-not (member tty-name tty-names)) (push tty-name tty-names))) (process-tests--fd-setsize-test (process-tests--with-processes processes @@ -717,42 +707,5 @@ Return nil if that can't be determined." (match-string-no-properties 1)))))) process-tests--EMFILE-message) -(defun process-tests--new-pty () - "Allocate a new pseudoterminal. -Return a list (PROCESS TTY-NAME)." - ;; The command below will typically only work with GNU Bash. - (should (string-equal (file-name-nondirectory shell-file-name) - "bash")) - (process-tests--with-temp-file temp-file - (should-not (file-remote-p temp-file)) - (let* ((command (list shell-file-name shell-command-switch - (format "tty > %s && sleep 60" - (shell-quote-argument - (file-name-unquote temp-file))))) - (process (make-process :name "tty host" - :command command - :buffer nil - :coding 'utf-8-unix - :connection-type 'pty - :noquery t)) - (tty-name nil) - (coding-system-for-read 'utf-8-unix) - (coding-system-for-write 'utf-8-unix)) - ;; Wait until TTY name has arrived. - (with-timeout (2 (message "Timed out waiting for TTY name")) - (while (and (process-live-p process) (not tty-name)) - (sleep-for 0.1) - (when-let ((attributes (file-attributes temp-file))) - (when (cl-plusp (file-attribute-size attributes)) - (with-temp-buffer - (insert-file-contents temp-file) - (goto-char (point-max)) - ;; `tty' has printed a trailing newline. - (skip-chars-backward "\n") - (unless (bobp) - (setq tty-name (buffer-substring-no-properties - (point-min) (point))))))))) - (list process tty-name)))) - (provide 'process-tests) ;;; process-tests.el ends here From 64f2c96cbe3ba803c4026c976c425771911e29e3 Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Sat, 2 Jan 2021 13:53:17 +0100 Subject: [PATCH 10/96] Make a process test faster. The test 'process-tests/fd-setsize-no-crash/make-process' used to call 'sleep' to ensure that enough processes are live to trigger a FD_SETSIZE overflow. However, we can just call 'cat' instead and close standard input when done. That way, we only wait as long as needed. * process-tests.el (process-tests/fd-setsize-no-crash/make-process): Invoke 'cat' instead of 'sleep'. Close standard input to exit the 'cat' processes. --- test/src/process-tests.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/src/process-tests.el b/test/src/process-tests.el index e1e25068e4a..5294bc07ce5 100644 --- a/test/src/process-tests.el +++ b/test/src/process-tests.el @@ -535,8 +535,8 @@ Afterwards, delete the directory." "Check that Emacs doesn't crash when trying to use more than FD_SETSIZE file descriptors (Bug#24325)." (with-timeout (60 (ert-fail "Test timed out")) - (let ((sleep (executable-find "sleep"))) - (skip-unless sleep) + (let ((cat (executable-find "cat"))) + (skip-unless cat) (dolist (conn-type '(pipe pty)) (ert-info ((format "Connection type `%s'" conn-type)) (process-tests--fd-setsize-test @@ -552,7 +552,7 @@ FD_SETSIZE file descriptors (Bug#24325)." ;; ignore `file-error'. (process-tests--ignore-EMFILE (make-process :name (format "test %d" i) - :command (list sleep "5") + :command (list cat) :connection-type conn-type :coding 'no-conversion :noquery t)))) @@ -560,6 +560,8 @@ FD_SETSIZE file descriptors (Bug#24325)." ;; We should have managed to start at least one process. (should processes) (dolist (process processes) + (should (process-live-p process)) + (process-send-eof process) (while (accept-process-output process)) (should (eq (process-status process) 'exit)) ;; If there's an error between fork and exec, Emacs From 4ac6148ef94fed6863c75e73ad91b565ce60cabe Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Sat, 2 Jan 2021 15:04:50 +0100 Subject: [PATCH 11/96] Avoid printing stacktraces when it probably wouldn't work anyway. * src/eval.c (signal_or_quit): Don't try to call the debugger if it's inhibited or we are about to dump or bootstrap. In those cases the debugger probably wouldn't work anyway. --- src/eval.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/eval.c b/src/eval.c index d0db902217b..706aafdf509 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1731,12 +1731,16 @@ signal_or_quit (Lisp_Object error_symbol, Lisp_Object data, bool keyboard_quit) return Qnil; } - /* If we're in batch mode, print a backtrace unconditionally to help with - debugging. Make sure to use `debug' unconditionally to not interfere with - ERT or other packages that install custom debuggers. */ + /* If we're in batch mode, print a backtrace unconditionally to help + with debugging. Make sure to use `debug' unconditionally to not + interfere with ERT or other packages that install custom + debuggers. Don't try to call the debugger while dumping or + bootstrapping, it wouldn't work anyway. */ if (!debugger_called && !NILP (error_symbol) - && (NILP (clause) || EQ (h->tag_or_ch, Qerror)) && noninteractive - && backtrace_on_error_noninteractive) + && (NILP (clause) || EQ (h->tag_or_ch, Qerror)) + && noninteractive && backtrace_on_error_noninteractive + && !will_dump_p () && !will_bootstrap_p () + && NILP (Vinhibit_debugger)) { ptrdiff_t count = SPECPDL_INDEX (); specbind (Vdebugger, Qdebug); From c7f15dfa80f5d104fa2b7faf06298a88160b59d9 Mon Sep 17 00:00:00 2001 From: Mauro Aranda Date: Sat, 2 Jan 2021 11:59:36 -0300 Subject: [PATCH 12/96] Fix Quit button in dictionary buffer * lisp/net/dictionary.el (dictionay-close): Changing the arity of the function in cc5f2803785c5dc785f09a292313cf799e8d29bb was a mistake. Restore it, but mark the argument as unused to avoid a wrong-number-of-arguments error when using the Quit button. --- lisp/net/dictionary.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/net/dictionary.el b/lisp/net/dictionary.el index 07f44ba035b..f8733429e94 100644 --- a/lisp/net/dictionary.el +++ b/lisp/net/dictionary.el @@ -516,7 +516,7 @@ The connection takes the proxy setting in customization group ;; Dealing with closing the buffer ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(defun dictionary-close () +(defun dictionary-close (&rest ignored) "Close the current dictionary buffer and its connection." (interactive) (if (eq major-mode 'dictionary-mode) From d10c96c42628c548f60f8004d44d765d0ae82517 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= Date: Sat, 2 Jan 2021 18:08:47 +0100 Subject: [PATCH 13/96] Fix backslash mistakes in doc strings in C code These were found by an instrumented version of make-docfile. * src/gnutls.c (Fgnutls_available_p): * src/keymap.c (Fkey_description): * src/xdisp.c (syms_of_xdisp): --- src/gnutls.c | 2 +- src/keymap.c | 2 +- src/xdisp.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gnutls.c b/src/gnutls.c index b995ffffa60..aa245ee5c39 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -2766,7 +2766,7 @@ GnuTLS MACs : the list will contain `macs'. GnuTLS digests : the list will contain `digests'. GnuTLS symmetric ciphers: the list will contain `ciphers'. GnuTLS AEAD ciphers : the list will contain `AEAD-ciphers'. -%DUMBFW : the list will contain `ClientHello\ Padding'. +%DUMBFW : the list will contain `ClientHello\\ Padding'. Any GnuTLS extension with ID up to 100 : the list will contain its name. */) (void) diff --git a/src/keymap.c b/src/keymap.c index f9aac6d7313..1eeea81f627 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -1968,7 +1968,7 @@ then the value includes only maps for prefixes that start with PREFIX. */) DEFUN ("key-description", Fkey_description, Skey_description, 1, 2, 0, doc: /* Return a pretty description of key-sequence KEYS. Optional arg PREFIX is the sequence of keys leading up to KEYS. -For example, [?\C-x ?l] is converted into the string \"C-x l\". +For example, [?\\C-x ?l] is converted into the string \"C-x l\". For an approximate inverse of this, see `kbd'. */) (Lisp_Object keys, Lisp_Object prefix) diff --git a/src/xdisp.c b/src/xdisp.c index 64ec0abad48..749893baad6 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -35581,7 +35581,7 @@ message displayed by its counterpart function specified by DEFVAR_BOOL ("display-raw-bytes-as-hex", display_raw_bytes_as_hex, doc: /* Non-nil means display raw bytes in hexadecimal format. -The default is to use octal format (\200) whereas hexadecimal (\x80) +The default is to use octal format (\\200) whereas hexadecimal (\\x80) may be more familiar to users. */); display_raw_bytes_as_hex = false; From 6b10ce867f2130532b82d32865b74ec270515809 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Sat, 2 Jan 2021 20:50:22 +0200 Subject: [PATCH 14/96] xref--show-pos-in-buf: Don't set other-window-scroll-buffer * lisp/progmodes/xref.el (xref--show-pos-in-buf): Don't set other-window-scroll-buffer (bug#45581). --- lisp/progmodes/xref.el | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 29e7b6849fd..d2b5acd5551 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -547,8 +547,7 @@ If SELECT is non-nil, select the target window." "Goto and display position POS of buffer BUF in a window. Honor `xref--original-window-intent', run `xref-after-jump-hook' and finally return the window." - (let* ((xref-buf (current-buffer)) - (pop-up-frames + (let* ((pop-up-frames (or (eq xref--original-window-intent 'frame) pop-up-frames)) (action @@ -566,9 +565,6 @@ and finally return the window." (with-selected-window (display-buffer buf action) (xref--goto-char pos) (run-hooks 'xref-after-jump-hook) - (let ((buf (current-buffer))) - (with-current-buffer xref-buf - (setq-local other-window-scroll-buffer buf))) (selected-window)))) (defun xref--display-buffer-in-other-window (buffer alist) From bfb4db5e4464e834224fd668a6e9c949e03393d6 Mon Sep 17 00:00:00 2001 From: Eric Abrahamsen Date: Sat, 2 Jan 2021 11:05:38 -0800 Subject: [PATCH 15/96] Reposition call to set-buffer-modified-p in sieve-upload * lisp/net/sieve.el (sieve-upload): It's meant to affect the script buffer, not sieve-buffer, so needs to be outside the call to with-current-buffer. --- lisp/net/sieve.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/net/sieve.el b/lisp/net/sieve.el index e46f4daae20..ca100267f67 100644 --- a/lisp/net/sieve.el +++ b/lisp/net/sieve.el @@ -360,8 +360,8 @@ Used to bracket operations which move point in the sieve-buffer." (if (not (sieve-manage-ok-p err)) (message "Sieve upload failed: %s" (nth 2 err)) (message "Sieve upload done. Use %s to manage scripts." - (substitute-command-keys "\\[sieve-manage]")) - (set-buffer-modified-p nil)))))) + (substitute-command-keys "\\[sieve-manage]")))) + (set-buffer-modified-p nil)))) ;;;###autoload (defun sieve-upload-and-bury (&optional name) From dde3269633550debb8b13cdc77136fe638c8e1fc Mon Sep 17 00:00:00 2001 From: Roland Winkler Date: Sat, 2 Jan 2021 13:44:23 -0600 Subject: [PATCH 16/96] bibtex-mode: Extend widget bibtex-entry-alist --- lisp/textmodes/bibtex.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el index d238b6037e7..a22cd97b309 100644 --- a/lisp/textmodes/bibtex.el +++ b/lisp/textmodes/bibtex.el @@ -312,7 +312,9 @@ If parsing fails, try to set this variable to nil." (option (choice :tag "Comment" :value nil (const nil) string)) (option (choice :tag "Init" :value nil - (const nil) string function))))))) + (const nil) string function)) + (option (choice :tag "Alternative" :value nil + (const nil) integer))))))) (define-obsolete-variable-alias 'bibtex-entry-field-alist 'bibtex-BibTeX-entry-alist "24.1") From d84cf78df8ea5d99cc5b38c49f3b7aed081170f5 Mon Sep 17 00:00:00 2001 From: Alan Third Date: Sat, 2 Jan 2021 18:19:39 +0000 Subject: [PATCH 17/96] Fix NS toolbar image release crash (bug#43973) The toolbar fails to make a proper copy of EmacsImage objects, so releasing the copy incorrectly released instance variables from the original objects. * src/nsimage.m ([EmacsImage copyWithZone:]): New function to enable correct copying of EmacsImage. --- src/nsimage.m | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/nsimage.m b/src/nsimage.m index f0014b50b9b..fa81a41a519 100644 --- a/src/nsimage.m +++ b/src/nsimage.m @@ -293,6 +293,18 @@ - (void)dealloc } +- (id)copyWithZone:(NSZone *)zone +{ + EmacsImage *copy = [super copyWithZone:zone]; + + copy->stippleMask = [stippleMask copyWithZone:zone]; + copy->bmRep = [bmRep copyWithZone:zone]; + copy->transform = [transform copyWithZone:zone]; + + return copy; +} + + /* Create image from monochrome bitmap. If both FG and BG are 0 (black), set the background to white and make it transparent. */ - (instancetype)initFromXBM: (unsigned char *)bits width: (int)w height: (int)h From f14869cd70e61b1908ec88a5e3d4bf21c7d538a0 Mon Sep 17 00:00:00 2001 From: Alan Third Date: Sat, 2 Jan 2021 22:27:53 +0000 Subject: [PATCH 18/96] Fix crash when using menus and tramp on NS ; Fixes bug#24472, bug#37557 and bug#37922. * src/nsterm.m (ns_select): Don't drain outerpool in this function. --- src/nsterm.m | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/nsterm.m b/src/nsterm.m index a4ee1476933..27310639508 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -4721,8 +4721,22 @@ in certain situations (rapid incoming events). thread_select(pselect, 0, NULL, NULL, NULL, &t, sigmask); } - [outerpool release]; - outerpool = [[NSAutoreleasePool alloc] init]; + /* FIXME: This draining of outerpool causes a crash when a buffer + running over tramp is displayed and the user tries to use the + menus. I believe some other autorelease pool's lifetime + straddles this call causing a violation of autorelease pool + nesting. There's no good reason to keep these here since the + pool will be drained some other time anyway, but removing them + leaves the menus sometimes not opening until the user moves their + mouse pointer, but that's better than a crash. + + There must be something about running external processes like + tramp that interferes with the modal menu code. + + See bugs 24472, 37557, 37922. */ + + // [outerpool release]; + // outerpool = [[NSAutoreleasePool alloc] init]; send_appdefined = YES; From 825b4ec338e82869dc656c7041ab2483b6c22479 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sat, 2 Jan 2021 23:12:10 -0500 Subject: [PATCH 19/96] * lisp/progmodes/xref.el (xref--show-defs-buffer-at-bottom): Fix missing arg --- lisp/progmodes/xref.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index d2b5acd5551..2fefc23e199 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1005,8 +1005,8 @@ local keymap that binds `RET' to `xref-quit-and-goto-xref'." '(display-buffer-in-direction . ((direction . below)))) (current-buffer)))))) -(define-obsolete-function-alias - 'xref--show-defs-buffer-at-bottom #'xref-show-definitions-buffer-at-bottom) +(define-obsolete-function-alias 'xref--show-defs-buffer-at-bottom + #'xref-show-definitions-buffer-at-bottom "28.1") (defun xref-show-definitions-completing-read (fetcher alist) "Let the user choose the target definition with completion. From ad2567fb1efced752352096f345c69f88e1ff405 Mon Sep 17 00:00:00 2001 From: Alan Third Date: Sun, 3 Jan 2021 16:15:18 +0000 Subject: [PATCH 20/96] Fix child frame restacking on NS (bug#41422) * src/nsfns.m (Fns_frame_restack): Use new restackWindow method. * src/nsterm.m ([EmacsWindow orderFront:]): ([EmacsWindow makeKeyAndOrderFront:]): (nswindow_orderedIndex_sort): ([EmacsWindow orderBack:]): ([EmacsWindow restackWindow:above:]): Override superclass methods to handle child windows the way we want. --- src/nsfns.m | 14 +++---- src/nsterm.h | 1 + src/nsterm.m | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 114 insertions(+), 7 deletions(-) diff --git a/src/nsfns.m b/src/nsfns.m index ee2daea0723..ae114f83e4d 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -1485,14 +1485,14 @@ Frames are listed from topmost (first) to bottommost (last). */) if (FRAME_NS_VIEW (f1) && FRAME_NS_VIEW (f2)) { - NSWindow *window = [FRAME_NS_VIEW (f1) window]; - NSInteger window2 = [[FRAME_NS_VIEW (f2) window] windowNumber]; - NSWindowOrderingMode flag = NILP (above) ? NSWindowBelow : NSWindowAbove; + EmacsWindow *window = (EmacsWindow *)[FRAME_NS_VIEW (f1) window]; + NSWindow *window2 = [FRAME_NS_VIEW (f2) window]; + BOOL flag = !NILP (above); - [window orderWindow: flag - relativeTo: window2]; - - return Qt; + if ([window restackWindow:window2 above:!NILP (above)]) + return Qt; + else + return Qnil; } else { diff --git a/src/nsterm.h b/src/nsterm.h index 3fb64494f76..2c9d8e85ba9 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -498,6 +498,7 @@ typedef id instancetype; NSPoint grabOffset; } +- (BOOL)restackWindow:(NSWindow *)win above:(BOOL)above; - (void)setAppearance; @end diff --git a/src/nsterm.m b/src/nsterm.m index 27310639508..2defb9e2eec 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -8693,6 +8693,112 @@ - (int) fullscreenState @implementation EmacsWindow +/* It seems the only way to reorder child frames is by removing them + from the parent and then reattaching them in the correct order. */ + +- (void)orderFront:(id)sender +{ + NSTRACE ("[EmacsWindow orderFront:]"); + + NSWindow *parent = [self parentWindow]; + if (parent) + { + [parent removeChildWindow:self]; + [parent addChildWindow:self ordered:NSWindowAbove]; + } + else + [super orderFront:sender]; +} + +- (void)makeKeyAndOrderFront:(id)sender +{ + NSTRACE ("[EmacsWindow makeKeyAndOrderFront:]"); + + if ([self parentWindow]) + { + [self orderFront:sender]; + [self makeKeyWindow]; + } + else + [super makeKeyAndOrderFront:sender]; +} + + +/* The array returned by [NSWindow parentWindow] may already be + sorted, but the documentation doesn't tell us whether or not it is, + so to be safe we'll sort it. */ +NSInteger nswindow_orderedIndex_sort (id w1, id w2, void *c) +{ + NSInteger i1 = [w1 orderedIndex]; + NSInteger i2 = [w2 orderedIndex]; + + if (i1 > i2) + return NSOrderedAscending; + if (i1 < i2) + return NSOrderedDescending; + + return NSOrderedSame; +} + +- (void)orderBack:(id)sender +{ + NSTRACE ("[EmacsWindow orderBack:]"); + + NSWindow *parent = [self parentWindow]; + if (parent) + { + NSArray *children = [[parent childWindows] + sortedArrayUsingFunction:nswindow_orderedIndex_sort + context:nil]; + [parent removeChildWindow:self]; + [parent addChildWindow:self ordered:NSWindowAbove]; + + for (NSWindow *win in children) + { + if (win != self) + { + [parent removeChildWindow:win]; + [parent addChildWindow:win ordered:NSWindowAbove]; + } + } + } + else + [super orderBack:sender]; +} + +- (BOOL)restackWindow:(NSWindow *)win above:(BOOL)above +{ + NSTRACE ("[EmacsWindow restackWindow:above:]"); + + /* If parent windows don't match we can't restack these frames + without changing the parents. */ + if ([self parentWindow] != [win parentWindow]) + return NO; + else if (![self parentWindow]) + [self orderWindow:(above ? NSWindowAbove : NSWindowBelow) + relativeTo:[win windowNumber]]; + else + { + NSInteger index; + NSWindow *parent = [self parentWindow]; + NSMutableArray *children = [[[parent childWindows] + sortedArrayUsingFunction:nswindow_orderedIndex_sort + context:nil] + mutableCopy]; + [children removeObject:self]; + index = [children indexOfObject:win]; + [children insertObject:self atIndex:(above ? index+1 : index)]; + + for (NSWindow *w in children) + { + [parent removeChildWindow:w]; + [parent addChildWindow:w ordered:NSWindowAbove]; + } + } + + return YES; +} + #ifdef NS_IMPL_COCOA - (id)accessibilityAttributeValue:(NSString *)attribute { From 585997d05adde5a3510ce1221f9e8dd60407ce30 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 3 Jan 2021 11:19:48 -0800 Subject: [PATCH 21/96] Fix broken build on AIX 7.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without this fix, the build on AIX 7.2 with xlc fails in the ‘CCLD temacs’ step with the diagnostic ‘ld: 0711-317 ERROR: Undefined symbol: BC’. This is because -lcurses does not define BC etc. * configure.ac: When building terminfo.o, define TERMINFO_DEFINES_BC if the library defines BC etc. * src/terminfo.c (UP, BC, PC): Define depending on TERMINFO_DEFINES_BC, not on TERMINFO. --- configure.ac | 12 ++++++++++++ src/terminfo.c | 6 +++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 48e96529ff2..89b0785d031 100644 --- a/configure.ac +++ b/configure.ac @@ -4366,6 +4366,18 @@ TERMCAP_OBJ=tparam.o if test $TERMINFO = yes; then AC_DEFINE(TERMINFO, 1, [Define to 1 if you use terminfo instead of termcap.]) TERMCAP_OBJ=terminfo.o + AC_CACHE_CHECK([whether $LIBS_TERMCAP library defines BC], + [emacs_cv_terminfo_defines_BC], + [OLD_LIBS=$LIBS + LIBS="$LIBS $LIBS_TERMCAP" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern char *BC;]], [[return !*BC;]])], + [emacs_cv_terminfo_defines_BC=yes], + [emacs_cv_terminfo_defines_BC=no]) + LIBS=$OLD_LIBS]) + if test "$emacs_cv_terminfo_defines_BC" = yes; then + AC_DEFINE([TERMINFO_DEFINES_BC], 1, [Define to 1 if the + terminfo library defines the variables BC, PC, and UP.]) + fi fi if test "X$LIBS_TERMCAP" = "X-lncurses"; then AC_DEFINE(USE_NCURSES, 1, [Define to 1 if you use ncurses.]) diff --git a/src/terminfo.c b/src/terminfo.c index 15aff317f15..a9c9572bbb2 100644 --- a/src/terminfo.c +++ b/src/terminfo.c @@ -23,10 +23,10 @@ along with GNU Emacs. If not, see . */ /* Define these variables that serve as global parameters to termcap, so that we do not need to conditionalize the places in Emacs - that set them. But don't do that for terminfo, as that could - cause link errors when using -fno-common. */ + that set them. But don't do that if terminfo defines them, as that + could cause link errors when using -fno-common. */ -#if !TERMINFO +#ifndef TERMINFO_DEFINES_BC char *UP, *BC, PC; #endif From 2e09efdb6877a2c189385be45d4cdceb617b6c5d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 3 Jan 2021 11:58:34 -0800 Subject: [PATCH 22/96] Revert previous patch which was installed into wrong branch. --- configure.ac | 12 ------------ src/terminfo.c | 6 +++--- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/configure.ac b/configure.ac index 89b0785d031..48e96529ff2 100644 --- a/configure.ac +++ b/configure.ac @@ -4366,18 +4366,6 @@ TERMCAP_OBJ=tparam.o if test $TERMINFO = yes; then AC_DEFINE(TERMINFO, 1, [Define to 1 if you use terminfo instead of termcap.]) TERMCAP_OBJ=terminfo.o - AC_CACHE_CHECK([whether $LIBS_TERMCAP library defines BC], - [emacs_cv_terminfo_defines_BC], - [OLD_LIBS=$LIBS - LIBS="$LIBS $LIBS_TERMCAP" - AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern char *BC;]], [[return !*BC;]])], - [emacs_cv_terminfo_defines_BC=yes], - [emacs_cv_terminfo_defines_BC=no]) - LIBS=$OLD_LIBS]) - if test "$emacs_cv_terminfo_defines_BC" = yes; then - AC_DEFINE([TERMINFO_DEFINES_BC], 1, [Define to 1 if the - terminfo library defines the variables BC, PC, and UP.]) - fi fi if test "X$LIBS_TERMCAP" = "X-lncurses"; then AC_DEFINE(USE_NCURSES, 1, [Define to 1 if you use ncurses.]) diff --git a/src/terminfo.c b/src/terminfo.c index a9c9572bbb2..15aff317f15 100644 --- a/src/terminfo.c +++ b/src/terminfo.c @@ -23,10 +23,10 @@ along with GNU Emacs. If not, see . */ /* Define these variables that serve as global parameters to termcap, so that we do not need to conditionalize the places in Emacs - that set them. But don't do that if terminfo defines them, as that - could cause link errors when using -fno-common. */ + that set them. But don't do that for terminfo, as that could + cause link errors when using -fno-common. */ -#ifndef TERMINFO_DEFINES_BC +#if !TERMINFO char *UP, *BC, PC; #endif From 632917461a7c1893a83979a3873b51d4da3b8a42 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 3 Jan 2021 11:19:48 -0800 Subject: [PATCH 23/96] Fix broken build on AIX 7.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without this fix, the build on AIX 7.2 with xlc fails in the ‘CCLD temacs’ step with the diagnostic ‘ld: 0711-317 ERROR: Undefined symbol: BC’. This is because -lcurses does not define BC etc. * configure.ac: When building terminfo.o, define TERMINFO_DEFINES_BC if the library defines BC etc. * src/terminfo.c (UP, BC, PC): Define depending on TERMINFO_DEFINES_BC, not on TERMINFO. --- configure.ac | 12 ++++++++++++ src/terminfo.c | 6 +++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index bcc0be7de03..66c660696b7 100644 --- a/configure.ac +++ b/configure.ac @@ -4393,6 +4393,18 @@ TERMCAP_OBJ=tparam.o if test $TERMINFO = yes; then AC_DEFINE(TERMINFO, 1, [Define to 1 if you use terminfo instead of termcap.]) TERMCAP_OBJ=terminfo.o + AC_CACHE_CHECK([whether $LIBS_TERMCAP library defines BC], + [emacs_cv_terminfo_defines_BC], + [OLD_LIBS=$LIBS + LIBS="$LIBS $LIBS_TERMCAP" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern char *BC;]], [[return !*BC;]])], + [emacs_cv_terminfo_defines_BC=yes], + [emacs_cv_terminfo_defines_BC=no]) + LIBS=$OLD_LIBS]) + if test "$emacs_cv_terminfo_defines_BC" = yes; then + AC_DEFINE([TERMINFO_DEFINES_BC], 1, [Define to 1 if the + terminfo library defines the variables BC, PC, and UP.]) + fi fi if test "X$LIBS_TERMCAP" = "X-lncurses"; then AC_DEFINE(USE_NCURSES, 1, [Define to 1 if you use ncurses.]) diff --git a/src/terminfo.c b/src/terminfo.c index 15aff317f15..a9c9572bbb2 100644 --- a/src/terminfo.c +++ b/src/terminfo.c @@ -23,10 +23,10 @@ along with GNU Emacs. If not, see . */ /* Define these variables that serve as global parameters to termcap, so that we do not need to conditionalize the places in Emacs - that set them. But don't do that for terminfo, as that could - cause link errors when using -fno-common. */ + that set them. But don't do that if terminfo defines them, as that + could cause link errors when using -fno-common. */ -#if !TERMINFO +#ifndef TERMINFO_DEFINES_BC char *UP, *BC, PC; #endif From 32c960bdc61e26521507f2d629ba4da8a4db842e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 3 Jan 2021 12:32:27 -0800 Subject: [PATCH 24/96] Mention -lcurses problem on AIX * etc/PROBLEMS: Describe problem with Emacs 27 and -lcurses. Do not merge to master. --- etc/PROBLEMS | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/etc/PROBLEMS b/etc/PROBLEMS index 2ab76e50bd0..7499726678e 100644 --- a/etc/PROBLEMS +++ b/etc/PROBLEMS @@ -2879,6 +2879,19 @@ A solution is to link with GCC, like this: Since the .o object files already exist, this will not recompile Emacs with GCC, but just restart by trying again to link temacs. +*** Building Emacs with -lcurses fails with undefined symbols like BC. + +The 'configure' script attempts to use several terminal libraries, +including tinfo, ncurses, and terminfo, and curses (in that order). +If it happens to choose the long-obsolete curses library, Emacs will +not link correctly. Emacs 28 is expected to work around this problem; +in the meantime you can work around it by installing tinfo, ncurses or +terminfo instead. + +This problem can happen on AIX 7.2 if you build with IBM's compiler XLC, +as AIX's ncurses library suffers from the libgcc problem mentioned above. +To work around this, configure and build with GCC. + *** Sun with acc: Link failure when using acc on a Sun. To use acc, you need additional options just before the libraries, such as From 32c6732d16385f242b1109517f25e9aefd6caa5c Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sun, 3 Jan 2021 15:43:31 -0500 Subject: [PATCH 25/96] * lisp/emacs-lisp/byte-run.el (make-obsolete): Make `when` mandatory (define-obsolete-function-alias, make-obsolete-variable) (define-obsolete-variable-alias): Adjust similarly. --- etc/NEWS | 6 ++++++ lisp/emacs-lisp/byte-run.el | 29 +++++++++-------------------- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index b294ff1d230..8003175a83a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2019,6 +2019,12 @@ ledit.el, lmenu.el, lucid.el and old-whitespace.el. 'vcursor-toggle-vcursor-map', 'w32-focus-frame', 'w32-select-font', 'wisent-lex-make-token-table'. +** The 'when' argument of `make-obsolete` and related functions is mandatory. +The use of those functions without a 'when' argument was marked +obsolete back in Emacs-23.1. The affected functions are: +make-obsolete, define-obsolete-function-alias, make-obsolete-variable, +define-obsolete-variable-alias. + * Lisp Changes in Emacs 28.1 diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index 8334c09bf9f..0f8dd5a2842 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el @@ -372,7 +372,7 @@ convention was modified." (puthash (indirect-function function) signature advertised-signature-table)) -(defun make-obsolete (obsolete-name current-name &optional when) +(defun make-obsolete (obsolete-name current-name when) "Make the byte-compiler warn that function OBSOLETE-NAME is obsolete. OBSOLETE-NAME should be a function name or macro name (a symbol). @@ -381,17 +381,14 @@ If CURRENT-NAME is a string, that is the `use instead' message \(it should end with a period, and not start with a capital). WHEN should be a string indicating when the function was first made obsolete, for example a date or a release number." - (declare (advertised-calling-convention - ;; New code should always provide the `when' argument. - (obsolete-name current-name when) "23.1")) (put obsolete-name 'byte-obsolete-info ;; The second entry used to hold the `byte-compile' handler, but ;; is not used any more nowadays. (purecopy (list current-name nil when))) obsolete-name) -(defmacro define-obsolete-function-alias (obsolete-name current-name - &optional when docstring) +(defmacro define-obsolete-function-alias ( obsolete-name current-name when + &optional docstring) "Set OBSOLETE-NAME's function definition to CURRENT-NAME and mark it obsolete. \(define-obsolete-function-alias \\='old-fun \\='new-fun \"22.1\" \"old-fun's doc.\") @@ -405,15 +402,13 @@ WHEN should be a string indicating when the function was first made obsolete, for example a date or a release number. See the docstrings of `defalias' and `make-obsolete' for more details." - (declare (doc-string 4) - (advertised-calling-convention - ;; New code should always provide the `when' argument. - (obsolete-name current-name when &optional docstring) "23.1")) + (declare (doc-string 4)) `(progn (defalias ,obsolete-name ,current-name ,docstring) (make-obsolete ,obsolete-name ,current-name ,when))) -(defun make-obsolete-variable (obsolete-name current-name &optional when access-type) +(defun make-obsolete-variable ( obsolete-name current-name when + &optional access-type) "Make the byte-compiler warn that OBSOLETE-NAME is obsolete. The warning will say that CURRENT-NAME should be used instead. If CURRENT-NAME is a string, that is the `use instead' message. @@ -421,16 +416,13 @@ WHEN should be a string indicating when the variable was first made obsolete, for example a date or a release number. ACCESS-TYPE if non-nil should specify the kind of access that will trigger obsolescence warnings; it can be either `get' or `set'." - (declare (advertised-calling-convention - ;; New code should always provide the `when' argument. - (obsolete-name current-name when &optional access-type) "23.1")) (put obsolete-name 'byte-obsolete-variable (purecopy (list current-name access-type when))) obsolete-name) -(defmacro define-obsolete-variable-alias (obsolete-name current-name - &optional when docstring) +(defmacro define-obsolete-variable-alias ( obsolete-name current-name when + &optional docstring) "Make OBSOLETE-NAME a variable alias for CURRENT-NAME and mark it obsolete. WHEN should be a string indicating when the variable was first @@ -459,10 +451,7 @@ For the benefit of Customize, if OBSOLETE-NAME has any of the following properties, they are copied to CURRENT-NAME, if it does not already have them: `saved-value', `saved-variable-comment'." - (declare (doc-string 4) - (advertised-calling-convention - ;; New code should always provide the `when' argument. - (obsolete-name current-name when &optional docstring) "23.1")) + (declare (doc-string 4)) `(progn (defvaralias ,obsolete-name ,current-name ,docstring) ;; See Bug#4706. From 1fa1354964aa3a0e5e649df6c963b6c11333a350 Mon Sep 17 00:00:00 2001 From: Phillip Lord Date: Sun, 3 Jan 2021 18:35:25 +0000 Subject: [PATCH 26/96] Remove relative paths for consistency * admin/nt/dist-build/build-zips.sh: Remove Paths --- admin/nt/dist-build/build-zips.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/admin/nt/dist-build/build-zips.sh b/admin/nt/dist-build/build-zips.sh index 809cbc65cac..4a9a7b596e7 100755 --- a/admin/nt/dist-build/build-zips.sh +++ b/admin/nt/dist-build/build-zips.sh @@ -20,7 +20,7 @@ function git_up { echo [build] Making git worktree for Emacs $VERSION - cd $HOME/emacs-build/git/emacs-$MAJOR_VERSION + cd $REPO_DIR/emacs-$MAJOR_VERSION git pull git worktree add ../$BRANCH $BRANCH @@ -54,7 +54,7 @@ function build_zip { if [ ! -f Makefile ] || (($CONFIG)) then echo [build] Configuring Emacs $ARCH - ../../../git/$BRANCH/configure \ + $REPO_DIR/$BRANCH/configure \ --without-dbus \ --host=$HOST --without-compress-install \ $CACHE \ @@ -88,7 +88,7 @@ function build_installer { ARCH=$1 cd $HOME/emacs-build/install/emacs-$VERSION echo [build] Calling makensis in `pwd` - cp ../../git/$BRANCH/admin/nt/dist-build/emacs.nsi . + cp $REPO_DIR/$BRANCH/admin/nt/dist-build/emacs.nsi . makensis -v4 \ -DARCH=$ARCH -DEMACS_VERSION=$ACTUAL_VERSION \ @@ -110,6 +110,10 @@ CONFIG=1 CFLAGS="-O2 -static" INSTALL_TARGET="install-strip" +## The location of the git repo +REPO_DIR=$HOME/emacs-build/git/ + + while getopts "36gb:hnsiV:" opt; do case $opt in 3) From d3d60ab2723fe4b3fa15f4d593319d0d08892cb0 Mon Sep 17 00:00:00 2001 From: Mark Oteiza Date: Sun, 3 Jan 2021 16:58:09 -0500 Subject: [PATCH 27/96] Remove unnecessary dependency on seq library * lisp/json.el: Remove require declaration. (json-encode-array): Just use length and /=. --- lisp/json.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lisp/json.el b/lisp/json.el index f5659d81efa..24986590cb0 100644 --- a/lisp/json.el +++ b/lisp/json.el @@ -55,7 +55,6 @@ ;;; Code: (require 'map) -(require 'seq) (require 'subr-x) ;; Parameters @@ -655,7 +654,7 @@ become JSON objects." (defun json-encode-array (array) "Return a JSON representation of ARRAY." (if (and json-encoding-pretty-print - (not (seq-empty-p array))) + (/= 0 (length array))) (concat "[" (json--with-indentation From c2e0f1982f886a9c269fed50a3fc904ca2e1655a Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sun, 3 Jan 2021 16:07:16 -0500 Subject: [PATCH 28/96] * src/buffer.c (Fset_buffer_multibyte): Remove dead code --- src/buffer.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/buffer.c b/src/buffer.c index 81f7d922fdb..0a7ff6e6752 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -2602,8 +2602,6 @@ current buffer is cleared. */) p += bytes, pos += bytes; } } - if (narrowed) - Fnarrow_to_region (make_fixnum (begv), make_fixnum (zv)); } else { @@ -2682,9 +2680,6 @@ current buffer is cleared. */) if (pt != PT) TEMP_SET_PT (pt); - if (narrowed) - Fnarrow_to_region (make_fixnum (begv), make_fixnum (zv)); - /* Do this first, so that chars_in_text asks the right question. set_intervals_multibyte needs it too. */ bset_enable_multibyte_characters (current_buffer, Qt); From 20ad0cc03b73f6576ece195bb16878415c313d45 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sun, 3 Jan 2021 17:25:06 -0500 Subject: [PATCH 29/96] * admin/last-chance.el (last-chance): Use `grep`s return value (compilation-finish-functions): Only set it buffer-locally. --- admin/last-chance.el | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/admin/last-chance.el b/admin/last-chance.el index fd5b8e9bd7a..e8021129e30 100644 --- a/admin/last-chance.el +++ b/admin/last-chance.el @@ -105,18 +105,14 @@ defaulting to the one at point." "Symbol: " obarray nil nil one nil one))))) - (let ((default-directory (or (vc-root-dir) - default-directory))) - (grep (format "%s %s" - last-chance-grep-command - symbol))) - (setf (buffer-local-value 'last-chance-symbol - (process-buffer - (car compilation-in-progress))) - symbol)) - -(add-to-list 'compilation-finish-functions - 'last-chance-cleanup) + (with-current-buffer + (let ((default-directory (or (vc-root-dir) + default-directory))) + (grep (format "%s %s" + last-chance-grep-command + symbol))) + (add-hook 'compilation-finish-functions #'last-chance-cleanup nil t) + (setq-local last-chance-symbol symbol))) (provide 'last-chance) From 5282e1378e24fc824eccdcfc4e9d3cad0ddef6c2 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sun, 3 Jan 2021 20:14:16 -0500 Subject: [PATCH 30/96] * doc/lispref/syntax.texi (Syntax Class Table): Clarify `@` --- doc/lispref/syntax.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/lispref/syntax.texi b/doc/lispref/syntax.texi index b4bd48771f0..d27053a1799 100644 --- a/doc/lispref/syntax.texi +++ b/doc/lispref/syntax.texi @@ -252,7 +252,7 @@ comment and a newline or formfeed ends one. @item Inherit standard syntax: @samp{@@} This syntax class does not specify a particular syntax. It says to -look in the standard syntax table to find the syntax of this +look in the parent syntax table to find the syntax of this character. @item Generic comment delimiters: @samp{!} From dbc16cdd1351604c7489bd021bcc0d0d6a809b79 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sun, 3 Jan 2021 20:16:40 -0500 Subject: [PATCH 31/96] * lisp/arc-mode.el (tar-grind-file-mode): Remove left over autoload --- lisp/arc-mode.el | 2 -- 1 file changed, 2 deletions(-) diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el index 52908d9fb6b..6c9ceb0b5a8 100644 --- a/lisp/arc-mode.el +++ b/lisp/arc-mode.el @@ -2237,8 +2237,6 @@ This doesn't recover lost files, it just undoes changes in the buffer itself." ;; not the GNU nor the BSD extensions. As it turns out, this is sufficient ;; for .deb packages. -(autoload 'tar-grind-file-mode "tar-mode") - (defconst archive-ar-file-header-re "\\(.\\{16\\}\\)\\([ 0-9]\\{12\\}\\)\\([ 0-9]\\{6\\}\\)\\([ 0-9]\\{6\\}\\)\\([ 0-7]\\{8\\}\\)\\([ 0-9]\\{10\\}\\)`\n") From 9c0387d786fe470de5190fe34f21b671d76c49f5 Mon Sep 17 00:00:00 2001 From: Mark Oteiza Date: Sun, 3 Jan 2021 22:07:59 -0500 Subject: [PATCH 32/96] Fix last change in json.el * lisp/json.el (json-encode-array): Include optimization for lists. --- lisp/json.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/json.el b/lisp/json.el index 24986590cb0..1f1f608eaba 100644 --- a/lisp/json.el +++ b/lisp/json.el @@ -654,7 +654,9 @@ become JSON objects." (defun json-encode-array (array) "Return a JSON representation of ARRAY." (if (and json-encoding-pretty-print - (/= 0 (length array))) + (if (listp array) + array + (> (length array) 0))) (concat "[" (json--with-indentation From 587a97bcb23bc6ea429ab790efa03f2260a9bca8 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sun, 3 Jan 2021 23:14:18 -0500 Subject: [PATCH 33/96] * lisp/calendar/appt.el (appt-activate): Set the local `write-file-functions` --- lisp/calendar/appt.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/calendar/appt.el b/lisp/calendar/appt.el index 29bcd6de2ce..281b89e088f 100644 --- a/lisp/calendar/appt.el +++ b/lisp/calendar/appt.el @@ -700,7 +700,7 @@ ARG is positive, otherwise off." (let ((appt-active appt-timer)) (setq appt-active (if arg (> (prefix-numeric-value arg) 0) (not appt-active))) - (remove-hook 'write-file-functions #'appt-update-list) + (remove-hook 'write-file-functions #'appt-update-list 'local) (or global-mode-string (setq global-mode-string '(""))) (delq 'appt-mode-string global-mode-string) (when appt-timer @@ -708,7 +708,7 @@ ARG is positive, otherwise off." (setq appt-timer nil)) (if appt-active (progn - (add-hook 'write-file-functions #'appt-update-list) + (add-hook 'write-file-functions #'appt-update-list nil t) (setq appt-timer (run-at-time t 60 #'appt-check) global-mode-string (append global-mode-string '(appt-mode-string))) From d8d223e7ef1d5ad2768662d114767f35601a0e87 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sun, 3 Jan 2021 23:15:33 -0500 Subject: [PATCH 34/96] * Makefile.in (test/%): New target --- Makefile.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile.in b/Makefile.in index f963351ba09..20683622991 100644 --- a/Makefile.in +++ b/Makefile.in @@ -969,6 +969,10 @@ else @echo "Maybe you used a release tarfile that lacks tests." endif +test/%: + $(MAKE) -C test $* + + dist: cd ${srcdir}; ./make-dist From 535a25164b5d656874b06fcc3a81f1bbd39b442a Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 4 Jan 2021 00:01:58 -0500 Subject: [PATCH 35/96] * lisp/calc/calc-yank.el (calc-edit-mode): Make it into a proper major mode Also make `calc-edit-handler` hold a function instead of an expression. (calc-original-buffer, calc-return-buffer, calc-one-window) (calc-edit-handler, calc-restore-trail, calc-allow-ret) (calc-edit-top): Give them a default value. (calc--edit-mode): New function extracted from old `calc-edit-mode`. (calc-edit-return, calc-edit-finish): Don't need to test `boundp` any more. (calc-edit-finish): Allow `calc-edit-handler` to be a function. (calc-edit, calc-alg-edit): * lisp/calc/calc-prog.el (calc-edit-user-syntax, calc-user-define-edit): * lisp/calc/calc-embed.el (calc-embedded-edit): * lisp/calc/calc-sel.el (calc-edit-selection): * lisp/calc/calc-store.el (calc-edit-variable): Use `calc--edit-mode` and make first arg into a function. * lisp/calc/calc-ext.el (calc-init-extensions): Autoload `calc--edit-mode` instead of `calc-edit-mode`. --- lisp/calc/calc-embed.el | 2 +- lisp/calc/calc-ext.el | 2 +- lisp/calc/calc-prog.el | 25 ++++++------ lisp/calc/calc-sel.el | 12 +++--- lisp/calc/calc-store.el | 8 ++-- lisp/calc/calc-yank.el | 88 ++++++++++++++++++----------------------- 6 files changed, 64 insertions(+), 73 deletions(-) diff --git a/lisp/calc/calc-embed.el b/lisp/calc/calc-embed.el index a1135726108..ea79bfa69a0 100644 --- a/lisp/calc/calc-embed.el +++ b/lisp/calc/calc-embed.el @@ -396,7 +396,7 @@ (calc-wrapper (setq str (math-showing-full-precision (math-format-nice-expr (aref info 8) (frame-width)))) - (calc-edit-mode (list 'calc-embedded-finish-edit info)) + (calc--edit-mode (lambda () (calc-embedded-finish-edit info))) (insert str "\n"))) (calc-show-edit-buffer))) diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el index 7c319c4d654..f4ddb840b50 100644 --- a/lisp/calc/calc-ext.el +++ b/lisp/calc/calc-ext.el @@ -1195,7 +1195,7 @@ calc-set-xor calc-sort calc-subvector calc-tail calc-transpose calc-unpack calc-unpack-bits calc-vector-find calc-vlength) ("calc-yank" calc-copy-as-kill calc-copy-region-as-kill -calc-copy-to-buffer calc-edit calc-edit-cancel calc-edit-mode +calc-copy-to-buffer calc-edit calc-edit-cancel calc--edit-mode calc-kill calc-kill-region calc-yank)))) (defun calc-init-prefixes () diff --git a/lisp/calc/calc-prog.el b/lisp/calc/calc-prog.el index 6ac554ed69c..3097b09b013 100644 --- a/lisp/calc/calc-prog.el +++ b/lisp/calc/calc-prog.el @@ -483,13 +483,13 @@ (interactive) (calc-wrapper (let ((lang calc-language)) - (calc-edit-mode (list 'calc-finish-user-syntax-edit (list 'quote lang)) - t - (format "Editing %s-Mode Syntax Table. " - (cond ((null lang) "Normal") - ((eq lang 'tex) "TeX") - ((eq lang 'latex) "LaTeX") - (t (capitalize (symbol-name lang)))))) + (calc--edit-mode (lambda () (calc-finish-user-syntax-edit lang)) + t + (format "Editing %s-Mode Syntax Table. " + (cond ((null lang) "Normal") + ((eq lang 'tex) "TeX") + ((eq lang 'latex) "LaTeX") + (t (capitalize (symbol-name lang)))))) (calc-write-parse-table (cdr (assq lang calc-user-parse-tables)) lang))) (calc-show-edit-buffer)) @@ -696,12 +696,13 @@ (setq cmd (symbol-function cmd))) (cond ((or (stringp cmd) (and (consp cmd) - (eq (car-safe (nth 3 cmd)) 'calc-execute-kbd-macro))) + (eq (car-safe (nth 3 cmd)) #'calc-execute-kbd-macro))) + ;; FIXME: Won't (nth 3 cmd) fail when (stringp cmd)? (let* ((mac (elt (nth 1 (nth 3 cmd)) 1)) (str (edmacro-format-keys mac t)) (kys (nth 3 (nth 3 cmd)))) - (calc-edit-mode - (list 'calc-edit-macro-finish-edit cmdname kys) + (calc--edit-mode + (lambda () (calc-edit-macro-finish-edit cmdname kys)) t (format (concat "Editing keyboard macro (%s, bound to %s).\n" "Original keys: %s \n") @@ -719,8 +720,8 @@ (if (and defn (calc-valid-formula-func func)) (let ((niceexpr (math-format-nice-expr defn (frame-width)))) (calc-wrapper - (calc-edit-mode - (list 'calc-finish-formula-edit (list 'quote func)) + (calc--edit-mode + (lambda () (calc-finish-formula-edit func)) nil (format (concat "Editing formula (%s, %s, bound to %s).\n" diff --git a/lisp/calc/calc-sel.el b/lisp/calc/calc-sel.el index e6c6337f969..2b317ac3696 100644 --- a/lisp/calc/calc-sel.el +++ b/lisp/calc/calc-sel.el @@ -675,12 +675,12 @@ (entry (calc-top num 'entry)) (expr (car entry)) (sel (or (calc-auto-selection entry) expr)) - ) ;; alg - (let ((str (math-showing-full-precision - (math-format-nice-expr sel (frame-width))))) - (calc-edit-mode (list 'calc-finish-selection-edit - num (list 'quote sel) calc-sel-reselect)) - (insert str "\n")))) + ;; alg + (str (math-showing-full-precision + (math-format-nice-expr sel (frame-width)))) + (csr calc-sel-reselect)) + (calc--edit-mode (lambda () (calc-finish-selection-edit num sel csr))) + (insert str "\n"))) (calc-show-edit-buffer)) (defvar calc-original-buffer) diff --git a/lisp/calc/calc-store.el b/lisp/calc/calc-store.el index a5e9012dec6..ee29c440fe4 100644 --- a/lisp/calc/calc-store.el +++ b/lisp/calc/calc-store.el @@ -437,10 +437,10 @@ (if (eq (car-safe value) 'special-const) (error "%s is a special constant" var)) (setq calc-last-edited-variable var) - (calc-edit-mode (list 'calc-finish-stack-edit (list 'quote var)) - t - (format-message - "Editing variable `%s'" (calc-var-name var))) + (calc--edit-mode (lambda () (calc-finish-stack-edit var)) + t + (format-message + "Editing variable `%s'" (calc-var-name var))) (and value (insert (math-format-nice-expr value (frame-width)) "\n"))))) (calc-show-edit-buffer)) diff --git a/lisp/calc/calc-yank.el b/lisp/calc/calc-yank.el index 8267340a3ec..e5f05236f3a 100644 --- a/lisp/calc/calc-yank.el +++ b/lisp/calc/calc-yank.el @@ -651,14 +651,14 @@ Interactively, reads the register using `register-read-with-preview'." (if (> n 0) (calc-top-list n) (calc-top-list 1 (- n))))))) - (calc-edit-mode (list 'calc-finish-stack-edit (or flag n)) allow-ret) + (calc--edit-mode (lambda () (calc-finish-stack-edit (or flag n))) allow-ret) (while list (insert (car list) "\n") (setq list (cdr list))))) (calc-show-edit-buffer)) (defun calc-alg-edit (str) - (calc-edit-mode '(calc-finish-stack-edit 0)) + (calc--edit-mode (lambda () (calc-finish-stack-edit 0))) (calc-show-edit-buffer) (insert str "\n") (backward-char 1) @@ -666,54 +666,47 @@ Interactively, reads the register using `register-read-with-preview'." (defvar calc-edit-mode-map (let ((map (make-sparse-keymap))) - (define-key map "\n" 'calc-edit-finish) - (define-key map "\r" 'calc-edit-return) - (define-key map "\C-c\C-c" 'calc-edit-finish) + (define-key map "\n" #'calc-edit-finish) + (define-key map "\r" #'calc-edit-return) + (define-key map "\C-c\C-c" #'calc-edit-finish) map) - "Keymap for use by the calc-edit command.") + "Keymap for use by the `calc-edit' command.") -(defvar calc-original-buffer) -(defvar calc-return-buffer) -(defvar calc-one-window) -(defvar calc-edit-handler) -(defvar calc-restore-trail) -(defvar calc-allow-ret) -(defvar calc-edit-top) +(defvar calc-original-buffer nil) +(defvar calc-return-buffer nil) +(defvar calc-one-window nil) +(defvar calc-edit-handler nil) +(defvar calc-restore-trail nil) +(defvar calc-allow-ret nil) +(defvar calc-edit-top nil) -(defun calc-edit-mode (&optional handler allow-ret title) +(put 'calc-edit-mode 'mode-class 'special) +(define-derived-mode calc-edit-mode nil "Calc Edit" "Calculator editing mode. Press RET, LFD, or C-c C-c to finish. To cancel the edit, simply kill the *Calc Edit* buffer." - (interactive) + (setq-local buffer-read-only nil) + (setq-local truncate-lines nil)) + +(defun calc--edit-mode (handler &optional allow-ret title) (unless handler (error "This command can be used only indirectly through calc-edit")) (let ((oldbuf (current-buffer)) (buf (get-buffer-create "*Calc Edit*"))) (set-buffer buf) - (kill-all-local-variables) - (use-local-map calc-edit-mode-map) - (setq buffer-read-only nil) - (setq truncate-lines nil) - (setq major-mode 'calc-edit-mode) - (setq mode-name "Calc Edit") - (run-mode-hooks 'calc-edit-mode-hook) - (make-local-variable 'calc-original-buffer) - (setq calc-original-buffer oldbuf) - (make-local-variable 'calc-return-buffer) - (setq calc-return-buffer oldbuf) - (make-local-variable 'calc-one-window) - (setq calc-one-window (and (one-window-p t) pop-up-windows)) - (make-local-variable 'calc-edit-handler) - (setq calc-edit-handler handler) - (make-local-variable 'calc-restore-trail) - (setq calc-restore-trail (get-buffer-window (calc-trail-buffer))) - (make-local-variable 'calc-allow-ret) - (setq calc-allow-ret allow-ret) + (calc-edit-mode) + (setq-local calc-original-buffer oldbuf) + (setq-local calc-return-buffer oldbuf) + (setq-local calc-one-window (and (one-window-p t) pop-up-windows)) + (setq-local calc-edit-handler handler) + (setq-local calc-restore-trail (get-buffer-window (calc-trail-buffer))) + (setq-local calc-allow-ret allow-ret) (let ((inhibit-read-only t)) (erase-buffer)) (add-hook 'kill-buffer-hook (lambda () (let ((calc-edit-handler nil)) (calc-edit-finish t)) - (message "(Canceled)")) t t) + (message "(Canceled)")) + t t) (insert (propertize (concat (or title title "Calc Edit Mode. ") @@ -721,9 +714,7 @@ To cancel the edit, simply kill the *Calc Edit* buffer." (if allow-ret "" " or RET") (format-message " to finish, `C-x k RET' to cancel.\n\n")) 'font-lock-face 'italic 'read-only t 'rear-nonsticky t 'front-sticky t)) - (make-local-variable 'calc-edit-top) - (setq calc-edit-top (point)))) -(put 'calc-edit-mode 'mode-class 'special) + (setq-local calc-edit-top (point)))) (defun calc-show-edit-buffer () (let ((buf (current-buffer))) @@ -743,24 +734,19 @@ To cancel the edit, simply kill the *Calc Edit* buffer." (defun calc-edit-return () (interactive) - (if (and (boundp 'calc-allow-ret) calc-allow-ret) + (if calc-allow-ret (newline) (calc-edit-finish))) -;; The variable calc-edit-disp-trail is local to calc-edit finish, but -;; is used by calc-finish-selection-edit and calc-finish-stack-edit. +;; The variable `calc-edit-disp-trail' is local to `calc-edit-finish', but +;; is used by `calc-finish-selection-edit' and `calc-finish-stack-edit'. (defvar calc-edit-disp-trail) (defun calc-edit-finish (&optional keep) - "Finish calc-edit mode. Parse buffer contents and push them on the stack." + "Finish `calc-edit' mode. Parse buffer contents and push them on the stack." (interactive "P") (message "Working...") - (or (and (boundp 'calc-original-buffer) - (boundp 'calc-return-buffer) - (boundp 'calc-one-window) - (boundp 'calc-edit-handler) - (boundp 'calc-restore-trail) - (eq major-mode 'calc-edit-mode)) + (or (derived-mode-p 'calc-edit-mode) (error "This command is valid only in buffers created by calc-edit")) (let ((buf (current-buffer)) (original calc-original-buffer) @@ -775,7 +761,11 @@ To cancel the edit, simply kill the *Calc Edit* buffer." (error "Original calculator buffer has been corrupted"))) (goto-char calc-edit-top) (if (buffer-modified-p) - (eval calc-edit-handler t)) + (if (functionp calc-edit-handler) + (funcall calc-edit-handler) + (message "Deprecated handler expression in calc-edit-handler: %S" + calc-edit-handler) + (eval calc-edit-handler t))) (if (and one-window (not (one-window-p t))) (delete-window)) (if (get-buffer-window return) From 0c599ee2e2c3fcebcab023cc9d52c9a6464b391c Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 4 Jan 2021 00:21:02 -0500 Subject: [PATCH 36/96] * lisp/erc/erc.el: Use `run-hook-with-args` for `erc-pre-send-functions` (erc-process-input-line): A function can be `listp`. (erc-send-input): Use `run-hook-with-args` for `erc-pre-send-functions`. (erc-display-command): Comment out, unused. --- lisp/erc/erc.el | 85 ++++++++++++++++++++++++------------------------- 1 file changed, 42 insertions(+), 43 deletions(-) diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 1044acff8d5..66f88280984 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -1046,8 +1046,8 @@ anyway." (make-obsolete-variable 'erc-send-pre-hook 'erc-pre-send-functions "27.1") (defcustom erc-pre-send-functions nil - "List of functions called to possibly alter the string that is sent. -The functions are called with one argument, a `erc-input' struct, + "Special hook run to possibly alter the string that is sent. +The functions are called with one argument, an `erc-input' struct, and should alter that struct. The struct has three slots: @@ -1056,7 +1056,7 @@ The struct has three slots: `insertp': Whether the string should be inserted into the erc buffer. `sendp': Whether the string should be sent to the irc server." :group 'erc - :type '(repeat function) + :type 'hook :version "27.1") (defvar erc-insert-this t @@ -1295,9 +1295,9 @@ Example: (define-erc-module replace nil \"This mode replaces incoming text according to `erc-replace-alist'.\" ((add-hook \\='erc-insert-modify-hook - \\='erc-replace-insert)) + #\\='erc-replace-insert)) ((remove-hook \\='erc-insert-modify-hook - \\='erc-replace-insert)))" + #\\='erc-replace-insert)))" (declare (doc-string 3)) (let* ((sn (symbol-name name)) (mode (intern (format "erc-%s-mode" (downcase sn)))) @@ -1495,7 +1495,7 @@ Defaults to the server buffer." (setq-local paragraph-start (concat "\\(" (regexp-quote (erc-prompt)) "\\)")) (setq-local completion-ignore-case t) - (add-hook 'completion-at-point-functions 'erc-complete-word-at-point nil t)) + (add-hook 'completion-at-point-functions #'erc-complete-word-at-point nil t)) ;; activation @@ -2585,7 +2585,7 @@ This function adds `erc-lurker-update-status' to most recent PRIVMSG as well as initializing the state variable storing this information." (setq erc-lurker-state (make-hash-table :test 'equal)) - (add-hook 'erc-insert-pre-hook 'erc-lurker-update-status)) + (add-hook 'erc-insert-pre-hook #'erc-lurker-update-status)) (defun erc-lurker-cleanup () "Remove all last PRIVMSG state older than `erc-lurker-threshold-time'. @@ -2694,7 +2694,7 @@ otherwise `erc-server-announced-name'. SERVER is matched against (defun erc-add-targets (scope target-list) (let ((targets (mapcar (lambda (targets) (member scope targets)) target-list))) - (cdr (apply 'append (delete nil targets))))) + (cdr (apply #'append (delete nil targets))))) (defun erc-hide-current-message-p (parsed) "Predicate indicating whether the parsed ERC response PARSED should be hidden. @@ -2821,9 +2821,9 @@ this function from interpreting the line as a command." (let* ((cmd (nth 0 command-list)) (args (nth 1 command-list))) (condition-case nil - (if (listp args) - (apply cmd args) - (funcall cmd args)) + (if (functionp args) + (funcall cmd args) + (apply cmd args)) (wrong-number-of-arguments (erc-display-message nil 'error (current-buffer) 'incorrect-args ?c (erc-command-name cmd) @@ -3038,7 +3038,7 @@ If no USER argument is specified, list the contents of `erc-ignore-list'." (erc-display-message nil 'notice (current-buffer) 'ops ?i (length ops) ?s (if (> (length ops) 1) "s" "") - ?o (mapconcat 'identity ops " ")) + ?o (mapconcat #'identity ops " ")) (erc-display-message nil 'notice (current-buffer) 'ops-none))) t) @@ -3209,7 +3209,7 @@ command." (defun erc-cmd-KICK (target &optional reason-or-nick &rest reasonwords) "Kick the user indicated in LINE from the current channel. LINE has the format: \"#CHANNEL NICK REASON\" or \"NICK REASON\"." - (let ((reasonstring (mapconcat 'identity reasonwords " "))) + (let ((reasonstring (mapconcat #'identity reasonwords " "))) (if (string= "" reasonstring) (setq reasonstring (format "Kicked by %s" (erc-current-nick)))) (if (erc-channel-p target) @@ -3744,7 +3744,7 @@ the message given by REASON." " -" (make-string (length people) ?o) " " - (mapconcat 'identity people " "))) + (mapconcat #'identity people " "))) t)) (defun erc-cmd-OP (&rest people) @@ -3754,7 +3754,7 @@ the message given by REASON." " +" (make-string (length people) ?o) " " - (mapconcat 'identity people " "))) + (mapconcat #'identity people " "))) t)) (defun erc-cmd-TIME (&optional line) @@ -3952,7 +3952,7 @@ Unban all currently banned users in the current channel." (erc-server-send (format "MODE %s -%s %s" (erc-default-target) (make-string (length x) ?b) - (mapconcat 'identity x " ")))) + (mapconcat #'identity x " ")))) (erc-group-list bans 3)))) t)))) @@ -4183,7 +4183,7 @@ Displays PROC and PARSED appropriately using `erc-display-message'." (erc-display-message parsed 'notice proc (mapconcat - 'identity + #'identity (let (res) (mapc #'(lambda (x) (if (stringp x) @@ -5553,12 +5553,10 @@ This returns non-nil only if we actually send anything." ;; Instead `erc-pre-send-functions' is used as a filter to do ;; allow both changing and suppressing the string. (run-hook-with-args 'erc-send-pre-hook input) - (setq state (make-erc-input :string str + (setq state (make-erc-input :string str ;May be != from `input' now! :insertp erc-insert-this :sendp erc-send-this)) - (dolist (func erc-pre-send-functions) - ;; The functions can return nil to inhibit sending. - (funcall func state)) + (run-hook-with-args 'erc-pre-send-functions state) (when (and (erc-input-sendp state) erc-send-this) (let ((string (erc-input-string state))) @@ -5579,26 +5577,26 @@ This returns non-nil only if we actually send anything." (erc-process-input-line (concat string "\n") t nil)) t)))))) -(defun erc-display-command (line) - (when erc-insert-this - (let ((insert-position (point))) - (unless erc-hide-prompt - (erc-display-prompt nil nil (erc-command-indicator) - (and (erc-command-indicator) - 'erc-command-indicator-face))) - (let ((beg (point))) - (insert line) - (erc-put-text-property beg (point) - 'font-lock-face 'erc-command-indicator-face) - (insert "\n")) - (when (processp erc-server-process) - (set-marker (process-mark erc-server-process) (point))) - (set-marker erc-insert-marker (point)) - (save-excursion - (save-restriction - (narrow-to-region insert-position (point)) - (run-hooks 'erc-send-modify-hook) - (run-hooks 'erc-send-post-hook)))))) +;; (defun erc-display-command (line) +;; (when erc-insert-this +;; (let ((insert-position (point))) +;; (unless erc-hide-prompt +;; (erc-display-prompt nil nil (erc-command-indicator) +;; (and (erc-command-indicator) +;; 'erc-command-indicator-face))) +;; (let ((beg (point))) +;; (insert line) +;; (erc-put-text-property beg (point) +;; 'font-lock-face 'erc-command-indicator-face) +;; (insert "\n")) +;; (when (processp erc-server-process) +;; (set-marker (process-mark erc-server-process) (point))) +;; (set-marker erc-insert-marker (point)) +;; (save-excursion +;; (save-restriction +;; (narrow-to-region insert-position (point)) +;; (run-hooks 'erc-send-modify-hook) +;; (run-hooks 'erc-send-post-hook)))))) (defun erc-display-msg (line) "Display LINE as a message of the user to the current target at the @@ -6563,7 +6561,7 @@ If optional argument HERE is non-nil, insert version number at point." If optional argument HERE is non-nil, insert version number at point." (interactive "P") (let ((string - (mapconcat 'identity + (mapconcat #'identity (let (modes (case-fold-search nil)) (dolist (var (apropos-internal "^erc-.*mode$")) (when (and (boundp var) @@ -6817,7 +6815,8 @@ See also `format-spec'." ;;; Various hook functions -(add-hook 'kill-buffer-hook 'erc-kill-buffer-function) +;; FIXME: Don't set the hook globally! +(add-hook 'kill-buffer-hook #'erc-kill-buffer-function) (defcustom erc-kill-server-hook '(erc-kill-server) "Invoked whenever a server buffer is killed via `kill-buffer'." From b2f8c9f96fbda53387b9f910d3b97aefefab6cab Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 4 Jan 2021 00:59:56 -0500 Subject: [PATCH 37/96] * src/xdisp.c (syms_of_xdisp): New var redisplay-skip-fontification-on-input (handle_fontified_prop): Use it. * src/keyboard.h (input_was_pending): Declare. * src/keyboard.c (input_was_pending): Make non-static. --- etc/NEWS | 6 ++++++ src/keyboard.c | 2 +- src/keyboard.h | 2 +- src/xdisp.c | 14 ++++++++++++++ 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 8003175a83a..d8f25ab362e 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -212,6 +212,12 @@ This makes debugging Emacs Lisp scripts run in batch mode easier. To get back the old behavior, set the new variable 'backtrace-on-error-noninteractive' to a nil value. +** 'redisplay-skip-fontification-on-input' helps Emacs keep up with fast input. +This is another attempt to solve the problem of handling high key repeat rate +and other "slow scrolling" situations. It is hoped it behaves better +than 'fast-but-imprecise-scrolling' and 'jit-lock-defer-time'. +It is not enabled by default. + * Editing Changes in Emacs 28.1 diff --git a/src/keyboard.c b/src/keyboard.c index d2f0cb405f0..cf15cd73572 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -285,7 +285,7 @@ bool input_pending; with the input rate, but if it can keep up just enough that there's no input_pending when we begin the command, then redisplay is not skipped which results in better feedback to the user. */ -static bool input_was_pending; +bool input_was_pending; /* Circular buffer for pre-read keyboard input. */ diff --git a/src/keyboard.h b/src/keyboard.h index 91c6f4604f9..8bdffaa2bff 100644 --- a/src/keyboard.h +++ b/src/keyboard.h @@ -432,7 +432,7 @@ extern int parse_solitary_modifier (Lisp_Object symbol); extern Lisp_Object real_this_command; extern int quit_char; - +extern bool input_was_pending; extern unsigned int timers_run; extern bool menu_separator_name_p (const char *); diff --git a/src/xdisp.c b/src/xdisp.c index 749893baad6..43447e2bf7e 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -4262,6 +4262,7 @@ handle_fontified_prop (struct it *it) if (!STRINGP (it->string) && it->s == NULL && !NILP (Vfontification_functions) + && !(input_was_pending && redisplay_skip_fontification_on_input) && !NILP (Vrun_hooks) && (pos = make_fixnum (IT_CHARPOS (*it)), prop = Fget_char_property (pos, Qfontified, Qnil), @@ -35598,6 +35599,19 @@ best except in special circumstances such as running redisplay tests in batch mode. */); redisplay_skip_initial_frame = true; + DEFVAR_BOOL ("redisplay-skip-fontification-on-input", + redisplay_skip_fontification_on_input, + doc: /* Skip `fontification_functions` when there is input pending. +If non-nil and there was input pending at the beginning of the command, +the `fontification_functions` hook is not run. This usually does not +affect the display because redisplay is completely skipped anyway if input +was pending, but it can make scrolling smoother by avoiding +unnecessary fontification. +It is similar to `fast-but-imprecise-scrolling' with similar tradeoffs, +but with the advantage that it should only affect the behavior when Emacs +has trouble keeping up with the incoming input rate. */); + redisplay_skip_fontification_on_input = false; + DEFVAR_BOOL ("redisplay-adhoc-scroll-in-resize-mini-windows", redisplay_adhoc_scroll_in_resize_mini_windows, doc: /* If nil always use normal scrolling in minibuffer windows. From 90951f847c04d288121d5cb3b2e03639f060125c Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 4 Jan 2021 01:00:33 -0500 Subject: [PATCH 38/96] * src/print.c (print_vectorlike): Use `HASH_TABLE_SIZE` --- src/lisp.h | 4 ++-- src/print.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lisp.h b/src/lisp.h index 0ad788cff84..5cc735be86c 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -1478,8 +1478,8 @@ struct Lisp_String { struct { - ptrdiff_t size; - ptrdiff_t size_byte; + ptrdiff_t size; /* MSB is used as the markbit. */ + ptrdiff_t size_byte; /* Set to -1 for unibyte strings. */ INTERVAL intervals; /* Text properties in this string. */ unsigned char *data; } s; diff --git a/src/print.c b/src/print.c index 94a8bcbf882..14af9195475 100644 --- a/src/print.c +++ b/src/print.c @@ -1557,7 +1557,8 @@ print_vectorlike (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag, /* Implement a readable output, e.g.: #s(hash-table size 2 test equal data (k1 v1 k2 v2)) */ /* Always print the size. */ - int len = sprintf (buf, "#s(hash-table size %"pD"d", ASIZE (h->next)); + int len = sprintf (buf, "#s(hash-table size %"pD"d", + HASH_TABLE_SIZE (h)); strout (buf, len, len, printcharfun); if (!NILP (h->test.name)) From b2f81b7bab92109af02ec5fc2d2b721c70b97f40 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Mon, 4 Jan 2021 10:42:13 +0100 Subject: [PATCH 39/96] Fix computation of Lines in nnmaildir * lisp/gnus/nnmaildir.el (nnmaildir--update-nov): Lines is -1 if it's not present; not 0 (probably) (bug#45650). --- lisp/gnus/nnmaildir.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/gnus/nnmaildir.el b/lisp/gnus/nnmaildir.el index 68c31dc4510..e4fd976742c 100644 --- a/lisp/gnus/nnmaildir.el +++ b/lisp/gnus/nnmaildir.el @@ -494,7 +494,7 @@ This variable is set by `nnmaildir-request-article'.") (delete-char 1) (setq nov (nnheader-parse-head t) field (or (mail-header-lines nov) 0))) - (unless (or (zerop field) (nnmaildir--param pgname 'distrust-Lines:)) + (unless (or (<= field 0) (nnmaildir--param pgname 'distrust-Lines:)) (setq nov-mid field)) (setq nov-mid (number-to-string nov-mid) nov-mid (concat (number-to-string attr) "\t" nov-mid)) From 65f21729e60f831026ce134b87561c5119b6a926 Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Mon, 4 Jan 2021 10:48:08 +0100 Subject: [PATCH 40/96] Fix off-by-one error in mode-line-compact code * src/xdisp.c (display_mode_line): Fix off-by-one error that would chop off the final non-space character when compacting (bug#45646). --- src/xdisp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xdisp.c b/src/xdisp.c index 43447e2bf7e..6a4304d194b 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -25504,7 +25504,7 @@ display_mode_line (struct window *w, enum face_id face_id, Lisp_Object format) if (start < i) display_string (NULL, Fsubstring (mode_string, make_fixnum (start), - make_fixnum (i - 1)), + make_fixnum (i)), Qnil, 0, 0, &it, 0, 0, 0, STRING_MULTIBYTE (mode_string)); } From 4e80eb7b7ce76e02fa0b2b0fa66223f29e3f6bcd Mon Sep 17 00:00:00 2001 From: Mauro Aranda Date: Mon, 4 Jan 2021 10:02:20 -0300 Subject: [PATCH 41/96] Don't skip widgets when moving backward * lisp/wid-edit.el (widget-move): Remove code that caused widget-backward to skip an immediate previous widget when moving backward from the start of a widget. (Bug#45623) * test/lisp/wid-edit-tests.el (widget-test-widget-backward): New test. --- lisp/wid-edit.el | 1 - test/lisp/wid-edit-tests.el | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index f920130226e..8b10d71dcb3 100644 --- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el @@ -1204,7 +1204,6 @@ This is much faster.") ARG may be negative to move backward. When the second optional argument is non-nil, nothing is shown in the echo area." - (or (bobp) (> arg 0) (backward-char)) (let ((wrapped 0) (number arg) (old (widget-tabable-at))) diff --git a/test/lisp/wid-edit-tests.el b/test/lisp/wid-edit-tests.el index 35235c65665..17fdfefce84 100644 --- a/test/lisp/wid-edit-tests.el +++ b/test/lisp/wid-edit-tests.el @@ -301,4 +301,25 @@ return nil, even with a non-nil bubblep argument." (should child) (should (equal (widget-value widget) '((1 "One"))))))) +(ert-deftest widget-test-widget-move () + "Test moving with `widget-forward' and `widget-backward'." + (with-temp-buffer + (dolist (el '("First" "Second" "Third")) + (widget-create 'push-button el)) + (widget-insert "\n") + (use-local-map widget-keymap) + (widget-setup) + (goto-char (point-min)) + ;; Check that moving from the widget's start works. + (widget-forward 2) + (should (string= "Third" (widget-value (widget-at)))) + (widget-backward 1) + (should (string= "Second" (widget-value (widget-at)))) + ;; Check that moving from inside the widget works. + (goto-char (point-min)) + (widget-forward 2) + (forward-char) + (widget-backward 1) + (should (string= "Second" (widget-value (widget-at)))))) + ;;; wid-edit-tests.el ends here From 56556b5f4d73d9c3683fa7573e6bd89f2ef37902 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Mon, 4 Jan 2021 13:09:40 +0000 Subject: [PATCH 42/96] Fix build for --enable-checking=structs The last change to lisp.h only added comments in Lisp_String, so the portable dumper need not be changed. * src/pdumper.c (dump_string): Update hash for Lisp_String. --- src/pdumper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pdumper.c b/src/pdumper.c index 6956ee36829..116cc28dbba 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -2058,7 +2058,7 @@ dump_interval_tree (struct dump_context *ctx, static dump_off dump_string (struct dump_context *ctx, const struct Lisp_String *string) { -#if CHECK_STRUCTS && !defined (HASH_Lisp_String_86FEA6EC7C) +#if CHECK_STRUCTS && !defined (HASH_Lisp_String_348C2B2FDB) # error "Lisp_String changed. See CHECK_STRUCTS comment in config.h." #endif /* If we have text properties, write them _after_ the string so that From 99cc0045ebd45ade32c0b42fe807d87a52458542 Mon Sep 17 00:00:00 2001 From: Mauro Aranda Date: Mon, 4 Jan 2021 09:58:10 -0300 Subject: [PATCH 43/96] Update two user option names in the Widget manual * doc/misc/widget.texi (Basic Types): The user options widget-glyph-directory and widget-glyph-enable were renamed long ago to widget-image-directory and widget-image-enable, but the manual kept calling them by their old names. Update the names. --- doc/misc/widget.texi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/misc/widget.texi b/doc/misc/widget.texi index 6f0b63e5bf4..64cbf8d950a 100644 --- a/doc/misc/widget.texi +++ b/doc/misc/widget.texi @@ -692,14 +692,14 @@ arguments, which will be used when creating the @code{radio-button} or @end table -@deffn {User Option} widget-glyph-directory -Directory where glyphs are found. +@deffn {User Option} widget-image-directory +Directory where Widget should look for images. Widget will look here for a file with the same name as specified for the image, with either a @file{.xpm} (if supported) or @file{.xbm} extension. @end deffn -@deffn{User Option} widget-glyph-enable -If non-@code{nil}, allow glyphs to appear on displays where they are supported. +@deffn{User Option} widget-image-enable +If non-@code{nil}, allow images to appear on displays where they are supported. @end deffn From f5a1315f1ea035f30d1161e4af200acafdfebe01 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Mon, 4 Jan 2021 16:32:32 +0100 Subject: [PATCH 44/96] Fix error in tramp-sh-handle-insert-directory * lisp/net/tramp-sh.el (tramp-sh-handle-insert-directory): Let buffer be unibyte when applying numbers returned with the ls --dired option. Reported by Justus Piater . * test/lisp/net/tramp-tests.el (tramp--test-check-files): Extend test. --- lisp/net/tramp-sh.el | 9 +++++++-- test/lisp/net/tramp-tests.el | 16 +++++++++++++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 865ea4e92a4..b43b4485fec 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -2672,7 +2672,8 @@ The method used must be an out-of-band method." (tramp-get-remote-null-device v)))) (save-restriction - (let ((beg (point))) + (let ((beg (point)) + (emc enable-multibyte-characters)) (narrow-to-region (point) (point)) ;; We cannot use `insert-buffer-substring' because the Tramp ;; buffer changes its contents before insertion due to calling @@ -2681,7 +2682,9 @@ The method used must be an out-of-band method." (with-current-buffer (tramp-get-buffer v) (buffer-string))) - ;; Check for "--dired" output. + ;; Check for "--dired" output. We must enable unibyte + ;; strings, because the "--dired" output counts in bytes. + (set-buffer-multibyte nil) (forward-line -2) (when (looking-at-p "//SUBDIRED//") (forward-line -1)) @@ -2701,6 +2704,8 @@ The method used must be an out-of-band method." (while (looking-at "//") (forward-line 1) (delete-region (match-beginning 0) (point))) + ;; Reset multibyte if needed. + (set-buffer-multibyte emc) ;; Some busyboxes are reluctant to discard colors. (unless diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 896b9978e7c..819d69b600e 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -5787,7 +5787,8 @@ This requires restrictions of file name syntax." (tmp-name2 (tramp--test-make-temp-name 'local quoted)) (files (delq nil files)) (process-environment process-environment) - (sorted-files (sort (copy-sequence files) #'string-lessp))) + (sorted-files (sort (copy-sequence files) #'string-lessp)) + buffer) (unwind-protect (progn (make-directory tmp-name1) @@ -5849,6 +5850,18 @@ This requires restrictions of file name syntax." tmp-name2 nil directory-files-no-dot-files-regexp)) sorted-files)) + ;; Check, that `insert-directory' works properly. + (with-current-buffer + (setq buffer (dired-noselect tmp-name1 "--dired -al")) + (goto-char (point-min)) + (while (not (eobp)) + (when-let ((name (dired-get-filename 'localp 'no-error))) + (unless + (string-match-p name directory-files-no-dot-files-regexp) + (should (member name files)))) + (forward-line 1))) + (kill-buffer buffer) + ;; `substitute-in-file-name' could return different ;; values. For `adb', there could be strange file ;; permissions preventing overwriting a file. We don't @@ -5944,6 +5957,7 @@ This requires restrictions of file name syntax." (regexp-quote (getenv envvar)))))))))) ;; Cleanup. + (ignore-errors (kill-buffer buffer)) (ignore-errors (delete-directory tmp-name1 'recursive)) (ignore-errors (delete-directory tmp-name2 'recursive)))))) From fa574e68dec8255e211fbca95e187083ec6eabb4 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 3 Jan 2021 11:19:48 -0800 Subject: [PATCH 45/96] Fix broken build on AIX 7.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without this fix, the build on AIX 7.2 with xlc fails in the ‘CCLD temacs’ step with the diagnostic ‘ld: 0711-317 ERROR: Undefined symbol: BC’. This is because -lcurses does not define BC etc. * configure.ac: When building terminfo.o, define TERMINFO_DEFINES_BC if the library defines BC etc. * src/terminfo.c (UP, BC, PC): Define depending on TERMINFO_DEFINES_BC, not on TERMINFO. (cherry picked from commit 632917461a7c1893a83979a3873b51d4da3b8a42) --- configure.ac | 12 ++++++++++++ src/terminfo.c | 6 +++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index bcc0be7de03..66c660696b7 100644 --- a/configure.ac +++ b/configure.ac @@ -4393,6 +4393,18 @@ TERMCAP_OBJ=tparam.o if test $TERMINFO = yes; then AC_DEFINE(TERMINFO, 1, [Define to 1 if you use terminfo instead of termcap.]) TERMCAP_OBJ=terminfo.o + AC_CACHE_CHECK([whether $LIBS_TERMCAP library defines BC], + [emacs_cv_terminfo_defines_BC], + [OLD_LIBS=$LIBS + LIBS="$LIBS $LIBS_TERMCAP" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern char *BC;]], [[return !*BC;]])], + [emacs_cv_terminfo_defines_BC=yes], + [emacs_cv_terminfo_defines_BC=no]) + LIBS=$OLD_LIBS]) + if test "$emacs_cv_terminfo_defines_BC" = yes; then + AC_DEFINE([TERMINFO_DEFINES_BC], 1, [Define to 1 if the + terminfo library defines the variables BC, PC, and UP.]) + fi fi if test "X$LIBS_TERMCAP" = "X-lncurses"; then AC_DEFINE(USE_NCURSES, 1, [Define to 1 if you use ncurses.]) diff --git a/src/terminfo.c b/src/terminfo.c index 15aff317f15..a9c9572bbb2 100644 --- a/src/terminfo.c +++ b/src/terminfo.c @@ -23,10 +23,10 @@ along with GNU Emacs. If not, see . */ /* Define these variables that serve as global parameters to termcap, so that we do not need to conditionalize the places in Emacs - that set them. But don't do that for terminfo, as that could - cause link errors when using -fno-common. */ + that set them. But don't do that if terminfo defines them, as that + could cause link errors when using -fno-common. */ -#if !TERMINFO +#ifndef TERMINFO_DEFINES_BC char *UP, *BC, PC; #endif From 97226aacfde717ec48fa8931c870497e089da17b Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 4 Jan 2021 10:33:43 -0800 Subject: [PATCH 46/96] Do not assume Xrender merely because Cairo Problem reported by Andrea Corallo in: https://lists.gnu.org/r/emacs-devel/2021-01/msg00225.html * src/xterm.c (x_term_init) [USE_CAIRO && !HAVE_XRENDER]: Do not call XRenderQueryExtension. --- src/xterm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/xterm.c b/src/xterm.c index 0a86738cc20..b8374fed8b1 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -13035,13 +13035,13 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) or larger than other for other applications, even if it is the same font name (monospace-10 for example). */ +# ifdef HAVE_XRENDER int event_base, error_base; - char *v; - double d; - XRenderQueryExtension (dpyinfo->display, &event_base, &error_base); +# endif - v = XGetDefault (dpyinfo->display, "Xft", "dpi"); + char *v = XGetDefault (dpyinfo->display, "Xft", "dpi"); + double d; if (v != NULL && sscanf (v, "%lf", &d) == 1) dpyinfo->resy = dpyinfo->resx = d; } From 1e776d7d6a5672de15b2ee9c75f5637ca1756280 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Mon, 4 Jan 2021 21:13:33 +0200 Subject: [PATCH 47/96] ruby-add-log-current-method: Support methods with symbolic names * lisp/progmodes/ruby-mode.el (ruby-add-log-current-method): Support methods with symbolic names. --- lisp/progmodes/ruby-mode.el | 9 ++++++--- test/lisp/progmodes/ruby-mode-tests.el | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 3effb6ed662..cd9d087856c 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -1598,13 +1598,16 @@ See `add-log-current-defun-function'." (let* ((indent 0) mname mlist (start (point)) (make-definition-re - (lambda (re) + (lambda (re &optional method-name?) (concat "^[ \t]*" re "[ \t]+" "\\(" ;; \\. and :: for class methods - "\\([A-Za-z_]" ruby-symbol-re "*[?!]?\\|\\.\\|::" "\\)" + "\\([A-Za-z_]" ruby-symbol-re "*[?!]?" + (when method-name? "\\|") + (when method-name? ruby-operator-re) + "\\|\\.\\|::" "\\)" "+\\)"))) - (definition-re (funcall make-definition-re ruby-defun-beg-re)) + (definition-re (funcall make-definition-re ruby-defun-beg-re t)) (module-re (funcall make-definition-re "\\(class\\|module\\)"))) ;; Get the current method definition (or class/module). (when (re-search-backward definition-re nil t) diff --git a/test/lisp/progmodes/ruby-mode-tests.el b/test/lisp/progmodes/ruby-mode-tests.el index 67b592e9070..42a011c8bcd 100644 --- a/test/lisp/progmodes/ruby-mode-tests.el +++ b/test/lisp/progmodes/ruby-mode-tests.el @@ -497,7 +497,8 @@ VALUES-PLIST is a list with alternating index and value elements." (ert-deftest ruby-add-log-current-method-examples () (let ((pairs '(("foo" . "#foo") ("C.foo" . ".foo") - ("self.foo" . ".foo")))) + ("self.foo" . ".foo") + ("<<" . "#<<")))) (dolist (pair pairs) (let ((name (car pair)) (value (cdr pair))) From 42c3f7a134f8e51f4eb78e907abb521421e50e39 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 4 Jan 2021 15:25:29 -0500 Subject: [PATCH 48/96] * lisp/erc/erc.el (erc-process-input-line): Undo confused last change --- lisp/erc/erc.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 66f88280984..bb68173b6dc 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -2821,9 +2821,9 @@ this function from interpreting the line as a command." (let* ((cmd (nth 0 command-list)) (args (nth 1 command-list))) (condition-case nil - (if (functionp args) - (funcall cmd args) - (apply cmd args)) + (if (listp args) + (apply cmd args) + (funcall cmd args)) (wrong-number-of-arguments (erc-display-message nil 'error (current-buffer) 'incorrect-args ?c (erc-command-name cmd) From a79e1a85f8f20911be3bbac883ee7bdffcfbe7a0 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 4 Jan 2021 15:31:58 -0500 Subject: [PATCH 49/96] * lisp/mail/reporter.el: Use lexical-binding (reporter--run-functions): New function. (reporter-dump-state): Use it and simplify the code. --- lisp/mail/reporter.el | 82 ++++++++++++++++++++++--------------------- 1 file changed, 42 insertions(+), 40 deletions(-) diff --git a/lisp/mail/reporter.el b/lisp/mail/reporter.el index f4de299f537..2e583a470d6 100644 --- a/lisp/mail/reporter.el +++ b/lisp/mail/reporter.el @@ -1,4 +1,4 @@ -;;; reporter.el --- customizable bug reporting of lisp programs +;;; reporter.el --- customizable bug reporting of lisp programs -*- lexical-binding: t; -*- ;; Copyright (C) 1993-1998, 2001-2021 Free Software Foundation, Inc. @@ -158,7 +158,7 @@ composed.") t) (error indent-enclosing-p)))) -(defun reporter-lisp-indent (indent-point state) +(defun reporter-lisp-indent (_indent-point state) "A better lisp indentation style for bug reporting." (save-excursion (goto-char (1+ (nth 1 state))) @@ -193,7 +193,7 @@ MAILBUF is the mail buffer being composed." (<= maxwidth (current-column))) (save-excursion (let ((compact-p (not (memq varsym reporter-dont-compact-list))) - (lisp-indent-function 'reporter-lisp-indent)) + (lisp-indent-function #'reporter-lisp-indent)) (goto-char here) (reporter-beautify-list maxwidth compact-p)))) (insert "\n")) @@ -206,6 +206,11 @@ MAILBUF is the mail buffer being composed." (error (error "")))) +(defun reporter--run-functions (funs) + (if (functionp funs) + (funcall funs) + (mapc #'funcall funs))) + (defun reporter-dump-state (pkgname varlist pre-hooks post-hooks) "Dump the state of the mode specific variables. PKGNAME contains the name of the mode as it will appear in the bug @@ -230,42 +235,39 @@ properly. PRE-HOOKS is run after the Emacs version and PKGNAME are inserted, but before the VARLIST is dumped. POST-HOOKS is run after the VARLIST is dumped." - (let ((buffer (current-buffer))) - (set-buffer buffer) - (insert "Emacs : " (emacs-version) "\n") - (and pkgname - (insert "Package: " pkgname "\n")) - (run-hooks 'pre-hooks) - (if (not varlist) - nil - (insert "\ncurrent state:\n==============\n") - ;; create an emacs-lisp-mode buffer to contain the output, which - ;; we'll later insert into the mail buffer - (condition-case fault - (let ((mailbuf (current-buffer)) - (elbuf (get-buffer-create " *tmp-reporter-buffer*"))) - (with-current-buffer elbuf - (emacs-lisp-mode) - (erase-buffer) - (insert "(setq\n") - (lisp-indent-line) - (mapc - (lambda (varsym-or-cons-cell) - (let ((varsym (or (car-safe varsym-or-cons-cell) - varsym-or-cons-cell)) - (printer (or (cdr-safe varsym-or-cons-cell) - 'reporter-dump-variable))) - (funcall printer varsym mailbuf))) - varlist) - (lisp-indent-line) - (insert ")\n")) - (insert-buffer-substring elbuf)) - (error - (insert "State could not be dumped due to the following error:\n\n" - (format "%s" fault) - "\n\nYou should still send this bug report.")))) - (run-hooks 'post-hooks) - )) + (insert "Emacs : " (emacs-version) "\n") + (and pkgname + (insert "Package: " pkgname "\n")) + (reporter--run-functions pre-hooks) + (if (not varlist) + nil + (insert "\ncurrent state:\n==============\n") + ;; create an emacs-lisp-mode buffer to contain the output, which + ;; we'll later insert into the mail buffer + (condition-case fault + (let ((mailbuf (current-buffer)) + (elbuf (get-buffer-create " *tmp-reporter-buffer*"))) + (with-current-buffer elbuf + (emacs-lisp-mode) + (erase-buffer) + (insert "(setq\n") + (lisp-indent-line) + (mapc + (lambda (varsym-or-cons-cell) + (let ((varsym (or (car-safe varsym-or-cons-cell) + varsym-or-cons-cell)) + (printer (or (cdr-safe varsym-or-cons-cell) + 'reporter-dump-variable))) + (funcall printer varsym mailbuf))) + varlist) + (lisp-indent-line) + (insert ")\n")) + (insert-buffer-substring elbuf)) + (error + (insert "State could not be dumped due to the following error:\n\n" + (format "%s" fault) + "\n\nYou should still send this bug report.")))) + (reporter--run-functions post-hooks)) (defun reporter-compose-outgoing () @@ -365,7 +367,7 @@ mail-sending package is used for editing and sending the message." (skip-chars-backward " \t\n") (setq reporter-initial-text (buffer-substring after-sep-pos (point)))) (if (setq hookvar (get agent 'hookvar)) - (add-hook hookvar 'reporter-bug-hook nil t)) + (add-hook hookvar #'reporter-bug-hook nil t)) ;; compose the minibuf message and display this. (let* ((sendkey-whereis (where-is-internal From 37e3a6eb3161c664ea1a81dcaadb0f29fdf162fb Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 4 Jan 2021 15:34:12 -0500 Subject: [PATCH 50/96] * lisp/cedet/srecode/semantic.el: Use lexical-binding (srecode-semantic-insert-tag): Can't use `run-hook-with-args` on lexical variable. --- lisp/cedet/srecode/semantic.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lisp/cedet/srecode/semantic.el b/lisp/cedet/srecode/semantic.el index 21ed1f96ae6..101246cae6f 100644 --- a/lisp/cedet/srecode/semantic.el +++ b/lisp/cedet/srecode/semantic.el @@ -1,4 +1,4 @@ -;;; srecode/semantic.el --- Semantic specific extensions to SRecode. +;;; srecode/semantic.el --- Semantic specific extensions to SRecode -*- lexical-binding:t -*- ;; Copyright (C) 2007-2021 Free Software Foundation, Inc. @@ -57,7 +57,7 @@ This class will be used to derive dictionary values.") (cl-defmethod srecode-compound-toString((cp srecode-semantic-tag) function - dictionary) + _dictionary) "Convert the compound dictionary value CP to a string. If FUNCTION is non-nil, then FUNCTION is somehow applied to an aspect of the compound value." @@ -410,7 +410,9 @@ as `function' will leave point where code might be inserted." ;; Insert the template. (let ((endpt (srecode-insert-fcn temp dict nil t))) - (run-hook-with-args 'point-insert-fcn tag) + (if (functionp point-insert-fcn) + (funcall point-insert-fcn tag) + (dolist (f point-insert-fcn) (funcall f tag))) ;;(sit-for 1) (cond From 57e872ac757d7a003f4a7f132a08798c3a1a6e97 Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Mon, 4 Jan 2021 22:08:39 +0100 Subject: [PATCH 51/96] Make a process tests a bit more robust. * test/src/process-tests.el (process-tests/fd-setsize-no-crash/make-process): Allow for processes to fail before 'exec'. --- test/src/process-tests.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/src/process-tests.el b/test/src/process-tests.el index 5294bc07ce5..1f88232c7fc 100644 --- a/test/src/process-tests.el +++ b/test/src/process-tests.el @@ -560,8 +560,11 @@ FD_SETSIZE file descriptors (Bug#24325)." ;; We should have managed to start at least one process. (should processes) (dolist (process processes) - (should (process-live-p process)) - (process-send-eof process) + ;; The process now should either be running, or have + ;; already failed before `exec'. + (should (memq (process-status process) '(run exit))) + (when (process-live-p process) + (process-send-eof process)) (while (accept-process-output process)) (should (eq (process-status process) 'exit)) ;; If there's an error between fork and exec, Emacs From 80e26472206cc44837521ba594cd50e724d9af5c Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 4 Jan 2021 18:23:43 -0500 Subject: [PATCH 52/96] * lisp/filesets.el: Use lexical-binding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove redundant `:group` args. Require cl-lib and seq. Fix various O(n²) bug and flag a few remaining ones. (filesets-external-viewers): Simplify regexps. Use \' instead of $. Remove useless :constraint-flag properties. (filesets-convert-path-list): η-reduce. (filesets-eviewer-constraint-p): Mark :constraint-flag as obsolete. (filesets-spawn-external-viewer): Can't use `run-hooks` on lexical variable. (filesets-filter-list): Fix O(n²) bug. (filesets-ormap): Simplify. (filesets-some, filesets-member, filesets-sublist): Make them obsolete aliases. (filesets-reset-fileset): Simplify. (filesets-directory-files): Use `push`. (filesets-spawn-external-viewer): Use `mapconcat` to fix O(n²) bug. (filesets-cmd-get-args): Use `mapcan` to fix O(n²) bug. (filesets-run-cmd): Use `mapconcat` and `mapcan` to fix O(n²) bugs. (filesets-ingroup-collect-finder): Use dynamic scoping. (filesets-ingroup-collect-files): Use `nreverse` to fix O(n²) bug. (filesets-ingroup-collect-build-menu): Use `mapcan` to fix O(n²) bug. --- lisp/filesets.el | 477 +++++++++++++++++++++-------------------------- 1 file changed, 214 insertions(+), 263 deletions(-) diff --git a/lisp/filesets.el b/lisp/filesets.el index 7c01b15b345..661a93edf19 100644 --- a/lisp/filesets.el +++ b/lisp/filesets.el @@ -1,4 +1,4 @@ -;;; filesets.el --- handle group of files +;;; filesets.el --- handle group of files -*- lexical-binding: t; -*- ;; Copyright (C) 2002-2021 Free Software Foundation, Inc. @@ -88,7 +88,8 @@ ;;; Code: -(eval-when-compile (require 'cl-lib)) +(require 'cl-lib) +(require 'seq) (require 'easymenu) ;;; Some variables @@ -153,52 +154,25 @@ COND-FN takes one argument: the current element." ; (cl-remove 'dummy lst :test (lambda (dummy elt) ; (not (funcall cond-fn elt))))) (let ((rv nil)) - (dolist (elt lst rv) + (dolist (elt lst) (when (funcall cond-fn elt) - (setq rv (append rv (list elt))))))) + (push elt rv))) + (nreverse rv))) (defun filesets-ormap (fsom-pred lst) "Return the tail of LST for the head of which FSOM-PRED is non-nil." (let ((fsom-lst lst) (fsom-rv nil)) - (while (and (not (null fsom-lst)) + (while (and fsom-lst (null fsom-rv)) (if (funcall fsom-pred (car fsom-lst)) (setq fsom-rv fsom-lst) (setq fsom-lst (cdr fsom-lst)))) fsom-rv)) -(defun filesets-some (fss-pred fss-lst) - "Return non-nil if FSS-PRED is non-nil for any element of FSS-LST. -Like `some', return the first value of FSS-PRED that is non-nil." - (catch 'exit - (dolist (fss-this fss-lst nil) - (let ((fss-rv (funcall fss-pred fss-this))) - (when fss-rv - (throw 'exit fss-rv)))))) -;(fset 'filesets-some 'cl-some) ;; or use the cl function - -(defun filesets-member (fsm-item fsm-lst &rest fsm-keys) - "Find the first occurrence of FSM-ITEM in FSM-LST. -It is supposed to work like cl's `member*'. At the moment only the :test -key is supported." - (let ((fsm-test (or (plist-get fsm-keys ':test) - (function equal)))) - (filesets-ormap (lambda (fsm-this) - (funcall fsm-test fsm-item fsm-this)) - fsm-lst))) -;(fset 'filesets-member 'cl-member) ;; or use the cl function - -(defun filesets-sublist (lst beg &optional end) - "Get the sublist of LST from BEG to END - 1." - (let ((rv nil) - (i beg) - (top (or end - (length lst)))) - (while (< i top) - (setq rv (append rv (list (nth i lst)))) - (setq i (+ i 1))) - rv)) +(define-obsolete-function-alias 'filesets-some #'cl-some "28.1") +(define-obsolete-function-alias 'filesets-member #'cl-member "28.1") +(define-obsolete-function-alias 'filesets-sublist #'seq-subseq "28.1") (defun filesets-select-command (cmd-list) "Select one command from CMD-LIST -- a string with space separated names." @@ -222,7 +196,7 @@ key is supported." (defun filesets-message (level &rest args) "Show a message only if LEVEL is greater or equal then `filesets-verbosity'." (when (<= level (abs filesets-verbosity)) - (apply 'message args))) + (apply #'message args))) ;;; config file @@ -233,9 +207,9 @@ key is supported." (defun filesets-reset-fileset (&optional fileset no-cache) "Reset the cached values for one or all filesets." - (if fileset - (setq filesets-submenus (lax-plist-put filesets-submenus fileset nil)) - (setq filesets-submenus nil)) + (setq filesets-submenus (if fileset + (lax-plist-put filesets-submenus fileset nil) + nil)) (setq filesets-has-changed-flag t) (setq filesets-update-cache-file-flag (or filesets-update-cache-file-flag (not no-cache)))) @@ -303,50 +277,46 @@ SYM to VAL and return t. If INIT-FLAG is non-nil, set with (defcustom filesets-menu-name "Filesets" "Filesets' menu name." - :set (function filesets-set-default) - :type 'string - :group 'filesets) + :set #'filesets-set-default + :type 'string) (defcustom filesets-menu-path '("File") ; cf recentf-menu-path "The menu under which the filesets menu should be inserted. See `easy-menu-add-item' for documentation." - :set (function filesets-set-default) + :set #'filesets-set-default :type '(choice (const :tag "Top Level" nil) (sexp :tag "Menu Path")) :version "23.1" ; was nil - :group 'filesets) + ) (defcustom filesets-menu-before "Open File..." ; cf recentf-menu-before "The name of a menu before which this menu should be added. See `easy-menu-add-item' for documentation." - :set (function filesets-set-default) + :set #'filesets-set-default :type '(choice (string :tag "Name") (const :tag "Last" nil)) :version "23.1" ; was "File" - :group 'filesets) + ) (defcustom filesets-menu-in-menu nil "Use that instead of `current-menubar' as the menu to change. See `easy-menu-add-item' for documentation." - :set (function filesets-set-default) - :type 'sexp - :group 'filesets) + :set #'filesets-set-default + :type 'sexp) (defcustom filesets-menu-shortcuts-flag t "Non-nil means to prepend menus with hopefully unique shortcuts." - :set (function filesets-set-default!) - :type 'boolean - :group 'filesets) + :set #'filesets-set-default! + :type 'boolean) (defcustom filesets-menu-shortcuts-marker "%_" "String for marking menu shortcuts." - :set (function filesets-set-default!) - :type 'string - :group 'filesets) + :set #'filesets-set-default! + :type 'string) ;;(defcustom filesets-menu-cnvfp-flag nil ;; "Non-nil means show \"Convert :pattern to :files\" entry for :pattern menus." -;; :set (function filesets-set-default!) +;; :set #'filesets-set-default! ;; :type 'boolean ;; :group 'filesets) @@ -355,9 +325,8 @@ See `easy-menu-add-item' for documentation." "File to be used for saving the filesets menu between sessions. Set this to \"\", to disable caching of menus. Don't forget to check out `filesets-menu-ensure-use-cached'." - :set (function filesets-set-default) - :type 'file - :group 'filesets) + :set #'filesets-set-default + :type 'file) (put 'filesets-menu-cache-file 'risky-local-variable t) (defcustom filesets-menu-cache-contents @@ -383,7 +352,7 @@ If you want caching to work properly, at least `filesets-submenus', list. Don't forget to check out `filesets-menu-ensure-use-cached'." - :set (function filesets-set-default) + :set #'filesets-set-default :type '(repeat (choice :tag "Variable" (const :tag "filesets-submenus" @@ -400,8 +369,7 @@ Don't forget to check out `filesets-menu-ensure-use-cached'." :value filesets-ingroup-patterns) (const :tag "filesets-be-docile-flag" :value filesets-be-docile-flag) - (sexp :tag "Other" :value nil))) - :group 'filesets) + (sexp :tag "Other" :value nil)))) (define-obsolete-variable-alias 'filesets-cache-fill-content-hooks 'filesets-cache-fill-content-hook "24.3") @@ -423,48 +391,43 @@ configuration file, you can add a something like this to this hook. Don't forget to check out `filesets-menu-ensure-use-cached'." - :set (function filesets-set-default) - :type 'hook - :group 'filesets) + :set #'filesets-set-default + :type 'hook) (defcustom filesets-cache-hostname-flag nil "Non-nil means cache the hostname. If the current name differs from the cached one, rebuild the menu and create a new cache file." - :set (function filesets-set-default) - :type 'boolean - :group 'filesets) + :set #'filesets-set-default + :type 'boolean) (defcustom filesets-cache-save-often-flag nil "Non-nil means save buffer on every change of the filesets menu. If this variable is set to nil and if Emacs crashes, the cache and filesets-data could get out of sync. Set this to t if this happens from time to time or if the fileset cache causes troubles." - :set (function filesets-set-default) - :type 'boolean - :group 'filesets) + :set #'filesets-set-default + :type 'boolean) (defcustom filesets-max-submenu-length 25 "Maximum length of submenus. Set this value to 0 to turn menu splitting off. BTW, parts of submenus will not be rewrapped if their length exceeds this value." - :set (function filesets-set-default) - :type 'integer - :group 'filesets) + :set #'filesets-set-default + :type 'integer) (defcustom filesets-max-entry-length 50 "Truncate names of split submenus to this length." - :set (function filesets-set-default) - :type 'integer - :group 'filesets) + :set #'filesets-set-default + :type 'integer) -(defcustom filesets-browse-dir-function 'dired +(defcustom filesets-browse-dir-function #'dired "A function or command used for browsing directories. When using an external command, \"%s\" will be replaced with the directory's name. Note: You have to manually rebuild the menu if you change this value." - :set (function filesets-set-default) + :set #'filesets-set-default :type '(choice :tag "Function:" (const :tag "dired" :value dired) @@ -473,10 +436,9 @@ Note: You have to manually rebuild the menu if you change this value." (string :tag "Name") (string :tag "Arguments")) (function :tag "Function" - :value nil)) - :group 'filesets) + :value nil))) -(defcustom filesets-open-file-function 'filesets-find-or-display-file +(defcustom filesets-open-file-function #'filesets-find-or-display-file "The function used for opening files. `filesets-find-or-display-file' ... Filesets' default function for @@ -489,26 +451,24 @@ for a specific file type. Either this viewer, if defined, or readable, will not be opened. Caveat: Changes will take effect only after rebuilding the menu." - :set (function filesets-set-default) + :set #'filesets-set-default :type '(choice :tag "Function:" (const :tag "filesets-find-or-display-file" :value filesets-find-or-display-file) (const :tag "filesets-find-file" :value filesets-find-file) (function :tag "Function" - :value nil)) - :group 'filesets) + :value nil))) -(defcustom filesets-save-buffer-function 'save-buffer +(defcustom filesets-save-buffer-function #'save-buffer "The function used to save a buffer. Caveat: Changes will take effect after rebuilding the menu." - :set (function filesets-set-default) + :set #'filesets-set-default :type '(choice :tag "Function:" (const :tag "save-buffer" :value save-buffer) (function :tag "Function" - :value nil)) - :group 'filesets) + :value nil))) (defcustom filesets-find-file-delay (if (and (featurep 'xemacs) gutter-buffers-tab-visible-p) @@ -519,29 +479,25 @@ This is for calls via `filesets-find-or-display-file' or `filesets-find-file'. Set this to 0, if you don't use XEmacs's buffer tabs." - :set (function filesets-set-default) - :type 'number - :group 'filesets) + :set #'filesets-set-default + :type 'number) (defcustom filesets-be-docile-flag nil "Non-nil means don't complain if a file or a directory doesn't exist. This is useful if you want to use the same startup files in different computer environments." - :set (function filesets-set-default) - :type 'boolean - :group 'filesets) + :set #'filesets-set-default + :type 'boolean) (defcustom filesets-sort-menu-flag t "Non-nil means sort the filesets menu alphabetically." - :set (function filesets-set-default) - :type 'boolean - :group 'filesets) + :set #'filesets-set-default + :type 'boolean) (defcustom filesets-sort-case-sensitive-flag t "Non-nil means sorting of the filesets menu is case sensitive." - :set (function filesets-set-default) - :type 'boolean - :group 'filesets) + :set #'filesets-set-default + :type 'boolean) (defcustom filesets-tree-max-level 3 "Maximum scan depth for directory trees. @@ -561,9 +517,8 @@ i.e. how deep the menu should be. Try something like and it should become clear what this option is about. In any case, including directory trees to the menu can take a lot of memory." - :set (function filesets-set-default) - :type 'integer - :group 'filesets) + :set #'filesets-set-default + :type 'integer) (defcustom filesets-commands '(("Isearch" @@ -590,7 +545,7 @@ function that returns one) to be run on a filesets' files. The argument or <> (quoted) will be replaced with the filename." - :set (function filesets-set-default+) + :set #'filesets-set-default+ :type '(repeat :tag "Commands" (list :tag "Definition" :value ("") (string "Name") @@ -606,8 +561,7 @@ the filename." (string :tag "Quoted File Name" :value "<>") (function :tag "Function" - :value nil))))) - :group 'filesets) + :value nil)))))) (put 'filesets-commands 'risky-local-variable t) (defcustom filesets-external-viewers @@ -627,28 +581,33 @@ the filename." (dvi-cmd "xdvi") (doc-cmd "antiword") (pic-cmd "gqview")) - `(("^.+\\..?html?$" browse-url + `((".\\..?html?\\'" browse-url ((:ignore-on-open-all t))) - ("^.+\\.pdf$" ,pdf-cmd + (".\\.pdf\\'" ,pdf-cmd ((:ignore-on-open-all t) (:ignore-on-read-text t) - (:constraint-flag ,pdf-cmd))) - ("^.+\\.e?ps\\(.gz\\)?$" ,ps-cmd + ;; (:constraintp ,pdf-cmd) + )) + (".\\.e?ps\\(.gz\\)?\\'" ,ps-cmd ((:ignore-on-open-all t) (:ignore-on-read-text t) - (:constraint-flag ,ps-cmd))) - ("^.+\\.dvi$" ,dvi-cmd + ;; (:constraintp ,ps-cmd) + )) + (".\\.dvi\\'" ,dvi-cmd ((:ignore-on-open-all t) (:ignore-on-read-text t) - (:constraint-flag ,dvi-cmd))) - ("^.+\\.doc$" ,doc-cmd + ;; (:constraintp ,dvi-cmd) + )) + (".\\.doc\\'" ,doc-cmd ((:capture-output t) (:ignore-on-read-text t) - (:constraint-flag ,doc-cmd))) - ("^.+\\.\\(tiff\\|xpm\\|gif\\|pgn\\)$" ,pic-cmd + ;; (:constraintp ,doc-cmd) + )) + (".\\.\\(tiff\\|xpm\\|gif\\|pgn\\)\\'" ,pic-cmd ((:ignore-on-open-all t) (:ignore-on-read-text t) - (:constraint-flag ,pic-cmd))))) + ;; (:constraintp ,pic-cmd) + )))) "Association list of file patterns and external viewers for use with `filesets-find-or-display-file'. @@ -665,10 +624,8 @@ i.e. on open-all-files-events or when running commands :constraintp FUNCTION ... use this viewer only if FUNCTION returns non-nil -:constraint-flag SEXP ... use this viewer only if SEXP evaluates to non-nil - -:open-hook HOOK ... run hooks after spawning the viewer -- mainly useful -in conjunction with :capture-output +:open-hook FUNCTIONs ... run FUNCTIONs after spawning the viewer -- mainly +useful in conjunction with :capture-output :args (FORMAT-STRING or SYMBOL or FUNCTION) ... a list of arguments \(defaults to (list \"%S\")) when using shell commands @@ -693,7 +650,7 @@ In order to view pdf or rtf files in an Emacs buffer, you could use these: (:constraintp (lambda () (and (filesets-which-command-p \"rtf2htm\") (filesets-which-command-p \"w3m\"))))))" - :set (function filesets-set-default) + :set #'filesets-set-default :type '(repeat :tag "Viewer" (list :tag "Definition" :value ("^.+\\.suffix$" "") @@ -708,7 +665,7 @@ In order to view pdf or rtf files in an Emacs buffer, you could use these: (const :format "" :value :constraintp) (function :tag "Function")) - (list :tag ":constraint-flag" + (list :tag ":constraint-flag (obsolete)" :value (:constraint-flag) (const :format "" :value :constraint-flag) @@ -749,8 +706,7 @@ In order to view pdf or rtf files in an Emacs buffer, you could use these: :value (:capture-output t) (const :format "" :value :capture-output) - (boolean :tag "Boolean")))))) - :group 'filesets) + (boolean :tag "Boolean"))))))) (put 'filesets-external-viewers 'risky-local-variable t) (defcustom filesets-ingroup-patterns @@ -891,7 +847,7 @@ With duplicates removed, it would be: M + A - X B" - :set (function filesets-set-default) + :set #'filesets-set-default :type '(repeat :tag "Include" (list @@ -937,8 +893,7 @@ With duplicates removed, it would be: (list :tag ":preprocess" :value (:preprocess) (const :format "" :value :preprocess) - (function :tag "Function"))))))) - :group 'filesets) + (function :tag "Function")))))))) (put 'filesets-ingroup-patterns 'risky-local-variable t) (defcustom filesets-data nil @@ -1009,8 +964,7 @@ is used. Before using :ingroup, make sure that the file type is already defined in `filesets-ingroup-patterns'." - :group 'filesets - :set (function filesets-data-set-default) + :set #'filesets-data-set-default :type '(repeat (cons :tag "Fileset" (string :tag "Name" :value "") @@ -1072,9 +1026,8 @@ defined in `filesets-ingroup-patterns'." (defcustom filesets-query-user-limit 15 "Query the user before opening a fileset with that many files." - :set (function filesets-set-default) - :type 'integer - :group 'filesets) + :set #'filesets-set-default + :type 'integer) (defun filesets-filter-dir-names (lst &optional negative) @@ -1127,16 +1080,16 @@ Return full path if FULL-FLAG is non-nil." (string-match-p pattern this)) (filesets-message 5 "Filesets: matched dir %S with pattern %S" this pattern) - (setq dirs (cons this dirs)))) + (push this dirs))) (t (when (or (not pattern) (string-match-p pattern this)) (filesets-message 5 "Filesets: matched file %S with pattern %S" this pattern) - (setq files (cons (if full-flag - (concat (file-name-as-directory dir) this) - this) - files)))))) + (push (if full-flag + (concat (file-name-as-directory dir) this) + this) + files))))) (cond ((equal what ':dirs) (filesets-conditional-sort dirs)) @@ -1193,7 +1146,7 @@ Return full path if FULL-FLAG is non-nil." (defun filesets-convert-path-list (string) "Return a path-list given as STRING as list." (if string - (mapcar (lambda (x) (file-name-as-directory x)) + (mapcar #'file-name-as-directory (split-string string path-separator)) nil)) @@ -1203,17 +1156,17 @@ Return full path if FULL-FLAG is non-nil." filename))) (if (file-exists-p f) f - (filesets-some + (cl-some (lambda (dir) (let ((dir (file-name-as-directory dir)) (files (if (file-exists-p dir) (filesets-directory-files dir nil ':files) nil))) - (filesets-some (lambda (file) - (if (equal filename (file-name-nondirectory file)) - (concat dir file) - nil)) - files))) + (cl-some (lambda (file) + (if (equal filename (file-name-nondirectory file)) + (concat dir file) + nil)) + files))) path-list)))) @@ -1223,12 +1176,14 @@ Return full path if FULL-FLAG is non-nil." (defun filesets-eviewer-constraint-p (entry) (let* ((props (filesets-eviewer-get-props entry)) - (constraint (assoc ':constraintp props)) - (constraint-flag (assoc ':constraint-flag props))) + (constraint (assoc :constraintp props)) + (constraint-flag (assoc :constraint-flag props))) (cond (constraint (funcall (cadr constraint))) (constraint-flag + (message "Obsolete :constraint-flag %S, use :constraintp instead" + (cadr constraint-flag)) (eval (cadr constraint-flag))) (t t)))) @@ -1236,7 +1191,7 @@ Return full path if FULL-FLAG is non-nil." (defun filesets-get-external-viewer (file) "Find an external viewer for FILE." (let ((filename (file-name-nondirectory file))) - (filesets-some + (cl-some (lambda (entry) (when (and (string-match-p (nth 0 entry) filename) (filesets-eviewer-constraint-p entry)) @@ -1246,7 +1201,7 @@ Return full path if FULL-FLAG is non-nil." (defun filesets-get-external-viewer-by-name (name) "Get the external viewer definition called NAME." (when name - (filesets-some + (cl-some (lambda (entry) (when (and (string-equal (nth 1 entry) name) (filesets-eviewer-constraint-p entry)) @@ -1308,17 +1263,13 @@ Use the viewer defined in EV-ENTRY (a valid element of (oh (filesets-filetype-get-prop ':open-hook file entry)) (args (let ((fmt (filesets-filetype-get-prop ':args file entry))) (if fmt - (let ((rv "")) - (dolist (this fmt rv) - (setq rv (concat rv - (cond - ((stringp this) - (format this file)) - ((and (symbolp this) - (fboundp this)) - (format "%S" (funcall this))) - (t - (format "%S" this))))))) + (mapconcat + (lambda (this) + (if (stringp this) (format this file) + (format "%S" (if (functionp this) + (funcall this) + this)))) + fmt "") (format "%S" file)))) (output (cond @@ -1338,13 +1289,15 @@ Use the viewer defined in EV-ENTRY (a valid element of (insert output) (setq-local filesets-output-buffer-flag t) (set-visited-file-name file t) - (when oh - (run-hooks 'oh)) + (if (functionp oh) + (funcall oh) + (mapc #'funcall oh)) (set-buffer-modified-p nil) (setq buffer-read-only t) (goto-char (point-min))) - (when oh - (run-hooks 'oh)))) + (if (functionp oh) + (funcall oh) + (mapc #'funcall oh)))) (error "Filesets: general error when spawning external viewer")))) (defun filesets-find-file (file) @@ -1355,7 +1308,8 @@ not be opened." (when (or (file-readable-p file) (not filesets-be-docile-flag)) (sit-for filesets-find-file-delay) - (find-file file))) + (with-suppressed-warnings ((interactive-only find-file)) + (find-file file)))) (defun filesets-find-or-display-file (&optional file viewer) "Visit FILE using an external VIEWER or open it in an Emacs buffer." @@ -1394,7 +1348,8 @@ not be opened." (if (functionp filesets-browse-dir-function) (funcall filesets-browse-dir-function dir) (let ((name (car filesets-browse-dir-function)) - (args (format (cadr filesets-browse-dir-function) (expand-file-name dir)))) + (args (format (cadr filesets-browse-dir-function) + (expand-file-name dir)))) (with-temp-buffer (start-process (concat "Filesets:" name) "*Filesets external directory browser*" @@ -1445,7 +1400,7 @@ Return DEFAULT if not found. Return (car VALUE) if CARP is non-nil." "Return fileset ENTRY's mode: :files, :file, :tree, :pattern, or :ingroup. See `filesets-data'." (let ((data (filesets-data-get-data entry))) - (filesets-some + (cl-some (lambda (x) (if (assoc x data) x)) @@ -1557,16 +1512,15 @@ SAVE-FUNCTION takes no argument, but works on the current buffer." (assoc cmd-name filesets-commands)) (defun filesets-cmd-get-args (cmd-name) - (let ((args (let ((def (filesets-cmd-get-def cmd-name))) - (nth 2 def))) - (rv nil)) - (dolist (this args rv) - (cond - ((and (symbolp this) (fboundp this)) - (let ((x (funcall this))) - (setq rv (append rv (if (listp x) x (list x)))))) - (t - (setq rv (append rv (list this)))))))) + (mapcan (lambda (this) + (cond + ((and (symbolp this) (fboundp this)) + (let ((x (funcall this))) + (if (listp x) x (list x)))) + (t + (list this)))) + (let ((def (filesets-cmd-get-def cmd-name))) + (nth 2 def)))) (defun filesets-cmd-get-fn (cmd-name) (let ((def (filesets-cmd-get-def cmd-name))) @@ -1628,28 +1582,24 @@ Replace or <> with filename." (cond ((stringp fn) (let* ((args - (let ((txt "")) - (dolist (this args txt) - (setq txt - (concat txt - (if (equal txt "") "" " ") - (filesets-run-cmd--repl-fn + (mapconcat + (lambda (this) + (filesets-run-cmd--repl-fn this (lambda (this) - (format "%s" this)))))))) + (format "%s" this)))) + args + " ")) (cmd (concat fn " " args))) (filesets-cmd-show-result cmd (shell-command-to-string cmd)))) ((symbolp fn) - (let ((args - (let ((argl nil)) - (dolist (this args argl) - (setq argl - (append argl - (filesets-run-cmd--repl-fn - this - 'list))))))) - (apply fn args))))))))))))))))) + (apply fn + (mapcan (lambda (this) + (filesets-run-cmd--repl-fn + this + 'list)) + args))))))))))))))))) (defun filesets-get-cmd-menu () "Create filesets command menu." @@ -1832,8 +1782,8 @@ User will be queried, if no fileset name is provided." (if entry (let* ((files (filesets-entry-get-files entry)) (this (buffer-file-name buffer)) - (inlist (filesets-member this files - :test 'filesets-files-equalp))) + (inlist (cl-member this files + :test #'filesets-files-equalp))) (cond (inlist (message "Filesets: `%s' is already in `%s'" this name)) @@ -1858,8 +1808,8 @@ User will be queried, if no fileset name is provided." (if entry (let* ((files (filesets-entry-get-files entry)) (this (buffer-file-name buffer)) - (inlist (filesets-member this files - :test 'filesets-files-equalp))) + (inlist (cl-member this files + :test #'filesets-files-equalp))) ;;(message "%s %s %s" files this inlist) (if (and files this inlist) (let ((new (list (cons ':files (delete (car inlist) files))))) @@ -1908,7 +1858,7 @@ User will be queried, if no fileset name is provided." (substring (elt submenu 0) 2)))) (if (listp submenu) (cons name (cdr submenu)) - (apply 'vector (list name (cadr (append submenu nil))))))) + (apply #'vector (list name (cadr (append submenu nil))))))) ; (vconcat `[,name] (subseq submenu 1))))) (defun filesets-wrap-submenu (submenu-body) @@ -1926,12 +1876,14 @@ User will be queried, if no fileset name is provided." ((or (> count bl) (null data))) ;; (let ((sl (subseq submenu-body count - (let ((sl (filesets-sublist submenu-body count - (let ((x (+ count factor))) - (if (>= bl x) - x - nil))))) + (let ((sl (seq-subseq submenu-body count + (let ((x (+ count factor))) + (if (>= bl x) + x + nil))))) (when sl + ;; FIXME: O(n²) performance bug because of repeated `append': + ;; use `mapcan'? (setq result (append result @@ -1948,6 +1900,8 @@ User will be queried, if no fileset name is provided." (if (null (cdr x)) "" ", ")))) + ;; FIXME: O(n²) performance bug because of + ;; repeated `concat': use `mapconcat'? (setq rv (concat rv @@ -2023,11 +1977,11 @@ LOOKUP-NAME is used as lookup name for retrieving fileset specific settings." (and (stringp a) (stringp b) (string-match-p a b)))))) - (filesets-some (lambda (x) - (if (funcall fn (car x) masterfile) - (nth pos x) - nil)) - filesets-ingroup-patterns))) + (cl-some (lambda (x) + (if (funcall fn (car x) masterfile) + (nth pos x) + nil)) + filesets-ingroup-patterns))) (defun filesets-ingroup-get-pattern (master) "Access to `filesets-ingroup-patterns'. Extract patterns." @@ -2039,12 +1993,8 @@ LOOKUP-NAME is used as lookup name for retrieving fileset specific settings." (defun filesets-ingroup-collect-finder (patt case-sensitivep) "Helper function for `filesets-ingroup-collect'. Find pattern PATT." - (let ((cfs case-fold-search) - (rv (progn - (setq case-fold-search (not case-sensitivep)) - (re-search-forward patt nil t)))) - (setq case-fold-search cfs) - rv)) + (let ((case-fold-search (not case-sensitivep))) + (re-search-forward patt nil t))) (defun filesets-ingroup-cache-get (master) "Access to `filesets-ingroup-cache'." @@ -2102,9 +2052,9 @@ LOOKUP-NAME is used as lookup name for retrieving fileset specific settings." (when (and f (not (member f flist)) (or (not remdupl-flag) - (not (filesets-member + (not (cl-member f filesets-ingroup-files - :test 'filesets-files-equalp)))) + :test #'filesets-files-equalp)))) (let ((no-stub-flag (and (not this-stub-flag) (if this-stubp @@ -2116,16 +2066,18 @@ LOOKUP-NAME is used as lookup name for retrieving fileset specific settings." (cons f filesets-ingroup-files)) (when no-stub-flag (filesets-ingroup-cache-put master f)) - (setq lst (append lst (list f)))))))) + (push f lst)))))) (when lst (setq rv + ;; FIXME: O(n²) performance bug because of repeated + ;; `nconc'. (nconc rv (mapcar (lambda (this) `((,this ,this-name) ,@(filesets-ingroup-collect-files fs remdupl-flag this (- this-sd 1)))) - lst)))))))) + (nreverse lst))))))))) (filesets-message 2 "Filesets: no patterns defined for %S" master))))) (defun filesets-ingroup-collect-build-menu (fs flist &optional other-count) @@ -2135,42 +2087,41 @@ FS is a fileset's name. FLIST is a list returned by (if (null flist) nil (let ((count 0) - (fsn fs) - (rv nil)) - (dolist (this flist rv) - (setq count (+ count 1)) - (let* ((def (if (listp this) (car this) (list this ""))) - (files (if (listp this) (cdr this) nil)) - (master (nth 0 def)) - (name (nth 1 def)) - (nm (concat (filesets-get-shortcut (if (or (not other-count) files) - count other-count)) - (if (or (null name) (equal name "")) - "" - (format "%s: " name)) - (file-name-nondirectory master)))) - (setq rv - (append rv - (if files - `((,nm - [,(concat "Inclusion Group: " - (file-name-nondirectory master)) - (filesets-open ':ingroup ',master ',fsn)] - "---" - [,master (filesets-file-open nil ',master ',fsn)] - "---" - ,@(let ((count 0)) - (mapcar - (lambda (this) - (setq count (+ count 1)) - (let ((ff (filesets-ingroup-collect-build-menu - fs (list this) count))) - (if (= (length ff) 1) - (car ff) - ff))) - files)) - ,@(filesets-get-menu-epilog master ':ingroup fsn))) - `([,nm (filesets-file-open nil ',master ',fsn)]))))))))) + (fsn fs)) + (mapcan (lambda (this) + (setq count (+ count 1)) + (let* ((def (if (listp this) (car this) (list this ""))) + (files (if (listp this) (cdr this) nil)) + (master (nth 0 def)) + (name (nth 1 def)) + (nm (concat (filesets-get-shortcut + (if (or (not other-count) files) + count other-count)) + (if (or (null name) (equal name "")) + "" + (format "%s: " name)) + (file-name-nondirectory master)))) + (if files + `((,nm + [,(concat "Inclusion Group: " + (file-name-nondirectory master)) + (filesets-open ':ingroup ',master ',fsn)] + "---" + [,master (filesets-file-open nil ',master ',fsn)] + "---" + ,@(let ((count 0)) + (mapcar + (lambda (this) + (setq count (+ count 1)) + (let ((ff (filesets-ingroup-collect-build-menu + fs (list this) count))) + (if (= (length ff) 1) + (car ff) + ff))) + files)) + ,@(filesets-get-menu-epilog master ':ingroup fsn))) + `([,nm (filesets-file-open nil ',master ',fsn)])))) + flist)))) (defun filesets-ingroup-collect (fs remdupl-flag master) "Collect names of included files and build submenu." @@ -2275,7 +2226,7 @@ Construct a shortcut from COUNT." (:pattern (let* ((files (filesets-get-filelist entry mode 'on-ls)) (dirpatt (filesets-entry-get-pattern entry)) - (pattname (apply 'concat (cons "Pattern: " dirpatt))) + (pattname (apply #'concat (cons "Pattern: " dirpatt))) (count 0)) ;;(filesets-message 3 "Filesets: scanning %S" pattname) `([,pattname @@ -2418,14 +2369,14 @@ fileset thinks this is necessary or not." (dolist (this filesets-menu-cache-contents) (if (get this 'custom-type) (progn - (insert (format "(setq-default %s '%S)" this (eval this))) + (insert (format "(setq-default %s '%S)" this (eval this t))) (when filesets-menu-ensure-use-cached (newline) (insert (format "(setq %s (cons '%s %s))" 'filesets-ignore-next-set-default this 'filesets-ignore-next-set-default)))) - (insert (format "(setq %s '%S)" this (eval this)))) + (insert (format "(setq %s '%S)" this (eval this t)))) (newline 2)) (insert (format "(setq filesets-cache-version %S)" filesets-version)) (newline 2) @@ -2526,9 +2477,9 @@ We apologize for the inconvenience."))) "Filesets initialization. Set up hooks, load the cache file -- if existing -- and build the menu." (add-hook 'menu-bar-update-hook #'filesets-build-menu-maybe) - (add-hook 'kill-buffer-hook (function filesets-remove-from-ubl)) - (add-hook 'first-change-hook (function filesets-reset-filename-on-change)) - (add-hook 'kill-emacs-hook (function filesets-exit)) + (add-hook 'kill-buffer-hook #'filesets-remove-from-ubl) + (add-hook 'first-change-hook #'filesets-reset-filename-on-change) + (add-hook 'kill-emacs-hook #'filesets-exit) (if (filesets-menu-cache-file-load) (progn (filesets-build-menu-maybe) @@ -2542,7 +2493,7 @@ Set up hooks, load the cache file -- if existing -- and build the menu." (defun filesets-error (_class &rest args) "`error' wrapper." (declare (obsolete error "28.1")) - (error "%s" (mapconcat 'identity args " "))) + (error "%s" (mapconcat #'identity args " "))) (provide 'filesets) From 898a94a9be06a3ab51116778f6b4a263f832759d Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 4 Jan 2021 20:57:42 -0500 Subject: [PATCH 53/96] Use lexical-binding in the remaining preloaded files * lisp/widget.el: * lisp/w32-fns.el: * lisp/textmodes/fill.el: * lisp/term/common-win.el: * lisp/scroll-bar.el: * lisp/rfn-eshadow.el: * lisp/menu-bar.el: * lisp/language/tibetan.el: * lisp/language/thai.el: * lisp/language/misc-lang.el: * lisp/language/lao.el: * lisp/language/korean.el: * lisp/language/japanese.el: * lisp/language/indian.el: * lisp/language/hebrew.el: * lisp/language/european.el: * lisp/language/ethiopic.el: * lisp/language/english.el: * lisp/language/cyrillic.el: * lisp/language/chinese.el: * lisp/jka-cmpr-hook.el: * lisp/international/ucs-normalize.el: * lisp/international/mule.el: * lisp/international/mule-conf.el: * lisp/international/iso-transl.el: * lisp/international/fontset.el: * lisp/international/characters.el: * lisp/format.el: * lisp/facemenu.el: * lisp/electric.el: * lisp/dos-w32.el: * lisp/dos-fns.el: * lisp/disp-table.el: * lisp/cus-face.el: * lisp/composite.el: * lisp/bindings.el: * admin/unidata/blocks.awk: * admin/charsets/eucjp-ms.awk: * admin/charsets/cp51932.awk: Use `lexical-binding`. --- admin/charsets/cp51932.awk | 2 +- admin/charsets/eucjp-ms.awk | 2 +- admin/unidata/blocks.awk | 2 +- lisp/bindings.el | 6 +++--- lisp/composite.el | 8 +++----- lisp/cus-face.el | 2 +- lisp/disp-table.el | 2 +- lisp/dos-fns.el | 2 +- lisp/dos-w32.el | 10 +++++++--- lisp/electric.el | 4 +++- lisp/facemenu.el | 2 +- lisp/font-core.el | 2 +- lisp/format.el | 5 +++-- lisp/international/characters.el | 2 +- lisp/international/fontset.el | 2 +- lisp/international/iso-transl.el | 2 +- lisp/international/mule-conf.el | 2 +- lisp/international/mule.el | 2 +- lisp/international/ucs-normalize.el | 4 ++-- lisp/jka-cmpr-hook.el | 3 ++- lisp/language/chinese.el | 2 +- lisp/language/cyrillic.el | 2 +- lisp/language/english.el | 2 +- lisp/language/ethiopic.el | 2 +- lisp/language/european.el | 2 +- lisp/language/hebrew.el | 2 +- lisp/language/indian.el | 2 +- lisp/language/japanese.el | 2 +- lisp/language/korean.el | 2 +- lisp/language/lao.el | 2 +- lisp/language/misc-lang.el | 2 +- lisp/language/thai.el | 2 +- lisp/language/tibetan.el | 2 +- lisp/menu-bar.el | 5 +++-- lisp/rfn-eshadow.el | 2 +- lisp/scroll-bar.el | 2 +- lisp/term/common-win.el | 2 +- lisp/term/tty-colors.el | 2 +- lisp/textmodes/fill.el | 31 ++++++++++------------------- lisp/w32-fns.el | 12 +++++------ lisp/widget.el | 2 +- 41 files changed, 73 insertions(+), 77 deletions(-) diff --git a/admin/charsets/cp51932.awk b/admin/charsets/cp51932.awk index c3555095249..22b24af1ef5 100644 --- a/admin/charsets/cp51932.awk +++ b/admin/charsets/cp51932.awk @@ -31,7 +31,7 @@ # already been mapped to 1 or 3. BEGIN { - print ";;; cp51932.el -- translation table for CP51932"; + print ";;; cp51932.el -- translation table for CP51932 -*- lexical-binding:t -*-"; print ";;; Automatically generated from CP932-2BYTE.map"; print "(let ((map"; printf " '(;JISEXT<->UNICODE"; diff --git a/admin/charsets/eucjp-ms.awk b/admin/charsets/eucjp-ms.awk index f6a6748ce51..ca9a317611b 100644 --- a/admin/charsets/eucjp-ms.awk +++ b/admin/charsets/eucjp-ms.awk @@ -38,7 +38,7 @@ BEGIN { JISX0208_FROM2 = "/xf5/xa1"; JISX0212_FROM = "/x8f/xf3/xf3"; - print ";;; eucjp-ms.el -- translation table for eucJP-ms"; + print ";;; eucjp-ms.el -- translation table for eucJP-ms -*- lexical-binding:t -*-"; print ";;; Automatically generated from /usr/share/i18n/charmaps/EUC-JP-MS.gz"; print "(let ((map"; print " '(;JISEXT<->UNICODE"; diff --git a/admin/unidata/blocks.awk b/admin/unidata/blocks.awk index 986d299e666..4ecb233fe7b 100755 --- a/admin/unidata/blocks.awk +++ b/admin/unidata/blocks.awk @@ -203,7 +203,7 @@ function name2alias(name , w, w2) { } END { - print ";;; charscript.el --- character script table" + print ";;; charscript.el --- character script table -*- lexical-binding:t -*-" print ";;; Automatically generated from admin/unidata/Blocks.txt" print "(let (script-list)" print " (dolist (elt '(" diff --git a/lisp/bindings.el b/lisp/bindings.el index b68d55e73d8..187444af664 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -1,4 +1,4 @@ -;;; bindings.el --- define standard key bindings and some variables +;;; bindings.el --- define standard key bindings and some variables -*- lexical-binding: t; -*- ;; Copyright (C) 1985-1987, 1992-1996, 1999-2021 Free Software ;; Foundation, Inc. @@ -856,7 +856,7 @@ in contrast with \\[forward-char] and \\[backward-char], which see." (interactive "^p") (if visual-order-cursor-movement - (dotimes (i (if (numberp n) (abs n) 1)) + (dotimes (_ (if (numberp n) (abs n) 1)) (move-point-visually (if (and (numberp n) (< n 0)) -1 1))) (if (eq (current-bidi-paragraph-direction) 'left-to-right) (forward-char n) @@ -874,7 +874,7 @@ in contrast with \\[forward-char] and \\[backward-char], which see." (interactive "^p") (if visual-order-cursor-movement - (dotimes (i (if (numberp n) (abs n) 1)) + (dotimes (_ (if (numberp n) (abs n) 1)) (move-point-visually (if (and (numberp n) (< n 0)) 1 -1))) (if (eq (current-bidi-paragraph-direction) 'left-to-right) (backward-char n) diff --git a/lisp/composite.el b/lisp/composite.el index 7337605d4a9..6f654df15aa 100644 --- a/lisp/composite.el +++ b/lisp/composite.el @@ -1,4 +1,4 @@ -;;; composite.el --- support character composition +;;; composite.el --- support character composition -*- lexical-binding: t; -*- ;; Copyright (C) 2001-2021 Free Software Foundation, Inc. @@ -593,7 +593,6 @@ All non-spacing characters have this function in (as (lglyph-ascent glyph)) (de (lglyph-descent glyph)) (ce (/ (+ lb rb) 2)) - (w (lglyph-width glyph)) xoff yoff) (cond ((and class (>= class 200) (<= class 240)) @@ -653,7 +652,8 @@ All non-spacing characters have this function in ((and (= class 0) (eq (get-char-code-property (lglyph-char glyph) ;; Me = enclosing mark - 'general-category) 'Me)) + 'general-category) + 'Me)) ;; Artificially laying out glyphs in an enclosing ;; mark is difficult. All we can do is to adjust ;; the x-offset and width of the base glyph to @@ -695,9 +695,7 @@ All non-spacing characters have this function in (defun compose-gstring-for-dotted-circle (gstring direction) (let* ((dc (lgstring-glyph gstring 0)) ; glyph of dotted-circle - (dc-id (lglyph-code dc)) (fc (lgstring-glyph gstring 1)) ; glyph of the following char - (fc-id (lglyph-code fc)) (gstr (and nil (font-shape-gstring gstring direction)))) (if (and gstr (or (= (lgstring-glyph-len gstr) 1) diff --git a/lisp/cus-face.el b/lisp/cus-face.el index 7d9d1fe13ae..5dcb2842a21 100644 --- a/lisp/cus-face.el +++ b/lisp/cus-face.el @@ -1,4 +1,4 @@ -;;; cus-face.el --- customization support for faces +;;; cus-face.el --- customization support for faces -*- lexical-binding: t; -*- ;; ;; Copyright (C) 1996-1997, 1999-2021 Free Software Foundation, Inc. ;; diff --git a/lisp/disp-table.el b/lisp/disp-table.el index 6de14b1d297..a7fc8f0a76e 100644 --- a/lisp/disp-table.el +++ b/lisp/disp-table.el @@ -1,4 +1,4 @@ -;;; disp-table.el --- functions for dealing with char tables +;;; disp-table.el --- functions for dealing with char tables -*- lexical-binding: t; -*- ;; Copyright (C) 1987, 1994-1995, 1999, 2001-2021 Free Software ;; Foundation, Inc. diff --git a/lisp/dos-fns.el b/lisp/dos-fns.el index 5d4aa7843f1..255edd0f371 100644 --- a/lisp/dos-fns.el +++ b/lisp/dos-fns.el @@ -1,4 +1,4 @@ -;;; dos-fns.el --- MS-Dos specific functions +;;; dos-fns.el --- MS-Dos specific functions -*- lexical-binding: t; -*- ;; Copyright (C) 1991, 1993, 1995-1996, 2001-2021 Free Software ;; Foundation, Inc. diff --git a/lisp/dos-w32.el b/lisp/dos-w32.el index e902491446c..cf753214624 100644 --- a/lisp/dos-w32.el +++ b/lisp/dos-w32.el @@ -1,4 +1,4 @@ -;; dos-w32.el --- Functions shared among MS-DOS and W32 (NT/95) platforms +;; dos-w32.el --- Functions shared among MS-DOS and W32 (NT/95) platforms -*- lexical-binding: t; -*- ;; Copyright (C) 1996, 2001-2021 Free Software Foundation, Inc. @@ -154,13 +154,15 @@ when writing the file." ;; FIXME: Can't we use find-file-literally for the same purposes? (interactive "FFind file binary: ") (let ((coding-system-for-read 'no-conversion)) ;; FIXME: undecided-unix? - (find-file filename))) + (with-suppressed-warnings ((interactive-only find-file)) + (find-file filename)))) (defun find-file-text (filename) "Visit file FILENAME and treat it as a text file." (interactive "FFind file text: ") (let ((coding-system-for-read 'undecided-dos)) - (find-file filename))) + (with-suppressed-warnings ((interactive-only find-file)) + (find-file filename)))) (defun w32-find-file-not-found-set-buffer-file-coding-system () (with-current-buffer (current-buffer) @@ -261,6 +263,8 @@ filesystem mounted on drive Z:, FILESYSTEM could be \"Z:\"." :group 'dos-fns :group 'w32) +(defvar w32-quote-process-args) + ;; Function to actually send data to the printer port. ;; Supports writing directly, and using various programs. (defun w32-direct-print-region-helper (printer diff --git a/lisp/electric.el b/lisp/electric.el index 506e9aa0f7c..6701a36d8bb 100644 --- a/lisp/electric.el +++ b/lisp/electric.el @@ -1,4 +1,4 @@ -;;; electric.el --- window maker and Command loop for `electric' modes +;;; electric.el --- window maker and Command loop for `electric' modes -*- lexical-binding: t; -*- ;; Copyright (C) 1985-1986, 1995, 2001-2021 Free Software Foundation, ;; Inc. @@ -385,6 +385,8 @@ If multiple rules match, only first one is executed.") (when electric-layout-mode (electric-layout-post-self-insert-function-1))) +(defvar electric-pair-open-newline-between-pairs) + ;; for edebug's sake, a separate function (defun electric-layout-post-self-insert-function-1 () (let* ((pos (electric--after-char-pos)) diff --git a/lisp/facemenu.el b/lisp/facemenu.el index d362adcc9b7..2609397b0d9 100644 --- a/lisp/facemenu.el +++ b/lisp/facemenu.el @@ -1,4 +1,4 @@ -;;; facemenu.el --- create a face menu for interactively adding fonts to text +;;; facemenu.el --- create a face menu for interactively adding fonts to text -*- lexical-binding: t; -*- ;; Copyright (C) 1994-1996, 2001-2021 Free Software Foundation, Inc. diff --git a/lisp/font-core.el b/lisp/font-core.el index 38307bb1576..0f1a3d1c364 100644 --- a/lisp/font-core.el +++ b/lisp/font-core.el @@ -1,4 +1,4 @@ -;;; font-core.el --- Core interface to font-lock +;;; font-core.el --- Core interface to font-lock -*- lexical-binding: t; -*- ;; Copyright (C) 1992-2021 Free Software Foundation, Inc. diff --git a/lisp/format.el b/lisp/format.el index df3bc462c92..4209fc6401a 100644 --- a/lisp/format.el +++ b/lisp/format.el @@ -1,4 +1,4 @@ -;;; format.el --- read and save files in multiple formats +;;; format.el --- read and save files in multiple formats -*- lexical-binding: t; -*- ;; Copyright (C) 1994-1995, 1997, 1999, 2001-2021 Free Software ;; Foundation, Inc. @@ -419,7 +419,8 @@ If FORMAT is nil then do not do any format conversion." (file-name-nondirectory file))))) (list file fmt))) (let ((format-alist nil)) - (find-file filename)) + (with-suppressed-warnings ((interactive-only find-file)) + (find-file filename))) (if format (format-decode-buffer format))) diff --git a/lisp/international/characters.el b/lisp/international/characters.el index 6924e1c06db..87e8589e6fd 100644 --- a/lisp/international/characters.el +++ b/lisp/international/characters.el @@ -1,4 +1,4 @@ -;;; characters.el --- set syntax and category for multibyte characters +;;; characters.el --- set syntax and category for multibyte characters -*- lexical-binding: t; -*- ;; Copyright (C) 1997, 2000-2021 Free Software Foundation, Inc. ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, diff --git a/lisp/international/fontset.el b/lisp/international/fontset.el index 4d80e17e3db..14e7b89dd1f 100644 --- a/lisp/international/fontset.el +++ b/lisp/international/fontset.el @@ -1,4 +1,4 @@ -;;; fontset.el --- commands for handling fontset +;;; fontset.el --- commands for handling fontset -*- lexical-binding: t; -*- ;; Copyright (C) 1997-2021 Free Software Foundation, Inc. ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, diff --git a/lisp/international/iso-transl.el b/lisp/international/iso-transl.el index 8b5814e577c..2c7da2b7cdf 100644 --- a/lisp/international/iso-transl.el +++ b/lisp/international/iso-transl.el @@ -1,4 +1,4 @@ -;;; iso-transl.el --- keyboard input for ISO 10646 chars -*- coding: utf-8 -*- +;;; iso-transl.el --- keyboard input for ISO 10646 chars -*- coding: utf-8; lexical-binding: t; -*- ;; Copyright (C) 1987, 1993-1999, 2001-2021 Free Software Foundation, ;; Inc. diff --git a/lisp/international/mule-conf.el b/lisp/international/mule-conf.el index 662f211bd28..64aac46fcee 100644 --- a/lisp/international/mule-conf.el +++ b/lisp/international/mule-conf.el @@ -1,4 +1,4 @@ -;;; mule-conf.el --- configure multilingual environment +;;; mule-conf.el --- configure multilingual environment -*- lexical-binding: t; -*- ;; Copyright (C) 1997-2021 Free Software Foundation, Inc. ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 diff --git a/lisp/international/mule.el b/lisp/international/mule.el index d3a1005dae5..6a32cffe9a6 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el @@ -1,4 +1,4 @@ -;;; mule.el --- basic commands for multilingual environment +;;; mule.el --- basic commands for multilingual environment -*- lexical-binding: t; -*- ;; Copyright (C) 1997-2021 Free Software Foundation, Inc. ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, diff --git a/lisp/international/ucs-normalize.el b/lisp/international/ucs-normalize.el index d1b5c077813..0f8dedfc09b 100644 --- a/lisp/international/ucs-normalize.el +++ b/lisp/international/ucs-normalize.el @@ -1,4 +1,4 @@ -;;; ucs-normalize.el --- Unicode normalization NFC/NFD/NFKD/NFKC +;;; ucs-normalize.el --- Unicode normalization NFC/NFD/NFKD/NFKC -*- lexical-binding: t; -*- ;; Copyright (C) 2009-2021 Free Software Foundation, Inc. @@ -185,7 +185,7 @@ ;; always returns nil, something the code here doesn't like. (define-char-code-property 'decomposition "uni-decomposition.el") (define-char-code-property 'canonical-combining-class "uni-combining.el") - (let ((char 0) ccc decomposition) + (let (ccc decomposition) (mapc (lambda (start-end) (cl-do ((char (car start-end) (+ char 1))) ((> char (cdr start-end))) diff --git a/lisp/jka-cmpr-hook.el b/lisp/jka-cmpr-hook.el index 3c7d2a057d5..11d93a6df9a 100644 --- a/lisp/jka-cmpr-hook.el +++ b/lisp/jka-cmpr-hook.el @@ -1,4 +1,4 @@ -;;; jka-cmpr-hook.el --- preloaded code to enable jka-compr.el +;;; jka-cmpr-hook.el --- preloaded code to enable jka-compr.el -*- lexical-binding: t; -*- ;; Copyright (C) 1993-1995, 1997, 1999-2000, 2002-2021 Free Software ;; Foundation, Inc. @@ -93,6 +93,7 @@ Otherwise, it is nil.") "\\)" file-name-version-regexp "?\\'")))) ;; Functions for accessing the return value of jka-compr-get-compression-info +;; FIXME: Use cl-defstruct! (defun jka-compr-info-regexp (info) (aref info 0)) (defun jka-compr-info-compress-message (info) (aref info 1)) (defun jka-compr-info-compress-program (info) (aref info 2)) diff --git a/lisp/language/chinese.el b/lisp/language/chinese.el index 6b434feb137..5cb8344c094 100644 --- a/lisp/language/chinese.el +++ b/lisp/language/chinese.el @@ -1,4 +1,4 @@ -;;; chinese.el --- support for Chinese -*- coding: utf-8; -*- +;;; chinese.el --- support for Chinese -*- coding: utf-8; lexical-binding: t; -*- ;; Copyright (C) 2001-2021 Free Software Foundation, Inc. ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, diff --git a/lisp/language/cyrillic.el b/lisp/language/cyrillic.el index c491644d57c..c12096f95eb 100644 --- a/lisp/language/cyrillic.el +++ b/lisp/language/cyrillic.el @@ -1,4 +1,4 @@ -;;; cyrillic.el --- support for Cyrillic -*- coding: utf-8; -*- +;;; cyrillic.el --- support for Cyrillic -*- coding: utf-8; lexical-binding: t; -*- ;; Copyright (C) 1997-1998, 2001-2021 Free Software Foundation, Inc. ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, diff --git a/lisp/language/english.el b/lisp/language/english.el index dfbec85792f..41d56be7d46 100644 --- a/lisp/language/english.el +++ b/lisp/language/english.el @@ -1,4 +1,4 @@ -;;; english.el --- support for English +;;; english.el --- support for English -*- lexical-binding: t; -*- ;; Copyright (C) 1997, 2001-2021 Free Software Foundation, Inc. ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, diff --git a/lisp/language/ethiopic.el b/lisp/language/ethiopic.el index 1e409e3dcf8..8573f6177df 100644 --- a/lisp/language/ethiopic.el +++ b/lisp/language/ethiopic.el @@ -1,4 +1,4 @@ -;;; ethiopic.el --- support for Ethiopic -*- coding: utf-8-emacs; -*- +;;; ethiopic.el --- support for Ethiopic -*- coding: utf-8-emacs; lexical-binding: t; -*- ;; Copyright (C) 1997, 2001-2021 Free Software Foundation, Inc. ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, diff --git a/lisp/language/european.el b/lisp/language/european.el index 1f27ff0c73b..bcd62a14c4c 100644 --- a/lisp/language/european.el +++ b/lisp/language/european.el @@ -1,4 +1,4 @@ -;;; european.el --- support for European languages -*- coding: utf-8; -*- +;;; european.el --- support for European languages -*- coding: utf-8; lexical-binding: t; -*- ;; Copyright (C) 1997-1998, 2000-2021 Free Software Foundation, Inc. ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, diff --git a/lisp/language/hebrew.el b/lisp/language/hebrew.el index 9f9a14a0dc0..389565669a9 100644 --- a/lisp/language/hebrew.el +++ b/lisp/language/hebrew.el @@ -1,4 +1,4 @@ -;;; hebrew.el --- support for Hebrew -*- coding: utf-8 -*- +;;; hebrew.el --- support for Hebrew -*- coding: utf-8; lexical-binding: t; -*- ;; Copyright (C) 2001-2021 Free Software Foundation, Inc. ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, diff --git a/lisp/language/indian.el b/lisp/language/indian.el index b92fda53648..5ff57966c12 100644 --- a/lisp/language/indian.el +++ b/lisp/language/indian.el @@ -1,4 +1,4 @@ -;;; indian.el --- Indian languages support -*- coding: utf-8; -*- +;;; indian.el --- Indian languages support -*- coding: utf-8; lexical-binding: t; -*- ;; Copyright (C) 1997, 1999, 2001-2021 Free Software Foundation, Inc. ;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 diff --git a/lisp/language/japanese.el b/lisp/language/japanese.el index 8c724ee9667..bd8ef6ec857 100644 --- a/lisp/language/japanese.el +++ b/lisp/language/japanese.el @@ -1,4 +1,4 @@ -;;; japanese.el --- support for Japanese +;;; japanese.el --- support for Japanese -*- lexical-binding: t; -*- ;; Copyright (C) 1997, 2001-2021 Free Software Foundation, Inc. ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, diff --git a/lisp/language/korean.el b/lisp/language/korean.el index 997b8ae1319..22b33a440ef 100644 --- a/lisp/language/korean.el +++ b/lisp/language/korean.el @@ -1,4 +1,4 @@ -;;; korean.el --- support for Korean -*- coding: utf-8 -*- +;;; korean.el --- support for Korean -*- coding: utf-8; lexical-binding: t; -*- ;; Copyright (C) 1998, 2001-2021 Free Software Foundation, Inc. ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, diff --git a/lisp/language/lao.el b/lisp/language/lao.el index 44fe8d230db..5252f1e60ea 100644 --- a/lisp/language/lao.el +++ b/lisp/language/lao.el @@ -1,4 +1,4 @@ -;;; lao.el --- support for Lao -*- coding: utf-8 -*- +;;; lao.el --- support for Lao -*- coding: utf-8; lexical-binding: t; -*- ;; Copyright (C) 2001-2021 Free Software Foundation, Inc. ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, diff --git a/lisp/language/misc-lang.el b/lisp/language/misc-lang.el index 089b79c5208..0a274f144c2 100644 --- a/lisp/language/misc-lang.el +++ b/lisp/language/misc-lang.el @@ -1,4 +1,4 @@ -;;; misc-lang.el --- support for miscellaneous languages (characters) +;;; misc-lang.el --- support for miscellaneous languages (characters) -*- lexical-binding: t; -*- ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, ;; 2005, 2006, 2007, 2008, 2009, 2010, 2011 diff --git a/lisp/language/thai.el b/lisp/language/thai.el index 44a9a319330..be15db49db9 100644 --- a/lisp/language/thai.el +++ b/lisp/language/thai.el @@ -1,4 +1,4 @@ -;;; thai.el --- support for Thai -*- coding: utf-8 -*- +;;; thai.el --- support for Thai -*- coding: utf-8; lexical-binding: t; -*- ;; Copyright (C) 1997-1998, 2000-2021 Free Software Foundation, Inc. ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, diff --git a/lisp/language/tibetan.el b/lisp/language/tibetan.el index 5b8e29c2c7a..edd9d765b1e 100644 --- a/lisp/language/tibetan.el +++ b/lisp/language/tibetan.el @@ -1,4 +1,4 @@ -;;; tibetan.el --- support for Tibetan language -*- coding: utf-8-emacs; -*- +;;; tibetan.el --- support for Tibetan language -*- coding: utf-8-emacs; lexical-binding: t; -*- ;; Copyright (C) 1997, 2001-2021 Free Software Foundation, Inc. ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index c4eae686bd7..526491f0272 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -1,4 +1,4 @@ -;;; menu-bar.el --- define a default menu bar +;;; menu-bar.el --- define a default menu bar -*- lexical-binding: t; -*- ;; Copyright (C) 1993-1995, 2000-2021 Free Software Foundation, Inc. @@ -229,7 +229,8 @@ (filename (car (find-file-read-args "Find file: " mustmatch)))) (if mustmatch (find-file-existing filename) - (find-file filename)))) + (with-suppressed-warnings ((interactive-only find-file)) + (find-file filename))))) ;; The "Edit->Search" submenu (defvar menu-bar-last-search-type nil diff --git a/lisp/rfn-eshadow.el b/lisp/rfn-eshadow.el index f9842b52b13..378358feac2 100644 --- a/lisp/rfn-eshadow.el +++ b/lisp/rfn-eshadow.el @@ -1,4 +1,4 @@ -;;; rfn-eshadow.el --- Highlight `shadowed' part of read-file-name input text +;;; rfn-eshadow.el --- Highlight `shadowed' part of read-file-name input text -*- lexical-binding: t; -*- ;; ;; Copyright (C) 2000-2021 Free Software Foundation, Inc. ;; diff --git a/lisp/scroll-bar.el b/lisp/scroll-bar.el index 802cb3072fa..eecdb60f3a4 100644 --- a/lisp/scroll-bar.el +++ b/lisp/scroll-bar.el @@ -1,4 +1,4 @@ -;;; scroll-bar.el --- window system-independent scroll bar support +;;; scroll-bar.el --- window system-independent scroll bar support -*- lexical-binding: t; -*- ;; Copyright (C) 1993-1995, 1999-2021 Free Software Foundation, Inc. diff --git a/lisp/term/common-win.el b/lisp/term/common-win.el index 8d5cb191dd8..8ae58718e3f 100644 --- a/lisp/term/common-win.el +++ b/lisp/term/common-win.el @@ -1,4 +1,4 @@ -;;; common-win.el --- common part of handling window systems +;;; common-win.el --- common part of handling window systems -*- lexical-binding: t; -*- ;; Copyright (C) 1993-1994, 2001-2021 Free Software Foundation, Inc. diff --git a/lisp/term/tty-colors.el b/lisp/term/tty-colors.el index 1aeaffbbc01..740d0654a17 100644 --- a/lisp/term/tty-colors.el +++ b/lisp/term/tty-colors.el @@ -1,4 +1,4 @@ -;;; tty-colors.el --- color support for character terminals +;;; tty-colors.el --- color support for character terminals -*- lexical-binding: t; -*- ;; Copyright (C) 1999-2021 Free Software Foundation, Inc. diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el index e9bef6ec801..3346c551d93 100644 --- a/lisp/textmodes/fill.el +++ b/lisp/textmodes/fill.el @@ -1,4 +1,4 @@ -;;; fill.el --- fill commands for Emacs +;;; fill.el --- fill commands for Emacs -*- lexical-binding: t; -*- ;; Copyright (C) 1985-1986, 1992, 1994-1997, 1999, 2001-2021 Free ;; Software Foundation, Inc. @@ -40,13 +40,11 @@ Non-nil means changing indent doesn't end a paragraph. That mode can handle paragraphs with extra indentation on the first line, but it requires separator lines between paragraphs. A value of nil means that any change in indentation starts a new paragraph." - :type 'boolean - :group 'fill) + :type 'boolean) (defcustom colon-double-space nil "Non-nil means put two spaces after a colon when filling." - :type 'boolean - :group 'fill) + :type 'boolean) (put 'colon-double-space 'safe-local-variable 'booleanp) (defcustom fill-separate-heterogeneous-words-with-space nil @@ -56,7 +54,6 @@ the beginning of the next line when concatenating them for filling those lines. Whether to use a space depends on how the words are categorized." :type 'boolean - :group 'fill :version "26.1") (defvar fill-paragraph-function nil @@ -75,8 +72,7 @@ such as `fill-forward-paragraph-function'.") Kinsoku processing is designed to prevent certain characters from being placed at the beginning or end of a line by filling. See the documentation of `kinsoku' for more information." - :type 'boolean - :group 'fill) + :type 'boolean) (defun set-fill-prefix () "Set the fill prefix to the current line up to point. @@ -96,8 +92,7 @@ reinserts the fill prefix in each resulting line." (defcustom adaptive-fill-mode t "Non-nil means determine a paragraph's fill prefix from its text." - :type 'boolean - :group 'fill) + :type 'boolean) (defcustom adaptive-fill-regexp ;; Added `!' for doxygen comments starting with `//!' or `/*!'. @@ -113,8 +108,7 @@ standard indentation for the whole paragraph. If the paragraph has just one line, the indentation is taken from that line, but in that case `adaptive-fill-first-line-regexp' also plays a role." - :type 'regexp - :group 'fill) + :type 'regexp) (defcustom adaptive-fill-first-line-regexp (purecopy "\\`[ \t]*\\'") "Regexp specifying whether to set fill prefix from a one-line paragraph. @@ -126,15 +120,13 @@ By default, this regexp matches sequences of just spaces and tabs. However, we never use a prefix from a one-line paragraph if it would act as a paragraph-starter on the second line." - :type 'regexp - :group 'fill) + :type 'regexp) (defcustom adaptive-fill-function #'ignore "Function to call to choose a fill prefix for a paragraph. A nil return value means the function has not determined the fill prefix." :version "27.1" - :type 'function - :group 'fill) + :type 'function) (defvar fill-indent-according-to-mode nil ;Screws up CC-mode's filling tricks. "Whether or not filling should try to use the major mode's indentation.") @@ -367,15 +359,13 @@ which is an error according to some typographical conventions." The predicates are called with no arguments, with point at the place to be tested. If it returns a non-nil value, fill commands do not break the line there." - :group 'fill :type 'hook :options '(fill-french-nobreak-p fill-single-word-nobreak-p fill-single-char-nobreak-p)) (defcustom fill-nobreak-invisible nil "Non-nil means that fill commands do not break lines in invisible text." - :type 'boolean - :group 'fill) + :type 'boolean) (defun fill-nobreak-p () "Return nil if breaking the line at point is allowed. @@ -1110,8 +1100,7 @@ The `justification' text-property can locally override this variable." (const full) (const center) (const none)) - :safe 'symbolp - :group 'fill) + :safe 'symbolp) (make-variable-buffer-local 'default-justification) (defun current-justification () diff --git a/lisp/w32-fns.el b/lisp/w32-fns.el index 3da24c85c85..9ef2da737a4 100644 --- a/lisp/w32-fns.el +++ b/lisp/w32-fns.el @@ -1,4 +1,4 @@ -;;; w32-fns.el --- Lisp routines for 32-bit Windows +;;; w32-fns.el --- Lisp routines for 32-bit Windows -*- lexical-binding: t; -*- ;; Copyright (C) 1994, 2001-2021 Free Software Foundation, Inc. @@ -383,10 +383,10 @@ for any permissions. This is required because the Windows build environment is not required to include Sed, which is used by leim/Makefile.in to do the job." - (find-file orig) - (goto-char (point-max)) - (insert-file-contents extra) - (delete-matching-lines "^$\\|^;") - (save-buffers-kill-emacs t)) + (with-current-buffer (find-file-noselect orig) + (goto-char (point-max)) + (insert-file-contents extra) + (delete-matching-lines "^$\\|^;") + (save-buffers-kill-emacs t))) ;;; w32-fns.el ends here diff --git a/lisp/widget.el b/lisp/widget.el index de690ad225d..401b4cf298f 100644 --- a/lisp/widget.el +++ b/lisp/widget.el @@ -1,4 +1,4 @@ -;;; widget.el --- a library of user interface components +;;; widget.el --- a library of user interface components -*- lexical-binding: t; -*- ;; ;; Copyright (C) 1996-1997, 2001-2021 Free Software Foundation, Inc. ;; From d6f30e5632b1c9cf43ebfbdbf164d5c54be33475 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 4 Jan 2021 22:57:21 -0500 Subject: [PATCH 54/96] * lisp/subr.el (global-map): Initialize inside declaration. * src/commands.h (global_map): * src/keymap.c (global_map): Delete variable. (syms_of_keymap): Don't initialize global_map here. (keys_of_keymap): Delete function. * src/lisp.h (keys_of_cmds): * src/cmds.c (keys_of_cmds): Delete function. * src/emacs.c (main): Don't call them. * src/window.c (keys_of_window): Don't initialize global_map here. * src/keyboard.c (keys_of_keyboard): Don't initialize global_map here. --- lisp/subr.el | 36 +++++++++++++++++++++++++++++++----- src/cmds.c | 21 --------------------- src/commands.h | 1 - src/emacs.c | 2 -- src/keyboard.c | 2 -- src/keymap.c | 15 +-------------- src/keymap.h | 1 - src/lisp.h | 1 - src/window.c | 1 - 9 files changed, 32 insertions(+), 48 deletions(-) diff --git a/lisp/subr.el b/lisp/subr.el index 1acc3c3250b..6187f7ad3c4 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1242,11 +1242,6 @@ in a cleaner way with command remapping, like this: ;; global-map, esc-map, and ctl-x-map have their values set up in ;; keymap.c; we just give them docstrings here. -(defvar global-map nil - "Default global keymap mapping Emacs keyboard input into commands. -The value is a keymap that is usually (but not necessarily) Emacs's -global map.") - (defvar esc-map nil "Default keymap for ESC (meta) commands. The normal global definition of the character ESC indirects to this keymap.") @@ -1269,6 +1264,37 @@ The normal global definition of the character C-x indirects to this keymap.") "Keymap for tab-bar related commands.") (define-key ctl-x-map "t" tab-prefix-map) +(defvar global-map + (let ((map (make-keymap))) + (define-key map "\C-[" 'ESC-prefix) + (define-key map "\C-x" 'Control-X-prefix) + + (define-key map "\C-i" #'self-insert-command) + (let* ((vec1 (make-vector 1 nil)) + (f (lambda (from to) + (while (< from to) + (aset vec1 0 from) + (define-key map vec1 #'self-insert-command) + (setq from (1+ from)))))) + (funcall f #o040 #o0177) + (when (eq system-type 'ms-dos) ;FIXME: Why? + (funcall f #o0200 #o0240)) + (funcall f #o0240 #o0400)) + + (define-key map "\C-a" #'beginning-of-line) + (define-key map "\C-b" #'backward-char) + (define-key map "\C-e" #'end-of-line) + (define-key map "\C-f" #'forward-char) + (define-key map "\C-z" #'suspend-emacs) ;FIXME: Re-bound later! + + (define-key map "\C-v" #'scroll-up-command) + (define-key map "\C-]" #'abort-recursive-edit) + map) + "Default global keymap mapping Emacs keyboard input into commands. +The value is a keymap that is usually (but not necessarily) Emacs's +global map.") +(use-global-map global-map) + ;;;; Event manipulation functions. diff --git a/src/cmds.c b/src/cmds.c index 798fd68a920..1547db80e88 100644 --- a/src/cmds.c +++ b/src/cmds.c @@ -529,24 +529,3 @@ This is run after inserting the character. */); defsubr (&Sdelete_char); defsubr (&Sself_insert_command); } - -void -keys_of_cmds (void) -{ - int n; - - initial_define_key (global_map, Ctl ('I'), "self-insert-command"); - for (n = 040; n < 0177; n++) - initial_define_key (global_map, n, "self-insert-command"); -#ifdef MSDOS - for (n = 0200; n < 0240; n++) - initial_define_key (global_map, n, "self-insert-command"); -#endif - for (n = 0240; n < 0400; n++) - initial_define_key (global_map, n, "self-insert-command"); - - initial_define_key (global_map, Ctl ('A'), "beginning-of-line"); - initial_define_key (global_map, Ctl ('B'), "backward-char"); - initial_define_key (global_map, Ctl ('E'), "end-of-line"); - initial_define_key (global_map, Ctl ('F'), "forward-char"); -} diff --git a/src/commands.h b/src/commands.h index a09858d050d..be6f5823bcc 100644 --- a/src/commands.h +++ b/src/commands.h @@ -27,7 +27,6 @@ along with GNU Emacs. If not, see . */ calls to initial_define_key. These should *not* be used after initialization; use-global-map doesn't affect these; it sets current_global_map instead. */ -extern Lisp_Object global_map; extern Lisp_Object meta_map; extern Lisp_Object control_x_map; diff --git a/src/emacs.c b/src/emacs.c index fe8dcb1c476..3c293d85edd 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -1957,10 +1957,8 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem #endif keys_of_casefiddle (); - keys_of_cmds (); keys_of_buffer (); keys_of_keyboard (); - keys_of_keymap (); keys_of_window (); } else diff --git a/src/keyboard.c b/src/keyboard.c index cf15cd73572..52d913c537d 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -12388,10 +12388,8 @@ syms_of_keyboard_for_pdumper (void) void keys_of_keyboard (void) { - initial_define_key (global_map, Ctl ('Z'), "suspend-emacs"); initial_define_key (control_x_map, Ctl ('Z'), "suspend-emacs"); initial_define_key (meta_map, Ctl ('C'), "exit-recursive-edit"); - initial_define_key (global_map, Ctl (']'), "abort-recursive-edit"); initial_define_key (meta_map, 'x', "execute-extended-command"); initial_define_lispy_key (Vspecial_event_map, "delete-frame", diff --git a/src/keymap.c b/src/keymap.c index 1eeea81f627..772ced42ccd 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -59,8 +59,6 @@ along with GNU Emacs. If not, see . */ Lisp_Object current_global_map; /* Current global keymap. */ -Lisp_Object global_map; /* Default global key bindings. */ - Lisp_Object meta_map; /* The keymap used for globally bound ESC-prefixed default commands. */ @@ -3195,11 +3193,7 @@ syms_of_keymap (void) Each one is the value of a Lisp variable, and is also pointed to by a C variable */ - global_map = Fmake_keymap (Qnil); - Fset (intern_c_string ("global-map"), global_map); - - current_global_map = global_map; - staticpro (&global_map); + current_global_map = Qnil; staticpro (¤t_global_map); meta_map = Fmake_keymap (Qnil); @@ -3328,10 +3322,3 @@ be preferred. */); defsubr (&Swhere_is_internal); defsubr (&Sdescribe_buffer_bindings); } - -void -keys_of_keymap (void) -{ - initial_define_key (global_map, 033, "ESC-prefix"); - initial_define_key (global_map, Ctl ('X'), "Control-X-prefix"); -} diff --git a/src/keymap.h b/src/keymap.h index 072c09348e2..1967025dcb4 100644 --- a/src/keymap.h +++ b/src/keymap.h @@ -40,7 +40,6 @@ extern ptrdiff_t current_minor_maps (Lisp_Object **, Lisp_Object **); extern void initial_define_key (Lisp_Object, int, const char *); extern void initial_define_lispy_key (Lisp_Object, const char *, const char *); extern void syms_of_keymap (void); -extern void keys_of_keymap (void); typedef void (*map_keymap_function_t) (Lisp_Object key, Lisp_Object val, Lisp_Object args, void *data); diff --git a/src/lisp.h b/src/lisp.h index 5cc735be86c..d259e950dab 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3561,7 +3561,6 @@ extern void swap_in_global_binding (struct Lisp_Symbol *); /* Defined in cmds.c */ extern void syms_of_cmds (void); -extern void keys_of_cmds (void); /* Defined in coding.c. */ extern Lisp_Object detect_coding_system (const unsigned char *, ptrdiff_t, diff --git a/src/window.c b/src/window.c index ba8682eed7c..f2862a287d6 100644 --- a/src/window.c +++ b/src/window.c @@ -8590,7 +8590,6 @@ keys_of_window (void) initial_define_key (control_x_map, '<', "scroll-left"); initial_define_key (control_x_map, '>', "scroll-right"); - initial_define_key (global_map, Ctl ('V'), "scroll-up-command"); initial_define_key (meta_map, Ctl ('V'), "scroll-other-window"); initial_define_key (meta_map, 'v', "scroll-down-command"); } From 5bddc097385c1d9088748ed92abc2370857b2202 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 4 Jan 2021 23:11:07 -0500 Subject: [PATCH 55/96] * lisp/subr.el (ctl-x-map): Initialize inside the declaration. * src/command.h (control_x_map): * src/keymap.c (control_x_map): Delete variable. (syms_of_keymap): * src/keyboard.c (keys_of_keyboard): * src/casefiddle.c (keys_of_casefiddle): * src/window.c (keys_of_window): Move initialization of ctl-x-map to subr.el. * src/lisp.h (syms_of_buffer): * src/buffer.c (keys_of_buffer): Delete function. * src/emacs.c (main): Don't call it. --- lisp/subr.el | 29 ++++++++++++++++++++--------- src/buffer.c | 7 ------- src/casefiddle.c | 5 ----- src/commands.h | 1 - src/emacs.c | 1 - src/keyboard.c | 1 - src/keymap.c | 7 ------- src/lisp.h | 1 - src/window.c | 3 --- 9 files changed, 20 insertions(+), 35 deletions(-) diff --git a/lisp/subr.el b/lisp/subr.el index 6187f7ad3c4..206e71ac03b 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1246,23 +1246,34 @@ in a cleaner way with command remapping, like this: "Default keymap for ESC (meta) commands. The normal global definition of the character ESC indirects to this keymap.") -(defvar ctl-x-map nil - "Default keymap for C-x commands. -The normal global definition of the character C-x indirects to this keymap.") - (defvar ctl-x-4-map (make-sparse-keymap) "Keymap for subcommands of C-x 4.") (defalias 'ctl-x-4-prefix ctl-x-4-map) -(define-key ctl-x-map "4" 'ctl-x-4-prefix) (defvar ctl-x-5-map (make-sparse-keymap) "Keymap for frame commands.") (defalias 'ctl-x-5-prefix ctl-x-5-map) -(define-key ctl-x-map "5" 'ctl-x-5-prefix) (defvar tab-prefix-map (make-sparse-keymap) "Keymap for tab-bar related commands.") -(define-key ctl-x-map "t" tab-prefix-map) + +(defvar ctl-x-map + (let ((map (make-keymap))) + (define-key map "4" 'ctl-x-4-prefix) + (define-key map "5" 'ctl-x-5-prefix) + (define-key map "t" tab-prefix-map) + + (define-key map "b" #'switch-to-buffer) + (define-key map "l" #'kill-buffer) + (define-key map "\C-u" #'upcase-region) (put 'upcase-region 'disabled t) + (define-key map "\C-l" #'downcase-region) (put 'downcase-region 'disabled t) + (define-key map "<" #'scroll-left) + (define-key map ">" #'scroll-right) + map) + "Default keymap for C-x commands. +The normal global definition of the character C-x indirects to this keymap.") +(fset 'Control-X-prefix ctl-x-map) +(make-obsolete 'Control-X-prefix 'ctl-x-map "28.1") (defvar global-map (let ((map (make-keymap))) @@ -1285,8 +1296,8 @@ The normal global definition of the character C-x indirects to this keymap.") (define-key map "\C-b" #'backward-char) (define-key map "\C-e" #'end-of-line) (define-key map "\C-f" #'forward-char) - (define-key map "\C-z" #'suspend-emacs) ;FIXME: Re-bound later! - + (define-key map "\C-z" #'suspend-emacs) ;FIXME: Re-bound later! + (define-key map "\C-x\C-z" #'suspend-emacs) ;FIXME: Re-bound later! (define-key map "\C-v" #'scroll-up-command) (define-key map "\C-]" #'abort-recursive-edit) map) diff --git a/src/buffer.c b/src/buffer.c index 0a7ff6e6752..71ad5edd527 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -6380,10 +6380,3 @@ nil NORECORD argument since it may lead to infinite recursion. */); Fput (intern_c_string ("erase-buffer"), Qdisabled, Qt); } - -void -keys_of_buffer (void) -{ - initial_define_key (control_x_map, 'b', "switch-to-buffer"); - initial_define_key (control_x_map, 'k', "kill-buffer"); -} diff --git a/src/casefiddle.c b/src/casefiddle.c index a948bb3bc88..42de9722ecd 100644 --- a/src/casefiddle.c +++ b/src/casefiddle.c @@ -686,11 +686,6 @@ Called with one argument METHOD which can be: void keys_of_casefiddle (void) { - initial_define_key (control_x_map, Ctl ('U'), "upcase-region"); - Fput (intern ("upcase-region"), Qdisabled, Qt); - initial_define_key (control_x_map, Ctl ('L'), "downcase-region"); - Fput (intern ("downcase-region"), Qdisabled, Qt); - initial_define_key (meta_map, 'u', "upcase-word"); initial_define_key (meta_map, 'l', "downcase-word"); initial_define_key (meta_map, 'c', "capitalize-word"); diff --git a/src/commands.h b/src/commands.h index be6f5823bcc..8f9c76b1e2d 100644 --- a/src/commands.h +++ b/src/commands.h @@ -28,7 +28,6 @@ along with GNU Emacs. If not, see . */ initialization; use-global-map doesn't affect these; it sets current_global_map instead. */ extern Lisp_Object meta_map; -extern Lisp_Object control_x_map; /* If not Qnil, this is a switch-frame event which we decided to put off until the end of a key sequence. This should be read as the diff --git a/src/emacs.c b/src/emacs.c index 3c293d85edd..18b54dd07ef 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -1957,7 +1957,6 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem #endif keys_of_casefiddle (); - keys_of_buffer (); keys_of_keyboard (); keys_of_window (); } diff --git a/src/keyboard.c b/src/keyboard.c index 52d913c537d..bb4d981fe59 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -12388,7 +12388,6 @@ syms_of_keyboard_for_pdumper (void) void keys_of_keyboard (void) { - initial_define_key (control_x_map, Ctl ('Z'), "suspend-emacs"); initial_define_key (meta_map, Ctl ('C'), "exit-recursive-edit"); initial_define_key (meta_map, 'x', "execute-extended-command"); diff --git a/src/keymap.c b/src/keymap.c index 772ced42ccd..171f9460412 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -62,9 +62,6 @@ Lisp_Object current_global_map; /* Current global keymap. */ Lisp_Object meta_map; /* The keymap used for globally bound ESC-prefixed default commands. */ -Lisp_Object control_x_map; /* The keymap used for globally bound - C-x-prefixed default commands. */ - /* The keymap used by the minibuf for local bindings when spaces are allowed in the minibuf. */ @@ -3200,10 +3197,6 @@ syms_of_keymap (void) Fset (intern_c_string ("esc-map"), meta_map); Ffset (intern_c_string ("ESC-prefix"), meta_map); - control_x_map = Fmake_keymap (Qnil); - Fset (intern_c_string ("ctl-x-map"), control_x_map); - Ffset (intern_c_string ("Control-X-prefix"), control_x_map); - exclude_keys = pure_list (pure_cons (build_pure_c_string ("DEL"), build_pure_c_string ("\\d")), pure_cons (build_pure_c_string ("TAB"), build_pure_c_string ("\\t")), diff --git a/src/lisp.h b/src/lisp.h index d259e950dab..915ad64f6e1 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -4261,7 +4261,6 @@ extern Lisp_Object get_truename_buffer (Lisp_Object); extern void init_buffer_once (void); extern void init_buffer (void); extern void syms_of_buffer (void); -extern void keys_of_buffer (void); /* Defined in marker.c. */ diff --git a/src/window.c b/src/window.c index f2862a287d6..29d499ccd45 100644 --- a/src/window.c +++ b/src/window.c @@ -8587,9 +8587,6 @@ displayed after a scrolling operation to be somewhat inaccurate. */); void keys_of_window (void) { - initial_define_key (control_x_map, '<', "scroll-left"); - initial_define_key (control_x_map, '>', "scroll-right"); - initial_define_key (meta_map, Ctl ('V'), "scroll-other-window"); initial_define_key (meta_map, 'v', "scroll-down-command"); } From 8ef4314c44a046e92bcd7dddde26203a9d641f09 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 4 Jan 2021 23:20:44 -0500 Subject: [PATCH 56/96] * lisp/subr.el (esc-map): Initialize inside declaration * src/commands.h (meta_map): * src/keymap.c (meta_map): Delete variable. (syms_of_keymap): Don't initialize esc-map here. (initial_define_key): * src/keymap.h (initial_define_key): Delete function. * src/keyboard.c (keys_of_keyboard): Don't initialize esc-map here. * src/window.h (keys_of_window): * src/window.c (keys_of_window): Delete function. * src/lisp.h (keys_of_casefiddle): * src/casefiddle.c (keys_of_casefiddle): Delete function. * src/emacs.c (main): Don't call them. --- lisp/subr.el | 22 ++++++++++++++++++---- src/casefiddle.c | 8 -------- src/commands.h | 6 ------ src/emacs.c | 2 -- src/keyboard.c | 3 --- src/keymap.c | 28 ---------------------------- src/keymap.h | 1 - src/lisp.h | 1 - src/window.c | 7 ------- src/window.h | 1 - 10 files changed, 18 insertions(+), 61 deletions(-) diff --git a/lisp/subr.el b/lisp/subr.el index 206e71ac03b..60a77859c43 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1242,9 +1242,17 @@ in a cleaner way with command remapping, like this: ;; global-map, esc-map, and ctl-x-map have their values set up in ;; keymap.c; we just give them docstrings here. -(defvar esc-map nil +(defvar esc-map + (let ((map (make-keymap))) + (define-key map "u" #'upcase-word) + (define-key map "l" #'downcase-word) + (define-key map "c" #'capitalize-word) + (define-key map "x" #'execute-extended-command) + map) "Default keymap for ESC (meta) commands. The normal global definition of the character ESC indirects to this keymap.") +(fset 'ESC-prefix esc-map) +(make-obsolete 'ESC-prefix 'esc-map "28.1") (defvar ctl-x-4-map (make-sparse-keymap) "Keymap for subcommands of C-x 4.") @@ -1273,7 +1281,7 @@ The normal global definition of the character ESC indirects to this keymap.") "Default keymap for C-x commands. The normal global definition of the character C-x indirects to this keymap.") (fset 'Control-X-prefix ctl-x-map) -(make-obsolete 'Control-X-prefix 'ctl-x-map "28.1") +(make-obsolete 'Control-X-prefix 'ctl-x-map "28.1") (defvar global-map (let ((map (make-keymap))) @@ -1296,10 +1304,16 @@ The normal global definition of the character C-x indirects to this keymap.") (define-key map "\C-b" #'backward-char) (define-key map "\C-e" #'end-of-line) (define-key map "\C-f" #'forward-char) + (define-key map "\C-z" #'suspend-emacs) ;FIXME: Re-bound later! (define-key map "\C-x\C-z" #'suspend-emacs) ;FIXME: Re-bound later! - (define-key map "\C-v" #'scroll-up-command) - (define-key map "\C-]" #'abort-recursive-edit) + + (define-key map "\C-v" #'scroll-up-command) + (define-key map "\M-v" #'scroll-down-command) + (define-key map "\M-\C-v" #'scroll-other-window) + + (define-key map "\M-\C-c" #'exit-recursive-edit) + (define-key map "\C-]" #'abort-recursive-edit) map) "Default global keymap mapping Emacs keyboard input into commands. The value is a keymap that is usually (but not necessarily) Emacs's diff --git a/src/casefiddle.c b/src/casefiddle.c index 42de9722ecd..a7a25414909 100644 --- a/src/casefiddle.c +++ b/src/casefiddle.c @@ -682,11 +682,3 @@ Called with one argument METHOD which can be: defsubr (&Sdowncase_word); defsubr (&Scapitalize_word); } - -void -keys_of_casefiddle (void) -{ - initial_define_key (meta_map, 'u', "upcase-word"); - initial_define_key (meta_map, 'l', "downcase-word"); - initial_define_key (meta_map, 'c', "capitalize-word"); -} diff --git a/src/commands.h b/src/commands.h index 8f9c76b1e2d..2205ebf7d39 100644 --- a/src/commands.h +++ b/src/commands.h @@ -23,12 +23,6 @@ along with GNU Emacs. If not, see . */ #define Ctl(c) ((c)&037) -/* Define the names of keymaps, just so people can refer to them in - calls to initial_define_key. These should *not* be used after - initialization; use-global-map doesn't affect these; it sets - current_global_map instead. */ -extern Lisp_Object meta_map; - /* If not Qnil, this is a switch-frame event which we decided to put off until the end of a key sequence. This should be read as the next command input, after any Vunread_command_events. diff --git a/src/emacs.c b/src/emacs.c index 18b54dd07ef..69d10821fae 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -1956,9 +1956,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem syms_of_json (); #endif - keys_of_casefiddle (); keys_of_keyboard (); - keys_of_window (); } else { diff --git a/src/keyboard.c b/src/keyboard.c index bb4d981fe59..9ee4c4f6d68 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -12388,9 +12388,6 @@ syms_of_keyboard_for_pdumper (void) void keys_of_keyboard (void) { - initial_define_key (meta_map, Ctl ('C'), "exit-recursive-edit"); - initial_define_key (meta_map, 'x', "execute-extended-command"); - initial_define_lispy_key (Vspecial_event_map, "delete-frame", "handle-delete-frame"); #ifdef HAVE_NTGUI diff --git a/src/keymap.c b/src/keymap.c index 171f9460412..37270f5782b 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -59,17 +59,6 @@ along with GNU Emacs. If not, see . */ Lisp_Object current_global_map; /* Current global keymap. */ -Lisp_Object meta_map; /* The keymap used for globally bound - ESC-prefixed default commands. */ - - /* The keymap used by the minibuf for local - bindings when spaces are allowed in the - minibuf. */ - - /* The keymap used by the minibuf for local - bindings when spaces are not encouraged - in the minibuf. */ - /* Alist of elements like (DEL . "\d"). */ static Lisp_Object exclude_keys; @@ -135,19 +124,6 @@ in case you use it as a menu with `x-popup-menu'. */) return list1 (Qkeymap); } -/* This function is used for installing the standard key bindings - at initialization time. - - For example: - - initial_define_key (control_x_map, Ctl('X'), "exchange-point-and-mark"); */ - -void -initial_define_key (Lisp_Object keymap, int key, const char *defname) -{ - store_in_keymap (keymap, make_fixnum (key), intern_c_string (defname)); -} - void initial_define_lispy_key (Lisp_Object keymap, const char *keyname, const char *defname) { @@ -3193,10 +3169,6 @@ syms_of_keymap (void) current_global_map = Qnil; staticpro (¤t_global_map); - meta_map = Fmake_keymap (Qnil); - Fset (intern_c_string ("esc-map"), meta_map); - Ffset (intern_c_string ("ESC-prefix"), meta_map); - exclude_keys = pure_list (pure_cons (build_pure_c_string ("DEL"), build_pure_c_string ("\\d")), pure_cons (build_pure_c_string ("TAB"), build_pure_c_string ("\\t")), diff --git a/src/keymap.h b/src/keymap.h index 1967025dcb4..f417301c8f2 100644 --- a/src/keymap.h +++ b/src/keymap.h @@ -37,7 +37,6 @@ extern char *push_key_description (EMACS_INT, char *); extern Lisp_Object access_keymap (Lisp_Object, Lisp_Object, bool, bool, bool); extern Lisp_Object get_keymap (Lisp_Object, bool, bool); extern ptrdiff_t current_minor_maps (Lisp_Object **, Lisp_Object **); -extern void initial_define_key (Lisp_Object, int, const char *); extern void initial_define_lispy_key (Lisp_Object, const char *, const char *); extern void syms_of_keymap (void); diff --git a/src/lisp.h b/src/lisp.h index 915ad64f6e1..ca0eb51c061 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -4357,7 +4357,6 @@ extern void syms_of_callint (void); /* Defined in casefiddle.c. */ extern void syms_of_casefiddle (void); -extern void keys_of_casefiddle (void); /* Defined in casetab.c. */ diff --git a/src/window.c b/src/window.c index 29d499ccd45..58204c13e44 100644 --- a/src/window.c +++ b/src/window.c @@ -8583,10 +8583,3 @@ displayed after a scrolling operation to be somewhat inaccurate. */); defsubr (&Swindow_parameter); defsubr (&Sset_window_parameter); } - -void -keys_of_window (void) -{ - initial_define_key (meta_map, Ctl ('V'), "scroll-other-window"); - initial_define_key (meta_map, 'v', "scroll-down-command"); -} diff --git a/src/window.h b/src/window.h index 1f94fc0252f..332cb3091fd 100644 --- a/src/window.h +++ b/src/window.h @@ -1202,7 +1202,6 @@ extern bool window_outdated (struct window *); extern void init_window_once (void); extern void init_window (void); extern void syms_of_window (void); -extern void keys_of_window (void); /* Move cursor to row/column position VPOS/HPOS, pixel coordinates Y/X. HPOS/VPOS are window-relative row and column numbers and X/Y are window-relative pixel positions. This is always done during From 06810abc591fb40450bcf448d584316d26e8e98b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20J=C3=B6rg?= Date: Tue, 5 Jan 2021 10:15:04 +0100 Subject: [PATCH 57/96] perl-mode: Display here-docs as strings instead of comments * lisp/progmodes/perl-mode.el (perl-syntax-propertize-function): Handle HERE doc starter lines ending in a comment. (perl-heredoc): New face for HERE docs, inheriting from font-lock-string-face. (perl-font-lock-syntactic-face-function): Apply the new face to HERE docs (Bug#23461). * test/lisp/progmodes/cperl-mode-tests.el (cperl-test--run-bug-10483): Skip for Perl mode. The test explicitly calls a function of CPerl mode. --- etc/NEWS | 3 + lisp/progmodes/perl-mode.el | 29 +++- .../cperl-mode-resources/here-docs.pl | 143 ++++++++++++++++++ test/lisp/progmodes/cperl-mode-tests.el | 32 ++++ 4 files changed, 206 insertions(+), 1 deletion(-) create mode 100644 test/lisp/progmodes/cperl-mode-resources/here-docs.pl diff --git a/etc/NEWS b/etc/NEWS index d8f25ab362e..ef1c4b39a6f 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1833,6 +1833,9 @@ also keep the type information of their arguments. Use the ** CPerl Mode +--- +*** New face 'perl-heredoc', used for heredoc elements. + --- *** The command 'cperl-set-style' offers the new value "PBP". This value customizes Emacs to use the style recommended in Damian diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el index ec20b01a0f0..2a2a4978c62 100644 --- a/lisp/progmodes/perl-mode.el +++ b/lisp/progmodes/perl-mode.el @@ -324,13 +324,33 @@ ;; disambiguate with the left-bitshift operator. "\\|" perl--syntax-exp-intro-regexp "<<\\(?2:\\sw+\\)\\)" ".*\\(\n\\)") - (4 (let* ((st (get-text-property (match-beginning 4) 'syntax-table)) + (4 (let* ((eol (match-beginning 4)) + (st (get-text-property eol 'syntax-table)) (name (match-string 2)) (indented (match-beginning 1))) (goto-char (match-end 2)) (if (save-excursion (nth 8 (syntax-ppss (match-beginning 0)))) + ;; '<<' occurred in a string, or in a comment. ;; Leave the property of the newline unchanged. st + ;; Beware of `foo <<'BAR' #baz` because + ;; the newline needs to start the here-doc + ;; and can't be used to close the comment. + (let ((eol-state (save-excursion (syntax-ppss eol)))) + (when (nth 4 eol-state) + (if (/= (1- eol) (nth 8 eol-state)) + ;; make the last char of the comment closing it + (put-text-property (1- eol) eol + 'syntax-table (string-to-syntax ">")) + ;; In `foo <<'BAR' #` the # is the last character + ;; before eol and can't both open and close the + ;; comment. Workaround: disguise the "#" as + ;; whitespace and fontify it as a comment. + (put-text-property (1- eol) eol + 'syntax-table (string-to-syntax "-")) + (put-text-property (1- eol) eol + 'font-lock-face + 'font-lock-comment-face)))) (cons (car (string-to-syntax "< c")) ;; Remember the names of heredocs found on this line. (cons (cons (pcase (aref name 0) @@ -483,8 +503,15 @@ ;; as twoarg). (perl-syntax-propertize-special-constructs limit))))))))) +(defface perl-heredoc + '((t (:inherit font-lock-string-face))) + "The face for here-documents. Inherits from font-lock-string-face.") + (defun perl-font-lock-syntactic-face-function (state) (cond + ((and (eq 2 (nth 7 state)) ; c-style comment + (cdr-safe (get-text-property (nth 8 state) 'syntax-table))) ; HERE doc + 'perl-heredoc) ((and (nth 3 state) (eq ?e (cdr-safe (get-text-property (nth 8 state) 'syntax-table))) ;; This is a second-arg of s{..}{...} form; let's check if this second diff --git a/test/lisp/progmodes/cperl-mode-resources/here-docs.pl b/test/lisp/progmodes/cperl-mode-resources/here-docs.pl new file mode 100644 index 00000000000..8af4625fff3 --- /dev/null +++ b/test/lisp/progmodes/cperl-mode-resources/here-docs.pl @@ -0,0 +1,143 @@ +use 5.020; + +=head1 NAME + +here-docs.pl - resource file for cperl-test-here-docs + +=head1 DESCRIPTION + +This file holds a couple of HERE documents, with a variety of normal +and edge cases. For a formatted view of this description, run: + + (cperl-perldoc "here-docs.pl") + +For each of the HERE documents, the following checks will done: + +=over 4 + +=item * + +All occurrences of the string "look-here" are fontified correcty. +Note that we deliberately test the face, not the syntax property: +Users won't care for the syntax property, but they see the face. +Different implementations with different syntax properties have been +seen in the past. + +=item * + +Indentation of the line(s) containing "look-here" is 0, i.e. there are no +leading spaces. + +=item * + +Indentation of the following perl statement containing "indent" should +be 0 if the statement contains "noindent", and according to the mode's +continued-statement-offset otherwise. + +=back + +=cut + +# Prologue to make the test file valid without warnings + +my $text; +my $any; +my $indentation; +my $anywhere = 'back again'; +my $noindent; + +=head1 The Tests + +=head2 Test Case 1 + +We have two HERE documents in one line with different quoting styles. + +=cut + +## test case + +$text = <<"HERE" . <<'THERE' . $any; +#look-here and +HERE +$tlook-here and +THERE + +$noindent = "This should be left-justified"; + +=head2 Test case 2 + +A HERE document followed by a continuation line + +=cut + +## test case + +$text = < Date: Tue, 5 Jan 2021 10:27:36 +0100 Subject: [PATCH 58/96] * lisp/filesets.el (filesets-external-viewers): Tighten regexp. --- lisp/filesets.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/filesets.el b/lisp/filesets.el index 661a93edf19..2ef13ae8320 100644 --- a/lisp/filesets.el +++ b/lisp/filesets.el @@ -588,7 +588,7 @@ the filename." (:ignore-on-read-text t) ;; (:constraintp ,pdf-cmd) )) - (".\\.e?ps\\(.gz\\)?\\'" ,ps-cmd + (".\\.e?ps\\(?:\\.gz\\)?\\'" ,ps-cmd ((:ignore-on-open-all t) (:ignore-on-read-text t) ;; (:constraintp ,ps-cmd) From 7f16f177270e8e69cb8b78fb502caae3653a32cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= Date: Tue, 29 Dec 2020 16:55:06 +0100 Subject: [PATCH 59/96] Pretty-print keys without <> around modifiers (bug#45536) Be consistent when pretty-printing keys: put modifiers outside <>, thus the more logical C-M- instead of . * src/keymap.c (Fsingle_key_description): Skip modifier prefix before adding <>. * doc/lispref/help.texi (Describing Characters): Update example. * doc/lispref/debugging.texi (Backtraces): * doc/lispref/minibuf.texi (Text from Minibuffer): Use @kbd instead of @key. * etc/NEWS: Announce the change. * test/src/keymap-tests.el (keymap--key-description): * test/lisp/subr-tests.el (subr--kbd): New tests. --- doc/lispref/debugging.texi | 2 +- doc/lispref/help.texi | 2 +- doc/lispref/minibuf.texi | 2 +- etc/NEWS | 7 +++++++ src/keymap.c | 20 +++++++++++++++----- test/lisp/subr-tests.el | 8 ++++++++ test/src/keymap-tests.el | 12 ++++++++++++ 7 files changed, 45 insertions(+), 8 deletions(-) diff --git a/doc/lispref/debugging.texi b/doc/lispref/debugging.texi index 1e779ac7054..8e4b0ebfe96 100644 --- a/doc/lispref/debugging.texi +++ b/doc/lispref/debugging.texi @@ -424,7 +424,7 @@ move to it and type @key{RET}, to visit the source code. You can also type @key{RET} while point is on any name of a function or variable which is not underlined, to see help information for that symbol in a help buffer, if any exists. The @code{xref-find-definitions} command, -bound to @key{M-.}, can also be used on any identifier in a backtrace +bound to @kbd{M-.}, can also be used on any identifier in a backtrace (@pxref{Looking Up Identifiers,,,emacs, The GNU Emacs Manual}). In backtraces, the tails of long lists and the ends of long strings, diff --git a/doc/lispref/help.texi b/doc/lispref/help.texi index 2fd05b73917..298bec5230c 100644 --- a/doc/lispref/help.texi +++ b/doc/lispref/help.texi @@ -545,7 +545,7 @@ brackets. @end group @group (single-key-description 'C-mouse-1) - @result{} "" + @result{} "C-" @end group @group (single-key-description 'C-mouse-1 t) diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index 81139b9e746..f0036f0ccfc 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi @@ -348,7 +348,7 @@ default, it makes the following bindings: @item @key{RET} @code{exit-minibuffer} -@item @key{M-<} +@item @kbd{M-<} @code{minibuffer-beginning-of-buffer} @item @kbd{C-g} diff --git a/etc/NEWS b/etc/NEWS index ef1c4b39a6f..d1cc422e9f7 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -218,6 +218,13 @@ and other "slow scrolling" situations. It is hoped it behaves better than 'fast-but-imprecise-scrolling' and 'jit-lock-defer-time'. It is not enabled by default. ++++ +** Modifiers now go outside angle brackets in pretty-printed key bindings. +For example, with Control and Meta modifiers is now shown as +C-M- instead of . Either variant can be used as +input; functions such as 'kbd' and 'read-kbd-macro' accept both styles +as equivalent (they have done so for a long time). + * Editing Changes in Emacs 28.1 diff --git a/src/keymap.c b/src/keymap.c index 37270f5782b..3d1993869bc 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -2188,11 +2188,21 @@ See `text-char-description' for describing character codes. */) { if (NILP (no_angles)) { - Lisp_Object result; - char *buffer = SAFE_ALLOCA (sizeof "<>" - + SBYTES (SYMBOL_NAME (key))); - esprintf (buffer, "<%s>", SDATA (SYMBOL_NAME (key))); - result = build_string (buffer); + Lisp_Object namestr = SYMBOL_NAME (key); + const char *sym = SSDATA (namestr); + ptrdiff_t len = SBYTES (namestr); + /* Find the extent of the modifier prefix, like "C-M-". */ + int i = 0; + while (i < len - 3 && sym[i + 1] == '-' && strchr ("CMSsHA", sym[i])) + i += 2; + /* First I bytes of SYM are modifiers; put <> around the rest. */ + char *buffer = SAFE_ALLOCA (len + 3); + memcpy (buffer, sym, i); + buffer[i] = '<'; + memcpy (buffer + i + 1, sym + i, len - i); + buffer [len + 1] = '>'; + buffer [len + 2] = '\0'; + Lisp_Object result = build_string (buffer); SAFE_FREE (); return result; } diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index 2f5b38d05d9..8d19a268773 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el @@ -630,5 +630,13 @@ See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19350." (should (>= (length (apropos-internal "^help" #'commandp)) 15)) (should-not (apropos-internal "^next-line$" #'keymapp))) +(ert-deftest subr--kbd () + ;; Check that kbd handles both new and old style key descriptions + ;; (bug#45536). + (should (equal (kbd "s-") [s-return])) + (should (equal (kbd "") [s-return])) + (should (equal (kbd "C-M-") [C-M-return])) + (should (equal (kbd "") [C-M-return]))) + (provide 'subr-tests) ;;; subr-tests.el ends here diff --git a/test/src/keymap-tests.el b/test/src/keymap-tests.el index 74fb3c892db..d4f5fc3f190 100644 --- a/test/src/keymap-tests.el +++ b/test/src/keymap-tests.el @@ -248,6 +248,18 @@ g .. h foo 0 .. 3 foo "))))) +(ert-deftest keymap--key-description () + (should (equal (key-description [right] [?\C-x]) + "C-x ")) + (should (equal (key-description [M-H-right] [?\C-x]) + "C-x M-H-")) + (should (equal (single-key-description 'home) + "")) + (should (equal (single-key-description 'home t) + "home")) + (should (equal (single-key-description 'C-s-home) + "C-s-"))) + (provide 'keymap-tests) ;;; keymap-tests.el ends here From 77796eb0142f5d9b616f59f271ef380f099f1cac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= Date: Tue, 5 Jan 2021 11:27:41 +0100 Subject: [PATCH 60/96] ; * lisp/subr.el (ctl-x-map): Fix typo in kill-buffer binding. --- lisp/subr.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/subr.el b/lisp/subr.el index 60a77859c43..50acbd27905 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1272,7 +1272,7 @@ The normal global definition of the character ESC indirects to this keymap.") (define-key map "t" tab-prefix-map) (define-key map "b" #'switch-to-buffer) - (define-key map "l" #'kill-buffer) + (define-key map "k" #'kill-buffer) (define-key map "\C-u" #'upcase-region) (put 'upcase-region 'disabled t) (define-key map "\C-l" #'downcase-region) (put 'downcase-region 'disabled t) (define-key map "<" #'scroll-left) From 1433a1201447f6f8b610f4d7f78a4b8a739c6572 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= Date: Tue, 5 Jan 2021 12:01:32 +0100 Subject: [PATCH 61/96] ruby-mode: eliminate redundant regexp branch * lisp/progmodes/ruby-mode.el (ruby-add-log-current-method): Since ruby-operator-re matches dot, don't include both in regexp. This pacifies relint. --- lisp/progmodes/ruby-mode.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index cd9d087856c..a8667acb9d5 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -1603,9 +1603,9 @@ See `add-log-current-defun-function'." "\\(" ;; \\. and :: for class methods "\\([A-Za-z_]" ruby-symbol-re "*[?!]?" - (when method-name? "\\|") - (when method-name? ruby-operator-re) - "\\|\\.\\|::" "\\)" + "\\|" + (if method-name? ruby-operator-re "\\.") + "\\|::" "\\)" "+\\)"))) (definition-re (funcall make-definition-re ruby-defun-beg-re t)) (module-re (funcall make-definition-re "\\(class\\|module\\)"))) From 9973019764250ac1f4d77a6b426cdd9c241151c5 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 5 Jan 2021 12:28:37 -0500 Subject: [PATCH 62/96] * lisp/emacs-lisp/package.el: Load package-quickstart without package.el Speed up startup when `package-quickstart` is in use by making it possible to load the quickstart file without having to load `package.el` at all. (package-user-dir, package-directory-list, package-quickstart-file): Preload those variables. (package--get-activatable-pkg): New fun, extracted from `package-activate`. (package-activate): Use it. (package--activate-all): New function, extracted from `package-activate-all`. (package-activate-all): Use it and make the function preloaded. (package--archives-initialize): New function. (package-install): Use it. (list-packages): Avoid `switch-to-buffer`. (package-get-descriptor): New function. * lisp/startup.el (command-line): Simplify the code now that package-user-dir and package-directory-list are preloaded. * lisp/emacs-lisp/autoload.el (make-autoload): Add support for `:initialize #'custom-initialize-delay` in `defcustom`. --- lisp/emacs-lisp/autoload.el | 8 +++- lisp/emacs-lisp/package.el | 90 ++++++++++++++++++++++++------------- lisp/startup.el | 12 +---- 3 files changed, 68 insertions(+), 42 deletions(-) diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el index 1786b5cd6a8..77de05a6f68 100644 --- a/lisp/emacs-lisp/autoload.el +++ b/lisp/emacs-lisp/autoload.el @@ -221,12 +221,18 @@ expression, in which case we want to handle forms differently." ;; Convert defcustom to less space-consuming data. ((eq car 'defcustom) (let ((varname (car-safe (cdr-safe form))) + (initializer (plist-get (nthcdr 4 form) :initialize)) (init (car-safe (cdr-safe (cdr-safe form)))) (doc (car-safe (cdr-safe (cdr-safe (cdr-safe form))))) ;; (rest (cdr-safe (cdr-safe (cdr-safe (cdr-safe form))))) ) `(progn - (defvar ,varname ,init ,doc) + ,(if (null initializer) + `(defvar ,varname ,init ,doc) + `(progn (defvar ,varname nil ,doc) + (let ((exp ',init)) + (put ',varname 'standard-value (list exp)) + (,(eval initializer t) ',varname exp)))) (custom-autoload ',varname ,file ,(condition-case nil (null (cadr (memq :set form))) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 40ba1355513..a38363df23e 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -173,12 +173,12 @@ with \"-q\"). Even if the value is nil, you can type \\[package-initialize] to make installed packages available at any time, or you can -call (package-initialize) in your init-file." +call (package-activate-all) in your init-file." :type 'boolean :version "24.1") (defcustom package-load-list '(all) - "List of packages for `package-initialize' to make available. + "List of packages for `package-activate-all' to make available. Each element in this list should be a list (NAME VERSION), or the symbol `all'. The symbol `all' says to make available the latest installed versions of all packages not specified by other @@ -292,15 +292,18 @@ the package will be unavailable." :risky t :version "24.4") +;;;###autoload (defcustom package-user-dir (locate-user-emacs-file "elpa") "Directory containing the user's Emacs Lisp packages. The directory name should be absolute. Apart from this directory, Emacs also looks for system-wide packages in `package-directory-list'." :type 'directory + :initialize #'custom-initialize-delay :risky t :version "24.1") +;;;###autoload (defcustom package-directory-list ;; Defaults are subdirs named "elpa" in the site-lisp dirs. (let (result) @@ -315,6 +318,7 @@ Each directory name should be absolute. These directories contain packages intended for system-wide; in contrast, `package-user-dir' contains packages for personal use." :type '(repeat directory) + :initialize #'custom-initialize-delay :risky t :version "24.1") @@ -587,9 +591,8 @@ package." ;;; Installed packages ;; The following variables store information about packages present in ;; the system. The most important of these is `package-alist'. The -;; command `package-initialize' is also closely related to this -;; section, but it is left for a later section because it also affects -;; other stuff. +;; command `package-activate-all' is also closely related to this +;; section. (defvar package--builtins nil "Alist of built-in packages. @@ -608,7 +611,7 @@ name (a symbol) and DESCS is a non-empty list of `package-desc' structures, sorted by decreasing versions. This variable is set automatically by `package-load-descriptor', -called via `package-initialize'. To change which packages are +called via `package-activate-all'. To change which packages are loaded and/or activated, customize `package-load-list'.") (put 'package-alist 'risky-local-variable t) @@ -869,6 +872,20 @@ DIR, sorted by most recently loaded last." (lambda (x y) (< (cdr x) (cdr y)))))))) ;;;; `package-activate' + +(defun package--get-activatable-pkg (pkg-name) + ;; Is "activatable" a word? + (let ((pkg-descs (cdr (assq pkg-name package-alist)))) + ;; Check if PACKAGE is available in `package-alist'. + (while + (when pkg-descs + (let ((available-version (package-desc-version (car pkg-descs)))) + (or (package-disabled-p pkg-name available-version) + ;; Prefer a builtin package. + (package-built-in-p pkg-name available-version)))) + (setq pkg-descs (cdr pkg-descs))) + (car pkg-descs))) + ;; This function activates a newer version of a package if an older ;; one was already activated. It also loads a features of this ;; package which were already loaded. @@ -876,24 +893,16 @@ DIR, sorted by most recently loaded last." "Activate the package named PACKAGE. If FORCE is true, (re-)activate it if it's already activated. Newer versions are always activated, regardless of FORCE." - (let ((pkg-descs (cdr (assq package package-alist)))) - ;; Check if PACKAGE is available in `package-alist'. - (while - (when pkg-descs - (let ((available-version (package-desc-version (car pkg-descs)))) - (or (package-disabled-p package available-version) - ;; Prefer a builtin package. - (package-built-in-p package available-version)))) - (setq pkg-descs (cdr pkg-descs))) + (let ((pkg-desc (package--get-activatable-pkg package))) (cond ;; If no such package is found, maybe it's built-in. - ((null pkg-descs) + ((null pkg-desc) (package-built-in-p package)) ;; If the package is already activated, just return t. ((and (memq package package-activated-list) (not force)) t) ;; Otherwise, proceed with activation. - (t (package-activate-1 (car pkg-descs) nil 'deps))))) + (t (package-activate-1 pkg-desc nil 'deps))))) ;;; Installation -- Local operations @@ -1616,9 +1625,8 @@ that code in the early init-file." ;; `package--initialized' is t. (package--build-compatibility-table)) -(defvar package-quickstart-file) - ;;;###autoload +(progn ;; Make the function usable without loading `package.el'. (defun package-activate-all () "Activate all installed packages. The variable `package-load-list' controls which packages to load." @@ -1633,12 +1641,16 @@ The variable `package-load-list' controls which packages to load." ;; save this file so it doesn't need any decoding). (let ((load-source-file-function nil)) (load qs nil 'nomessage)) - (dolist (elt (package--alist)) - (condition-case err - (package-activate (car elt)) - ;; Don't let failure of activation of a package arbitrarily stop - ;; activation of further packages. - (error (message "%s" (error-message-string err)))))))) + (require 'package) + (package--activate-all))))) + +(defun package--activate-all () + (dolist (elt (package--alist)) + (condition-case err + (package-activate (car elt)) + ;; Don't let failure of activation of a package arbitrarily stop + ;; activation of further packages. + (error (message "%s" (error-message-string err)))))) ;;;; Populating `package-archive-contents' from archives ;; This subsection populates the variables listed above from the @@ -2066,6 +2078,13 @@ PACKAGES are satisfied, i.e. that PACKAGES is computed using `package-compute-transaction'." (mapc #'package-install-from-archive packages)) +(defun package--archives-initialize () + "Make sure the list of installed and remote packages are initialized." + (unless package--initialized + (package-initialize t)) + (unless package-archive-contents + (package-refresh-contents))) + ;;;###autoload (defun package-install (pkg &optional dont-select) "Install the package PKG. @@ -2086,10 +2105,7 @@ to install it but still mark it as selected." (progn ;; Initialize the package system to get the list of package ;; symbols for completion. - (unless package--initialized - (package-initialize t)) - (unless package-archive-contents - (package-refresh-contents)) + (package--archives-initialize) (list (intern (completing-read "Install package: " (delq nil @@ -2099,6 +2115,7 @@ to install it but still mark it as selected." package-archive-contents)) nil t)) nil))) + (package--archives-initialize) (add-hook 'post-command-hook #'package-menu--post-refresh) (let ((name (if (package-desc-p pkg) (package-desc-name pkg) @@ -3714,7 +3731,7 @@ short description." (package-menu--generate nil t))) ;; The package menu buffer has keybindings. If the user types ;; `M-x list-packages', that suggests it should become current. - (switch-to-buffer buf))) + (pop-to-buffer-same-window buf))) ;;;###autoload (defalias 'package-list-packages 'list-packages) @@ -4042,10 +4059,12 @@ activations need to be changed, such as when `package-load-list' is modified." :type 'boolean :version "27.1") +;;;###autoload (defcustom package-quickstart-file (locate-user-emacs-file "package-quickstart.el") "Location of the file used to speed up activation of packages at startup." :type 'file + :initialize #'custom-initialize-delay :version "27.1") (defun package--quickstart-maybe-refresh () @@ -4111,6 +4130,8 @@ activations need to be changed, such as when `package-load-list' is modified." ;; no-update-autoloads: t ;; End: ")) + ;; FIXME: Do it asynchronously in an Emacs subprocess, and + ;; don't show the byte-compiler warnings. (byte-compile-file package-quickstart-file))) (defun package--imenu-prev-index-position-function () @@ -4131,6 +4152,15 @@ beginning of the line." (package-version-join (package-desc-version package-desc)) (package-desc-summary package-desc)))) +;;;; Introspection + +(defun package-get-descriptor (pkg-name) + "Return the `package-desc' of PKG-NAME." + (unless package--initialized (package-initialize 'no-activate)) + (or (package--get-activatable-pkg pkg-name) + (cadr (assq pkg-name package-alist)) + (cadr (assq pkg-name package-archive-contents)))) + (provide 'package) ;;; package.el ends here diff --git a/lisp/startup.el b/lisp/startup.el index dfac0c8ed0c..57fd87f20f9 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -1230,17 +1230,7 @@ please check its value") package-enable-at-startup (not (bound-and-true-p package--activated)) (catch 'package-dir-found - (let (dirs) - (if (boundp 'package-directory-list) - (setq dirs package-directory-list) - (dolist (f load-path) - (and (stringp f) - (equal (file-name-nondirectory f) "site-lisp") - (push (expand-file-name "elpa" f) dirs)))) - (push (if (boundp 'package-user-dir) - package-user-dir - (locate-user-emacs-file "elpa")) - dirs) + (let ((dirs (cons package-user-dir package-directory-list))) (dolist (dir dirs) (when (file-directory-p dir) (dolist (subdir (directory-files dir)) From 02e6ffe860cacc2681448b40f8b3279d31442b58 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 5 Jan 2021 20:26:38 +0200 Subject: [PATCH 63/96] Fix process-tests on MS-Windows It was again broken by recent changes. * test/src/process-tests.el (process-tests/fd-setsize-no-crash/make-serial-process): Skip test on MS-Windows. --- test/src/process-tests.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/src/process-tests.el b/test/src/process-tests.el index 1f88232c7fc..ca98f54bdb1 100644 --- a/test/src/process-tests.el +++ b/test/src/process-tests.el @@ -646,6 +646,8 @@ FD_SETSIZE file descriptors (Bug#24325)." (ert-deftest process-tests/fd-setsize-no-crash/make-serial-process () "Check that Emacs doesn't crash when trying to use more than FD_SETSIZE file descriptors (Bug#24325)." + ;; This test cannot be run if PTYs aren't supported. + (skip-unless (not (eq system-type 'windows-nt))) (with-timeout (60 (ert-fail "Test timed out")) (process-tests--with-processes processes ;; In order to use `make-serial-process', we need to create some @@ -667,6 +669,15 @@ FD_SETSIZE file descriptors (Bug#24325)." (tty-name (process-tty-name host))) (should (processp host)) (push host processes) + ;; FIXME: The assumption below that using :connection 'pty + ;; in make-process necessarily produces a process with PTY + ;; connection is unreliable and non-portable. + ;; make-process can legitimately and silently fall back on + ;; pipes if allocating a PTY fails (and on MS-Windows it + ;; always fails). The following code also assumes that + ;; process-tty-name produces a file name that can be + ;; passed to 'stat' and to make-serial-process, which is + ;; also non-portable. (should tty-name) (should (file-exists-p tty-name)) (should-not (member tty-name tty-names)) From c1daeb4c2826af28311a08100e98948349715c37 Mon Sep 17 00:00:00 2001 From: "James N. V. Cash" Date: Tue, 5 Jan 2021 20:35:35 +0200 Subject: [PATCH 64/96] Refactor tab-bar-mode to -define-keys and -load-buttons (bug#42052) * lisp/tab-bar.el (tab-bar--define-keys, tab-bar--load-buttons): Move some code here from 'tab-bar-mode'. (tab-bar-new-tab-to): Call tab-bar--load-buttons and tab-bar--define-keys. Copyright-paperwork-exempt: yes --- lisp/tab-bar.el | 83 +++++++++++++++++++++++++++---------------------- 1 file changed, 46 insertions(+), 37 deletions(-) diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 935c97e2a41..93f3c550ceb 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -95,6 +95,45 @@ Possible modifier keys are `control', `meta', `shift', `hyper', `super' and :version "27.1") +(defun tab-bar--define-keys () + "Install key bindings for switching between tabs if the user has configured them." + (when tab-bar-select-tab-modifiers + (global-set-key (vector (append tab-bar-select-tab-modifiers (list ?0))) + 'tab-bar-switch-to-recent-tab) + (dotimes (i 9) + (global-set-key (vector (append tab-bar-select-tab-modifiers + (list (+ i 1 ?0)))) + 'tab-bar-select-tab))) + ;; Don't override user customized key bindings + (unless (global-key-binding [(control tab)]) + (global-set-key [(control tab)] 'tab-next)) + (unless (global-key-binding [(control shift tab)]) + (global-set-key [(control shift tab)] 'tab-previous)) + (unless (global-key-binding [(control shift iso-lefttab)]) + (global-set-key [(control shift iso-lefttab)] 'tab-previous))) + +(defun tab-bar--load-buttons () + "Load the icons for the tab buttons." + (when (and tab-bar-new-button + (not (get-text-property 0 'display tab-bar-new-button))) + ;; This file is pre-loaded so only here we can use the right data-directory: + (add-text-properties 0 (length tab-bar-new-button) + `(display (image :type xpm + :file "tabs/new.xpm" + :margin (2 . 0) + :ascent center)) + tab-bar-new-button)) + + (when (and tab-bar-close-button + (not (get-text-property 0 'display tab-bar-close-button))) + ;; This file is pre-loaded so only here we can use the right data-directory: + (add-text-properties 0 (length tab-bar-close-button) + `(display (image :type xpm + :file "tabs/close.xpm" + :margin (2 . 0) + :ascent center)) + tab-bar-close-button))) + (define-minor-mode tab-bar-mode "Toggle the tab bar in all graphical frames (Tab Bar mode)." :global t @@ -110,43 +149,10 @@ Possible modifier keys are `control', `meta', `shift', `hyper', `super' and (cons (cons 'tab-bar-lines val) (assq-delete-all 'tab-bar-lines default-frame-alist))))) - - (when (and tab-bar-mode tab-bar-new-button - (not (get-text-property 0 'display tab-bar-new-button))) - ;; This file is pre-loaded so only here we can use the right data-directory: - (add-text-properties 0 (length tab-bar-new-button) - `(display (image :type xpm - :file "tabs/new.xpm" - :margin (2 . 0) - :ascent center)) - tab-bar-new-button)) - - (when (and tab-bar-mode tab-bar-close-button - (not (get-text-property 0 'display tab-bar-close-button))) - ;; This file is pre-loaded so only here we can use the right data-directory: - (add-text-properties 0 (length tab-bar-close-button) - `(display (image :type xpm - :file "tabs/close.xpm" - :margin (2 . 0) - :ascent center)) - tab-bar-close-button)) - + (when tab-bar-mode + (tab-bar--load-buttons)) (if tab-bar-mode - (progn - (when tab-bar-select-tab-modifiers - (global-set-key (vector (append tab-bar-select-tab-modifiers (list ?0))) - 'tab-bar-switch-to-recent-tab) - (dotimes (i 9) - (global-set-key (vector (append tab-bar-select-tab-modifiers - (list (+ i 1 ?0)))) - 'tab-bar-select-tab))) - ;; Don't override user customized key bindings - (unless (global-key-binding [(control tab)]) - (global-set-key [(control tab)] 'tab-next)) - (unless (global-key-binding [(control shift tab)]) - (global-set-key [(control shift tab)] 'tab-previous)) - (unless (global-key-binding [(control shift iso-lefttab)]) - (global-set-key [(control shift iso-lefttab)] 'tab-previous))) + (tab-bar--define-keys) ;; Unset only keys bound by tab-bar (when (eq (global-key-binding [(control tab)]) 'tab-next) (global-unset-key [(control tab)])) @@ -815,7 +821,10 @@ After the tab is created, the hooks in ((and (natnump tab-bar-show) (> (length (funcall tab-bar-tabs-function)) tab-bar-show) (zerop (frame-parameter nil 'tab-bar-lines))) - (set-frame-parameter nil 'tab-bar-lines 1))) + (progn + (tab-bar--load-buttons) + (tab-bar--define-keys) + (set-frame-parameter nil 'tab-bar-lines 1)))) (force-mode-line-update) (unless tab-bar-mode From e72fd12ec688efe046de98d5a6494fe2ffab7762 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Tue, 5 Jan 2021 20:43:22 +0200 Subject: [PATCH 65/96] * lisp/tab-bar.el (toggle-frame-tab-bar): New command (bug#45556) --- lisp/tab-bar.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 93f3c550ceb..b44fcfa3a02 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -196,6 +196,18 @@ See `tab-bar-mode' for more information." (tab-bar-mode (if (> (frame-parameter nil 'tab-bar-lines) 0) 0 1)) (tab-bar-mode arg))) +(defun toggle-frame-tab-bar (&optional frame) + "Toggle tab bar of FRAME. +This is useful when you want to enable the tab bar individually +on each new frame when the global `tab-bar-mode' is disabled, +or when you want to disable the tab bar individually on each +new frame when the global `tab-bar-mode' is enabled, by using + + (add-hook 'after-make-frame-functions 'toggle-frame-tab-bar)" + (interactive) + (set-frame-parameter frame 'tab-bar-lines + (if (> (frame-parameter frame 'tab-bar-lines) 0) 0 1))) + (defvar tab-bar-map (make-sparse-keymap) "Keymap for the tab bar. Define this locally to override the global tab bar.") From 7469214d94981d4dbc1ca83a427000fd2b257b47 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Tue, 5 Jan 2021 20:55:29 +0200 Subject: [PATCH 66/96] * lisp/tab-bar.el (tab-bar-tab-name-format-function): New defcustom. (tab-bar-tab-name-format-default): New function as the default value. (tab-bar-make-keymap-1): Funcall tab-bar-tab-name-format-function. --- etc/NEWS | 9 +++++++++ lisp/tab-bar.el | 40 ++++++++++++++++++++++++++-------------- 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index d1cc422e9f7..48fb4b88e15 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -396,10 +396,19 @@ of the next command to be displayed in a new tab. +++ *** New command 'C-x t C-r' to open file read-only in other tab. +--- *** The tab bar is frame-local when 'tab-bar-show' is a number. Show/hide the tab bar independently for each frame, according to the value of 'tab-bar-show'. +--- +*** New command 'toggle-frame-tab-bar'. +It can be used to enable/disable the tab bar individually +on each frame independently from the state of `tab-bar-mode'. + +--- +*** New user option 'tab-bar-tab-name-format-function'. + --- *** The tabs in the tab line can now be scrolled using horizontal scroll. If your mouse or trackpad supports it, you can now scroll tabs when diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index b44fcfa3a02..5a95e5975de 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -436,6 +436,30 @@ Return its existing value or a new value." tabs)) +(defcustom tab-bar-tab-name-format-function #'tab-bar-tab-name-format-default + "Function to format a tab name. +Function gets two arguments, the tab and its number, and should return +the formatted tab name to display in the tab bar." + :type 'function + :initialize 'custom-initialize-default + :set (lambda (sym val) + (set-default sym val) + (force-mode-line-update)) + :group 'tab-bar + :version "28.1") + +(defun tab-bar-tab-name-format-default (tab i) + (let ((current-p (eq (car tab) 'current-tab))) + (propertize + (concat (if tab-bar-tab-hints (format "%d " i) "") + (alist-get 'name tab) + (or (and tab-bar-close-button-show + (not (eq tab-bar-close-button-show + (if current-p 'non-selected 'selected))) + tab-bar-close-button) + "")) + 'face (if current-p 'tab-bar-tab 'tab-bar-tab-inactive)))) + (defun tab-bar-make-keymap-1 () "Generate an actual keymap from `tab-bar-map', without caching." (let* ((separator (or tab-bar-separator (if window-system " " "|"))) @@ -461,25 +485,13 @@ Return its existing value or a new value." ((eq (car tab) 'current-tab) `((current-tab menu-item - ,(propertize (concat (if tab-bar-tab-hints (format "%d " i) "") - (alist-get 'name tab) - (or (and tab-bar-close-button-show - (not (eq tab-bar-close-button-show - 'non-selected)) - tab-bar-close-button) "")) - 'face 'tab-bar-tab) + ,(funcall tab-bar-tab-name-format-function tab i) ignore :help "Current tab"))) (t `((,(intern (format "tab-%i" i)) menu-item - ,(propertize (concat (if tab-bar-tab-hints (format "%d " i) "") - (alist-get 'name tab) - (or (and tab-bar-close-button-show - (not (eq tab-bar-close-button-show - 'selected)) - tab-bar-close-button) "")) - 'face 'tab-bar-tab-inactive) + ,(funcall tab-bar-tab-name-format-function tab i) ,(or (alist-get 'binding tab) `(lambda () From 3b835f7b81030f482348364e83f384a0fa4c2857 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Tue, 5 Jan 2021 20:59:51 +0200 Subject: [PATCH 67/96] * lisp/subr.el (remove-hook): Add default value (bug#45393) --- lisp/subr.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/subr.el b/lisp/subr.el index 50acbd27905..a5a979a2172 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1800,7 +1800,11 @@ unless HOOK has both local and global functions). If multiple functions have the same representation under `princ', the first one will be removed." (interactive - (let* ((hook (intern (completing-read "Hook variable: " obarray #'boundp t))) + (let* ((default (and (symbolp (variable-at-point)) + (symbol-name (variable-at-point)))) + (hook (intern (completing-read + (format-prompt "Hook variable" default) + obarray #'boundp t nil nil default))) (local (and (local-variable-p hook) From 048b1aaec8d5cd4ce6e6a5a9b8091608d0af81a6 Mon Sep 17 00:00:00 2001 From: Alan Third Date: Tue, 5 Jan 2021 21:43:12 +0000 Subject: [PATCH 68/96] Prevent stack overflow in GNUstep menu code * src/nsmenu.m (ns_update_menubar): Always do a deep update for GNUstep. ([EmacsMenu menuNeedsUpdate:]): Don't update the menu as it should always have had a deep update. --- src/nsmenu.m | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/nsmenu.m b/src/nsmenu.m index 9b56958100a..8086f56854e 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -145,6 +145,10 @@ t = -(1000*tb.time+tb.millitm); #endif +#ifdef NS_IMPL_GNUSTEP + deep_p = 1; /* See comment in menuNeedsUpdate. */ +#endif + if (deep_p) { /* Make a widget-value tree representing the entire menu trees. */ @@ -433,21 +437,22 @@ - (instancetype)initWithTitle: (NSString *)title } -/* Delegate method called when a submenu is being opened: run a 'deep' call - to set_frame_menubar. */ - -/* TODO: GNUstep calls this method when the menu is still being built - which throws it into an infinite loop. One possible solution is to - use menuWillOpen instead, but the Apple docs explicitly warn - against changing the contents of the menu in it. I don't know what - the right thing to do for GNUstep is. */ +/* Delegate method called when a submenu is being opened: run a 'deep' + call to ns_update_menubar. */ - (void)menuNeedsUpdate: (NSMenu *)menu { if (!FRAME_LIVE_P (SELECTED_FRAME ())) return; +#ifdef NS_IMPL_COCOA +/* TODO: GNUstep calls this method when the menu is still being built + which results in a recursive stack overflow. One possible solution + is to use menuWillOpen instead, but the Apple docs explicitly warn + against changing the contents of the menu in it. I don't know what + the right thing to do for GNUstep is. */ if (needsUpdate) ns_update_menubar (SELECTED_FRAME (), true); +#endif } From 7d7bfbf0346114b116e14a4338ea235d12674f13 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 5 Jan 2021 17:57:15 -0500 Subject: [PATCH 69/96] * lisp/emacs-lisp/autoload.el: Improve last change It turns out there were other places that used `custom-initialize-delay` on autoloaded variables and used various hacks to make it work with `autoload.el`. The new code makes those hacks unneeded. Also, there's no point trying to "optimize" those rare cases anyway, so I simplified the `autoload.el` code for those cases. (make-autoload): For non-trivial cases, just include the whole `defcustom` instead of trying to mimic it. * lisp/mail/rmail.el (rmail-spool-directory): Remove hacks. * lisp/info.el (Info-default-directory-list): Remove `progn` hack. * lisp/custom.el (custom-declare-variable) (custom-handle-all-keywords): Don't use pseudo-group `nil`. --- lisp/custom.el | 8 ++++++-- lisp/emacs-lisp/autoload.el | 31 ++++++++++++++++++------------- lisp/info.el | 21 +++++++++------------ lisp/mail/rmail.el | 11 +---------- 4 files changed, 34 insertions(+), 37 deletions(-) diff --git a/lisp/custom.el b/lisp/custom.el index dfa8539c44f..d9d0898dcb7 100644 --- a/lisp/custom.el +++ b/lisp/custom.el @@ -161,7 +161,9 @@ set to nil, as the value is no longer rogue." ;; Whether automatically buffer-local. buffer-local) (unless (memq :group args) - (custom-add-to-group (custom-current-group) symbol 'custom-variable)) + (let ((cg (custom-current-group))) + (when cg + (custom-add-to-group cg symbol 'custom-variable)))) (while args (let ((keyword (pop args))) (unless (symbolp keyword) @@ -525,7 +527,9 @@ If no such group is found, return nil." "For customization option SYMBOL, handle keyword arguments ARGS. Third argument TYPE is the custom option type." (unless (memq :group args) - (custom-add-to-group (custom-current-group) symbol type)) + (let ((cg (custom-current-group))) + (when cg + (custom-add-to-group cg symbol type)))) (while args (let ((arg (car args))) (setq args (cdr args)) diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el index 77de05a6f68..ec7492dd4b1 100644 --- a/lisp/emacs-lisp/autoload.el +++ b/lisp/emacs-lisp/autoload.el @@ -220,22 +220,27 @@ expression, in which case we want to handle forms differently." ;; Convert defcustom to less space-consuming data. ((eq car 'defcustom) - (let ((varname (car-safe (cdr-safe form))) - (initializer (plist-get (nthcdr 4 form) :initialize)) - (init (car-safe (cdr-safe (cdr-safe form)))) - (doc (car-safe (cdr-safe (cdr-safe (cdr-safe form))))) - ;; (rest (cdr-safe (cdr-safe (cdr-safe (cdr-safe form))))) - ) + (let* ((varname (car-safe (cdr-safe form))) + (props (nthcdr 4 form)) + (initializer (plist-get props :initialize)) + (init (car-safe (cdr-safe (cdr-safe form)))) + (doc (car-safe (cdr-safe (cdr-safe (cdr-safe form))))) + ;; (rest (cdr-safe (cdr-safe (cdr-safe (cdr-safe form))))) + ) `(progn - ,(if (null initializer) - `(defvar ,varname ,init ,doc) - `(progn (defvar ,varname nil ,doc) - (let ((exp ',init)) - (put ',varname 'standard-value (list exp)) - (,(eval initializer t) ',varname exp)))) + ,(if (not (member initializer '(nil 'custom-initialize-default + #'custom-initialize-default + 'custom-initialize-reset + #'custom-initialize-reset))) + form + `(defvar ,varname ,init ,doc)) + ;; When we include the complete `form', this `custom-autoload' + ;; is not indispensable, but it still helps in case the `defcustom' + ;; doesn't specify its group explicitly, and probably in a few other + ;; corner cases. (custom-autoload ',varname ,file ,(condition-case nil - (null (cadr (memq :set form))) + (null (plist-get props :set)) (error nil)))))) ((eq car 'defgroup) diff --git a/lisp/info.el b/lisp/info.el index ef94aa945f2..62d7b583ff2 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -160,17 +160,14 @@ A header-line does not scroll with the rest of the buffer." :version "24.4") ;; This is a defcustom largely so that we can get the benefit -;; of custom-initialize-delay. Perhaps it would work to make it a -;; defvar and explicitly give it a standard-value property, and -;; call custom-initialize-delay on it. -;; The progn forces the autoloader to include the whole thing, not -;; just an abbreviated version. The value is initialized at startup -;; time, when command-line calls custom-reevaluate-setting on all -;; the defcustoms in custom-delayed-init-variables. This is -;; somewhat sub-optimal, as ideally this should be done when Info -;; mode is first invoked. +;; of `custom-initialize-delay'. Perhaps it would work to make it a +;; `defvar' and explicitly give it a `standard-value' property, and +;; call `custom-initialize-delay' on it. +;; The value is initialized at startup time, when command-line calls +;; `custom-reevaluate-setting' on all the defcustoms in +;; `custom-delayed-init-variables'. This is somewhat sub-optimal, as ideally +;; this should be done when Info mode is first invoked. ;;;###autoload -(progn (defcustom Info-default-directory-list (let* ((config-dir (file-name-as-directory @@ -232,8 +229,8 @@ the environment variable INFOPATH is set. Although this is a customizable variable, that is mainly for technical reasons. Normally, you should either set INFOPATH or customize `Info-additional-directory-list', rather than changing this variable." - :initialize 'custom-initialize-delay - :type '(repeat directory))) + :initialize #'custom-initialize-delay + :type '(repeat directory)) (defvar Info-directory-list nil "List of directories to search for Info documentation files. diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index 69797837cd2..29460cc20f5 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -160,13 +160,6 @@ its character representation and its display representation.") :group 'rmail :version "21.1") -;;;###autoload -(put 'rmail-spool-directory 'standard-value - '((cond ((file-exists-p "/var/mail") "/var/mail/") - ((file-exists-p "/var/spool/mail") "/var/spool/mail/") - ((memq system-type '(hpux usg-unix-v)) "/usr/mail/") - (t "/usr/spool/mail/")))) - ;;;###autoload (defcustom rmail-spool-directory (purecopy @@ -181,12 +174,10 @@ its character representation and its display representation.") (t "/usr/spool/mail/"))) "Name of directory used by system mailer for delivering new mail. Its name should end with a slash." - :initialize 'custom-initialize-delay + :initialize #'custom-initialize-delay :type 'directory :group 'rmail) -;;;###autoload(custom-initialize-delay 'rmail-spool-directory nil) - (defcustom rmail-movemail-program nil "If non-nil, the file name of the `movemail' program." :group 'rmail-retrieve From cf672c66711c0aa24500cab99eb7f2ef63b02bf2 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 5 Jan 2021 21:26:03 -0500 Subject: [PATCH 70/96] * lisp/emacs-lisp/package.el (package-activate-all): Another tweak `package-quickstart.el` files presume `package-activated-list` is a bound variable, so make sure this is the case even when `package.el` is not yet loaded. --- lisp/emacs-lisp/package.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index a38363df23e..453e86c7831 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1640,6 +1640,8 @@ The variable `package-load-list' controls which packages to load." ;; 2 when loading the .el file (this assumes we were careful to ;; save this file so it doesn't need any decoding). (let ((load-source-file-function nil)) + (unless (boundp 'package-activated-list) + (setq package-activated-list nil)) (load qs nil 'nomessage)) (require 'package) (package--activate-all))))) From ba011e487d40b96691d3e7af917ff6ce9d7c7a00 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 5 Jan 2021 21:29:41 -0500 Subject: [PATCH 71/96] * lisp/play/dunnet.el: Run the game when loaded via `--batch -l dunnet` (dun--batch): Rename from `dun-batch` and don't autoload. (dunnet): Delegate to `dun--batch` when in batch mode. --- lisp/play/dunnet.el | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/lisp/play/dunnet.el b/lisp/play/dunnet.el index e328b6eab52..3916e35f769 100644 --- a/lisp/play/dunnet.el +++ b/lisp/play/dunnet.el @@ -25,7 +25,8 @@ ;;; Commentary: ;; This game can be run in batch mode. To do this, use: -;; emacs -batch -l dunnet +;; +;; emacs --batch -f dunnet ;;; Code: @@ -1170,11 +1171,13 @@ treasures for points?" "4" "four") (defun dunnet () "Switch to *dungeon* buffer and start game." (interactive) - (pop-to-buffer-same-window "*dungeon*") - (dun-mode) - (setq dun-dead nil) - (setq dun-room 0) - (dun-messages)) + (if noninteractive + (dun--batch) + (pop-to-buffer-same-window "*dungeon*") + (dun-mode) + (setq dun-dead nil) + (setq dun-room 0) + (dun-messages))) ;;;; ;;;; This section contains all of the verbs and commands. @@ -3126,8 +3129,7 @@ File not found"))) (dun-mprinc "\n") (dun-batch-loop)) -;;;###autoload -(defun dun-batch () +(defun dun--batch () "Start `dunnet' in batch mode." (fset 'dun-mprinc #'dun-batch-mprinc) (fset 'dun-mprincl #'dun-batch-mprincl) @@ -3140,6 +3142,17 @@ File not found"))) (setq dun-batch-mode t) (dun-batch-loop)) +;; Apparently, there are many references out there to running us via +;; +;; emacs --batch -l dunnet +;; +;; So try and accommodate those without interfering with other cases +;; where `dunnet.el' might be loaded in batch mode with no intention +;; to run the game. +(when (and noninteractive + (equal '("-l" "dunnet") (member "-l" command-line-args))) + (dun--batch)) + (provide 'dunnet) ;; Local Variables: From 96bbbaec5c1b2612946ff08abf9d43e7478e8c43 Mon Sep 17 00:00:00 2001 From: Michael Heerdegen Date: Tue, 22 Dec 2020 05:44:47 +0100 Subject: [PATCH 72/96] Fix obsolete variable warnings about class names * lisp/emacs-lisp/eieio-core.el (eieio-defclass-autoload): Try to make the wording of the warning about the obsoleted variable less confusing. * lisp/emacs-lisp/bytecomp.el (byte-compile-check-variable): Don't warn for lexical variables (Bug#39169). Fix spurious `or'. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp/warn-obsolete-variable-bound\.el): New test. * test/lisp/emacs-lisp/bytecomp-resources/warn-obsolete-variable-bound.el: New file. --- lisp/emacs-lisp/bytecomp.el | 9 +++++---- lisp/emacs-lisp/eieio-core.el | 3 ++- .../bytecomp-resources/warn-obsolete-variable-bound.el | 7 +++++++ test/lisp/emacs-lisp/bytecomp-tests.el | 3 +++ 4 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 test/lisp/emacs-lisp/bytecomp-resources/warn-obsolete-variable-bound.el diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 76457814acd..360da6b6ba6 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -3441,10 +3441,11 @@ for symbols generated by the byte compiler itself." (and od (not (memq var byte-compile-not-obsolete-vars)) (not (memq var byte-compile-global-not-obsolete-vars)) - (or (pcase (nth 1 od) - ('set (not (eq access-type 'reference))) - ('get (eq access-type 'reference)) - (_ t))))) + (not (memq var byte-compile-lexical-variables)) + (pcase (nth 1 od) + ('set (not (eq access-type 'reference))) + ('get (eq access-type 'reference)) + (_ t)))) (byte-compile-warn-obsolete var)))) (defsubst byte-compile-dynamic-variable-op (base-op var) diff --git a/lisp/emacs-lisp/eieio-core.el b/lisp/emacs-lisp/eieio-core.el index 3e5e9b95235..a8361c0d4b4 100644 --- a/lisp/emacs-lisp/eieio-core.el +++ b/lisp/emacs-lisp/eieio-core.el @@ -215,7 +215,8 @@ It creates an autoload function for CNAME's constructor." ;; turn this into a usable self-pointing symbol (when eieio-backward-compatibility (set cname cname) - (make-obsolete-variable cname (format "use \\='%s instead" cname) + (make-obsolete-variable cname (format "\ +use \\='%s or turn off `eieio-backward-compatibility' instead" cname) "25.1")) (setf (cl--find-class cname) newc) diff --git a/test/lisp/emacs-lisp/bytecomp-resources/warn-obsolete-variable-bound.el b/test/lisp/emacs-lisp/bytecomp-resources/warn-obsolete-variable-bound.el new file mode 100644 index 00000000000..e65a541e6e3 --- /dev/null +++ b/test/lisp/emacs-lisp/bytecomp-resources/warn-obsolete-variable-bound.el @@ -0,0 +1,7 @@ +;;; -*- lexical-binding: t -*- + +(make-obsolete-variable 'bytecomp--tests-obsolete-var-2 nil "99.99") + +(defun foo () + (let ((bytecomp--tests-obsolete-var-2 2)) + bytecomp--tests-obsolete-var-2)) diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index 5e5f99dbdab..a07af188fac 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el @@ -625,6 +625,9 @@ Subtests signal errors if something goes wrong." (bytecomp--define-warning-file-test "warn-obsolete-variable.el" "bytecomp--tests-obs.*obsolete.*99.99") +(bytecomp--define-warning-file-test "warn-obsolete-variable-bound.el" + "bytecomp--tests-obs.*obsolete.*99.99" t) + (bytecomp--define-warning-file-test "warn-redefine-defun-as-macro.el" "as both function and macro") From 7936c8a96060fa118220d4d874f740dc75e2fe47 Mon Sep 17 00:00:00 2001 From: Gabriel do Nascimento Ribeiro Date: Wed, 6 Jan 2021 20:27:26 +0200 Subject: [PATCH 73/96] * lisp/mb-depth.el (minibuffer-depth-indicator): New face. (minibuffer-depth-setup): Use new face and add a single space between the depth indicator and the minibuffer prompt. https://lists.gnu.org/archive/html/emacs-devel/2020-12/msg00230.html Copyright-paperwork-exempt: yes --- lisp/mb-depth.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lisp/mb-depth.el b/lisp/mb-depth.el index 06da0739d6b..ea2ea174b50 100644 --- a/lisp/mb-depth.el +++ b/lisp/mb-depth.el @@ -35,6 +35,10 @@ It is called with one argument, the minibuffer depth, and must return a string.") +(defface minibuffer-depth-indicator '((t :inherit highlight)) + "Face to use for minibuffer depth indicator." + :version "28.1") + ;; An overlay covering the prompt. This is a buffer-local variable in ;; each affected minibuffer. ;; @@ -52,7 +56,10 @@ The prompt should already have been inserted." (overlay-put minibuffer-depth-overlay 'before-string (if minibuffer-depth-indicator-function (funcall minibuffer-depth-indicator-function depth) - (propertize (format "[%d]" depth) 'face 'highlight))) + (concat (propertize (format "[%d]" depth) + 'face + 'minibuffer-depth-indicator) + " "))) (overlay-put minibuffer-depth-overlay 'evaporate t)))) ;;;###autoload From 665b4e7c4e093391a353506e7b2385f0902db70b Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Wed, 6 Jan 2021 19:41:55 +0200 Subject: [PATCH 74/96] Proof some searches and file listings against symlinks * lisp/progmodes/project.el (project--files-in-directory): Make sure the directory includes the trailing slash in case it's a symlink, discussed in https://lists.gnu.org/archive/html/emacs-devel/2021-01/msg00345.html. * lisp/progmodes/xref.el (xref-matches-in-directory): Same. * lisp/cedet/semantic/symref/grep.el (semantic-symref-perform-search): Same. --- lisp/cedet/semantic/symref/grep.el | 3 ++- lisp/progmodes/project.el | 3 ++- lisp/progmodes/xref.el | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lisp/cedet/semantic/symref/grep.el b/lisp/cedet/semantic/symref/grep.el index 5f9a3fa352e..9f0ac38ec75 100644 --- a/lisp/cedet/semantic/symref/grep.el +++ b/lisp/cedet/semantic/symref/grep.el @@ -168,7 +168,8 @@ This shell should support pipe redirect syntax." (erase-buffer) (setq default-directory rootdir) (let ((cmd (semantic-symref-grep-use-template - (file-local-name rootdir) filepattern grepflags greppat))) + (file-name-as-directory (file-local-name rootdir)) + filepattern grepflags greppat))) (process-file semantic-symref-grep-shell nil b nil shell-command-switch cmd))) (setq ans (semantic-symref-parse-tool-output tool b)) diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index d417382c0df..62c3cf44cb6 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -291,7 +291,8 @@ to find the list of ignores for each directory." (localdir (file-local-name (expand-file-name dir))) (command (format "%s %s %s -type f %s -print0" find-program - localdir + ;; In case DIR is a symlink. + (file-name-as-directory localdir) (xref--find-ignores-arguments ignores localdir) (if files (concat (shell-quote-argument "(") diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 2fefc23e199..b393b8d0f1a 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1374,7 +1374,8 @@ IGNORES is a list of glob patterns for files to ignore." ;; do that reliably enough, without creating false negatives? (command (xref--rgrep-command (xref--regexp-to-extended regexp) files - (file-local-name (expand-file-name dir)) + (file-name-as-directory + (file-local-name (expand-file-name dir))) ignores)) (def default-directory) (buf (get-buffer-create " *xref-grep*")) From 331e40a8fd491ceb35c08a3345785dab61bc60d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=ADn?= Date: Wed, 6 Jan 2021 22:53:40 +0200 Subject: [PATCH 75/96] Fix some failing tests in BSD systems * test/lisp/progmodes/xref-tests.el (xref--xref-file-name-display-is-abs) (xref--xref-file-name-display-is-relative-to-project-root): Accommodate some older versions of BSD find (https://lists.gnu.org/archive/html/emacs-devel/2021-01/msg00156.html). --- test/lisp/progmodes/xref-tests.el | 38 +++++++++++++++++++------------ 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/test/lisp/progmodes/xref-tests.el b/test/lisp/progmodes/xref-tests.el index eaafc5888c7..b4b5e4db5d6 100644 --- a/test/lisp/progmodes/xref-tests.el +++ b/test/lisp/progmodes/xref-tests.el @@ -99,13 +99,18 @@ (should (null (marker-position (cdr (nth 0 (cdr cons2)))))))) (ert-deftest xref--xref-file-name-display-is-abs () - (let ((xref-file-name-display 'abs)) - (should (equal (delete-dups - (mapcar 'xref-location-group - (xref-tests--locations-in-data-dir "\\(bar\\|foo\\)"))) - (list - (concat xref-tests--data-dir "file1.txt") - (concat xref-tests--data-dir "file2.txt")))))) + (let ((xref-file-name-display 'abs) + ;; Some older BSD find versions can produce '//' in the output. + (expected (list + (concat xref-tests--data-dir "/?file1.txt") + (concat xref-tests--data-dir "/?file2.txt"))) + (actual (delete-dups + (mapcar 'xref-location-group + (xref-tests--locations-in-data-dir "\\(bar\\|foo\\)"))))) + (should (and (= (length expected) (length actual)) + (cl-every (lambda (e1 e2) + (string-match-p e1 e2)) + expected actual))))) (ert-deftest xref--xref-file-name-display-is-nondirectory () (let ((xref-file-name-display 'nondirectory)) @@ -121,10 +126,15 @@ (file-name-directory (directory-file-name xref-tests--data-dir))) (project-find-functions #'(lambda (_) (cons 'transient data-parent-dir))) - (xref-file-name-display 'project-relative)) - (should (equal (delete-dups - (mapcar 'xref-location-group - (xref-tests--locations-in-data-dir "\\(bar\\|foo\\)"))) - (list - "xref-resources/file1.txt" - "xref-resources/file2.txt"))))) + (xref-file-name-display 'project-relative) + ;; Some older BSD find versions can produce '//' in the output. + (expected (list + "xref-resources//?file1.txt" + "xref-resources//?file2.txt")) + (actual (delete-dups + (mapcar 'xref-location-group + (xref-tests--locations-in-data-dir "\\(bar\\|foo\\)"))))) + (should (and (= (length expected) (length actual)) + (cl-every (lambda (e1 e2) + (string-match-p e1 e2)) + expected actual))))) From 9b31802e2d13cf8478c23d651741b54ffd4b984b Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 6 Jan 2021 17:19:17 -0800 Subject: [PATCH 76/96] Update a substitute-command-keys test * test/lisp/help-tests.el (help-tests-substitute-command-keys/keymaps): Update for "Pretty-print keys without <> around modifiers" change. --- test/lisp/help-tests.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/lisp/help-tests.el b/test/lisp/help-tests.el index 95557c95eb7..835d9fe7949 100644 --- a/test/lisp/help-tests.el +++ b/test/lisp/help-tests.el @@ -102,7 +102,7 @@ RET minibuffer-complete-and-exit ESC Prefix Command SPC minibuffer-complete-word ? minibuffer-completion-help - file-cache-minibuffer-complete +C- file-cache-minibuffer-complete previous-history-element next-history-element next-line-or-history-element From 9db1c0993a99853968c021d094eba37c0cae60bb Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Thu, 7 Jan 2021 10:14:37 +0100 Subject: [PATCH 77/96] * test/Makefile.in (WRITE_LOG): Mark also problematic tests for emba. --- test/Makefile.in | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/Makefile.in b/test/Makefile.in index 8aa37ca7854..fc40dad5e2e 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -161,11 +161,15 @@ endif ## Save logs, and show logs for failed tests. WRITE_LOG = > $@ 2>&1 || { STAT=$$?; cat $@; exit $$STAT; } +## On Hydra or Emba, always show logs for certain problematic tests. ifdef EMACS_HYDRA_CI -## On Hydra, always show logs for certain problematic tests. lisp/net/tramp-tests.log \ : WRITE_LOG = 2>&1 | tee $@ endif +ifdef EMACS_EMBA_CI +lisp/filenotify-tests.log lisp/net/tramp-tests.log \ +: WRITE_LOG = 2>&1 | tee $@ +endif ifeq ($(TEST_LOAD_EL), yes) testloadfile = $*.el From 2f6e30cd86a575ef06e8d056fbb6582336f6aadd Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Thu, 7 Jan 2021 13:08:45 +0100 Subject: [PATCH 78/96] Revert mark-paragraph change and add tests * lisp/textmodes/paragraphs.el (mark-paragraph): Revert eb090f65ceb0ae8a90829e911694348583135ba5 (bug#45318). This restores the behaviour from Emacs 27 -- further work is needed on this patch. --- lisp/textmodes/paragraphs.el | 63 +++++++------------ .../paragraphs-resources/mark-paragraph.bin | 9 +++ test/lisp/textmodes/paragraphs-tests.el | 23 +++++++ 3 files changed, 55 insertions(+), 40 deletions(-) create mode 100644 test/lisp/textmodes/paragraphs-resources/mark-paragraph.bin diff --git a/lisp/textmodes/paragraphs.el b/lisp/textmodes/paragraphs.el index 217ae10fe4d..96edfd6de36 100644 --- a/lisp/textmodes/paragraphs.el +++ b/lisp/textmodes/paragraphs.el @@ -371,50 +371,33 @@ See `forward-paragraph' for more information." (defun mark-paragraph (&optional arg allow-extend) "Put point at beginning of this paragraph, mark at end. -The paragraph marked is the one that contains point or follows -point. +The paragraph marked is the one that contains point or follows point. -With argument ARG, puts mark at the end of this or a following -paragraph, so that the number of paragraphs marked equals ARG. +With argument ARG, puts mark at end of a following paragraph, so that +the number of paragraphs marked equals ARG. -If ARG is negative, point is put at the end of this paragraph, -mark is put at the beginning of this or a previous paragraph. +If ARG is negative, point is put at end of this paragraph, mark is put +at beginning of this or a previous paragraph. Interactively (or if ALLOW-EXTEND is non-nil), if this command is -repeated or (in Transient Mark mode) if the mark is active, it -marks the next ARG paragraphs after the region already marked. -This also means when activating the mark immediately before using -this command, the current paragraph is only marked from point." - (interactive "P\np") - (let ((numeric-arg (prefix-numeric-value arg))) - (cond ((zerop numeric-arg)) - ((and allow-extend - (or (and (eq last-command this-command) mark-active) - (region-active-p))) - (if arg - (setq arg numeric-arg) - (if (< (mark) (point)) - (setq arg -1) - (setq arg 1))) - (set-mark - (save-excursion - (goto-char (mark)) - (forward-paragraph arg) - (point)))) - ;; don't activate the mark when at eob - ((and (eobp) (> numeric-arg 0))) - (t - (unless (save-excursion - (forward-line 0) - (looking-at paragraph-start)) - (backward-paragraph (cond ((> numeric-arg 0) 1) - ((< numeric-arg 0) -1) - (t 0)))) - (push-mark - (save-excursion - (forward-paragraph numeric-arg) - (point)) - t t))))) +repeated or (in Transient Mark mode) if the mark is active, +it marks the next ARG paragraphs after the ones already marked." + (interactive "p\np") + (unless arg (setq arg 1)) + (when (zerop arg) + (error "Cannot mark zero paragraphs")) + (cond ((and allow-extend + (or (and (eq last-command this-command) (mark t)) + (and transient-mark-mode mark-active))) + (set-mark + (save-excursion + (goto-char (mark)) + (forward-paragraph arg) + (point)))) + (t + (forward-paragraph arg) + (push-mark nil t t) + (backward-paragraph arg)))) (defun kill-paragraph (arg) "Kill forward to end of paragraph. diff --git a/test/lisp/textmodes/paragraphs-resources/mark-paragraph.bin b/test/lisp/textmodes/paragraphs-resources/mark-paragraph.bin new file mode 100644 index 00000000000..1905477af8c --- /dev/null +++ b/test/lisp/textmodes/paragraphs-resources/mark-paragraph.bin @@ -0,0 +1,9 @@ +First +paragraph + +Second + +Third +paragraph + +No line end \ No newline at end of file diff --git a/test/lisp/textmodes/paragraphs-tests.el b/test/lisp/textmodes/paragraphs-tests.el index bf7f37090f5..712169029de 100644 --- a/test/lisp/textmodes/paragraphs-tests.el +++ b/test/lisp/textmodes/paragraphs-tests.el @@ -24,6 +24,7 @@ ;;; Code: (require 'ert) +(require 'ert-x) ;; (require 'paragraphs) ; loaded by default (ert-deftest paragraphs-tests-sentence-end () @@ -161,5 +162,27 @@ (should (equal (buffer-string) "First sentence. Third sentence. Second sentence.")))) +(ert-deftest test-mark-paragraphs () + (with-current-buffer + (find-file-noselect (ert-resource-file "mark-paragraph.bin")) + (goto-char (point-max)) + ;; Just a sanity check that the file hasn't changed. + (should (= (point) 54)) + (mark-paragraph) + (should (= (point) 42)) + (should (= (mark) 54)) + ;; Doesn't move. + (mark-paragraph) + (should (= (point) 42)) + (should (= (mark) 54)) + (forward-line -1) + (mark-paragraph) + (should (= (point) 25)) + (should (= (mark) 42)) + (goto-char (point-min)) + (mark-paragraph) + (should (= (point) 1)) + (should (= (mark) 17)))) + (provide 'paragraphs-tests) ;;; paragraphs-tests.el ends here From e15386da5d684b1d64204db6b33fbf613cbaad50 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Thu, 7 Jan 2021 13:20:43 +0100 Subject: [PATCH 79/96] Fix quoting problem in pop3-uidl-save * lisp/net/pop3.el (pop3-uidl-save): Quote strings properly (bug#43896). --- lisp/net/pop3.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/net/pop3.el b/lisp/net/pop3.el index aa34fe7f1a3..dcac36f2a4a 100644 --- a/lisp/net/pop3.el +++ b/lisp/net/pop3.el @@ -463,7 +463,7 @@ Return non-nil if it is necessary to update the local UIDL file." (when (cdr elt) (insert "(\"" (pop elt) "\"\n ") (while elt - (insert (format "\"%s\" %s\n " (pop elt) (pop elt)))) + (insert (format "%S %s\n " (pop elt) (pop elt)))) (delete-char -4) (insert ")\n "))) (delete-char -3) From a7fdba7889b4e570b659b15710186745b1033ef8 Mon Sep 17 00:00:00 2001 From: "F. Jason Park" Date: Thu, 7 Jan 2021 13:43:13 +0100 Subject: [PATCH 80/96] Clear socks protocol scratch after authentication * lisp/net/socks.el (socks-open-connection): Fix incomplete patch titled "Append incremental message segments in socks-filter," which addressed chunk ordering but neglected to zero out the work area following successful username/password authentication (bug#45162). --- lisp/net/socks.el | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp/net/socks.el b/lisp/net/socks.el index 0d48fd7e05a..96fafc826b8 100644 --- a/lisp/net/socks.el +++ b/lisp/net/socks.el @@ -385,6 +385,7 @@ ) ) (process-put proc 'socks-state socks-state-authenticated) + (process-put proc 'socks-scratch "") (set-process-filter proc #'socks-filter))) proc))) From 7e80aecc248a78eab923005b266c939c18936c1b Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Thu, 7 Jan 2021 14:32:28 +0100 Subject: [PATCH 81/96] Add tests for mm-decode.el --- .../mm-decode-resources/8bit-multipart.bin | 20 +++++ test/lisp/gnus/mm-decode-tests.el | 73 +++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 test/lisp/gnus/mm-decode-resources/8bit-multipart.bin create mode 100644 test/lisp/gnus/mm-decode-tests.el diff --git a/test/lisp/gnus/mm-decode-resources/8bit-multipart.bin b/test/lisp/gnus/mm-decode-resources/8bit-multipart.bin new file mode 100644 index 00000000000..0b193a27234 --- /dev/null +++ b/test/lisp/gnus/mm-decode-resources/8bit-multipart.bin @@ -0,0 +1,20 @@ +From: example +To: example +Content-Type: multipart/alternative; boundary="===============2877195075946974246==" +Date: Thu, 29 Oct 2020 14:47:55 +0100 +MIME-Version: 1.0 +Subject: test + +--===============2877195075946974246== +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: 8bit + +ääää + +--===============2877195075946974246== +Content-Type: text/html; charset="utf-8" +Content-Transfer-Encoding: 8bit + +ääää + +--===============2877195075946974246==-- diff --git a/test/lisp/gnus/mm-decode-tests.el b/test/lisp/gnus/mm-decode-tests.el new file mode 100644 index 00000000000..976e7269b14 --- /dev/null +++ b/test/lisp/gnus/mm-decode-tests.el @@ -0,0 +1,73 @@ +;;; mm-decode-tests.el --- -*- lexical-binding:t -*- + +;; Copyright (C) 2021 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3, or (at your option) +;; any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;;; Code: + +(require 'ert) +(require 'ert-x) +(require 'mm-decode) + +(ert-deftest test-mm-dissect-buffer () + (with-temp-buffer + (set-buffer-multibyte nil) + (insert-file-contents-literally (ert-resource-file "8bit-multipart.bin")) + (while (search-forward "\r\n" nil t) + (replace-match "\n")) + (let ((handle (mm-dissect-buffer))) + (should (equal (mm-handle-media-type handle) "multipart/alternative")) + ;; Skip multipart type. + (pop handle) + (let ((part (pop handle))) + (should (equal (mm-handle-media-type part) "text/plain")) + (should (eq (mm-handle-encoding part) '8bit)) + (with-current-buffer (mm-handle-buffer part) + (should (equal (decode-coding-string + (buffer-string) + (intern (mail-content-type-get (mm-handle-type part) + 'charset))) + "ääää\n")))) + (let ((part (pop handle))) + (should (equal (mm-handle-media-type part) "text/html")) + (should (eq (mm-handle-encoding part) '8bit)) + (with-current-buffer (mm-handle-buffer part) + (should (equal (decode-coding-string + (buffer-string) + (intern (mail-content-type-get (mm-handle-type part) + 'charset))) + "ääää\n"))))))) + +(ert-deftest test-mm-with-part () + (with-temp-buffer + (set-buffer-multibyte nil) + (insert-file-contents-literally (ert-resource-file "8bit-multipart.bin")) + (while (search-forward "\r\n" nil t) + (replace-match "\n")) + (let ((handle (mm-dissect-buffer))) + (pop handle) + (let ((part (pop handle))) + (should (equal (decode-coding-string + (mm-with-part part + (buffer-string)) + (intern (mail-content-type-get (mm-handle-type part) + 'charset))) + "ääää\n")))))) + +;;; mm-decode-tests.el ends here From 23a887e426f81033b0de2f4c93a8525cb31c28da Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Thu, 7 Jan 2021 15:12:23 +0100 Subject: [PATCH 82/96] Add work-around for nnmaildir encoding problem * lisp/gnus/mm-decode.el (mm-with-part): Fix problem with multipart 8bit encoded posts from nnmaildir (bug#44307). --- lisp/gnus/mm-decode.el | 19 ++++++++++++++----- test/lisp/gnus/mm-decode-tests.el | 18 +++++++++++++++++- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el index 61946aa5811..2b0b61bfac6 100644 --- a/lisp/gnus/mm-decode.el +++ b/lisp/gnus/mm-decode.el @@ -1264,11 +1264,20 @@ in HANDLE." (when (and (mm-handle-buffer handle) (buffer-name (mm-handle-buffer handle))) (with-temp-buffer - (mm-disable-multibyte) - (insert-buffer-substring (mm-handle-buffer handle)) - (mm-decode-content-transfer-encoding - (mm-handle-encoding handle) - (mm-handle-media-type handle)) + (if (and (eq (mm-handle-encoding handle) '8bit) + (with-current-buffer (mm-handle-buffer handle) + enable-multibyte-characters)) + ;; Due to unfortunate historical reasons, we may have a + ;; multibyte buffer here, but if it's using an 8bit + ;; Content-Transfer-Encoding, then work around that by + ;; just ignoring the situation. + (insert-buffer-substring (mm-handle-buffer handle)) + ;; Do the decoding. + (mm-disable-multibyte) + (insert-buffer-substring (mm-handle-buffer handle)) + (mm-decode-content-transfer-encoding + (mm-handle-encoding handle) + (mm-handle-media-type handle))) ,@forms)))) (put 'mm-with-part 'lisp-indent-function 1) (put 'mm-with-part 'edebug-form-spec '(body)) diff --git a/test/lisp/gnus/mm-decode-tests.el b/test/lisp/gnus/mm-decode-tests.el index 976e7269b14..74591f919da 100644 --- a/test/lisp/gnus/mm-decode-tests.el +++ b/test/lisp/gnus/mm-decode-tests.el @@ -54,7 +54,7 @@ 'charset))) "ääää\n"))))))) -(ert-deftest test-mm-with-part () +(ert-deftest test-mm-with-part-unibyte () (with-temp-buffer (set-buffer-multibyte nil) (insert-file-contents-literally (ert-resource-file "8bit-multipart.bin")) @@ -70,4 +70,20 @@ 'charset))) "ääää\n")))))) +(ert-deftest test-mm-with-part-multibyte () + (with-temp-buffer + (set-buffer-multibyte t) + (nnheader-insert-file-contents (ert-resource-file "8bit-multipart.bin")) + (while (search-forward "\r\n" nil t) + (replace-match "\n")) + (let ((handle (mm-dissect-buffer))) + (pop handle) + (let ((part (pop handle))) + (should (equal (decode-coding-string + (mm-with-part part + (buffer-string)) + (intern (mail-content-type-get (mm-handle-type part) + 'charset))) + "ääää\n")))))) + ;;; mm-decode-tests.el ends here From fa1f41159ff10f5ae4adc51e28e051f8acd27181 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Thu, 7 Jan 2021 15:45:05 +0100 Subject: [PATCH 83/96] Edit the display-buffer doc string slightly * lisp/window.el (display-buffer): Reword the start of the doc string (bug#45688). --- lisp/window.el | 48 +++++++++++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/lisp/window.el b/lisp/window.el index cd13e6603a5..9d16e2956ea 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -7378,6 +7378,35 @@ fails, call `display-buffer-pop-up-frame'.") (defun display-buffer (buffer-or-name &optional action frame) "Display BUFFER-OR-NAME in some window, without selecting it. +To change which window is used, set `display-buffer-base-action' +to a list containing one of these \"action\" functions: + + `display-buffer-same-window' -- Use the selected window. + `display-buffer-reuse-window' -- Use a window already showing + the buffer. + `display-buffer-in-previous-window' -- Use a window that did + show the buffer before. + `display-buffer-use-some-window' -- Use some existing window. + `display-buffer-pop-up-window' -- Pop up a new window. + `display-buffer-below-selected' -- Use or pop up a window below + the selected one. + `display-buffer-at-bottom' -- Use or pop up a window at the + bottom of the selected frame. + `display-buffer-pop-up-frame' -- Show the buffer on a new frame. + `display-buffer-in-child-frame' -- Show the buffer in a + child frame. + `display-buffer-no-window' -- Do not display the buffer and + have `display-buffer' return nil immediately. + +For instance: + + (setq display-buffer-below-selected '(display-buffer-at-bottom)) + +Buffer display can be further customized to a very high degree; +the rest of this docstring explains some of the many +possibilities, and also see `(emacs)Window Choice' for more +information. + BUFFER-OR-NAME must be a buffer or a string naming a live buffer. Return the window chosen for displaying that buffer, or nil if no such window is found. @@ -7403,23 +7432,8 @@ function in the combined function list in turn, passing the buffer as the first argument and the combined action alist as the second argument, until one of the functions returns non-nil. -Action functions and the action they try to perform are: - `display-buffer-same-window' -- Use the selected window. - `display-buffer-reuse-window' -- Use a window already showing - the buffer. - `display-buffer-in-previous-window' -- Use a window that did - show the buffer before. - `display-buffer-use-some-window' -- Use some existing window. - `display-buffer-pop-up-window' -- Pop up a new window. - `display-buffer-below-selected' -- Use or pop up a window below - the selected one. - `display-buffer-at-bottom' -- Use or pop up a window at the - bottom of the selected frame. - `display-buffer-pop-up-frame' -- Show the buffer on a new frame. - `display-buffer-in-child-frame' -- Show the buffer in a - child frame. - `display-buffer-no-window' -- Do not display the buffer and - have `display-buffer' return nil immediately. +See above for the action functions and the action they try to +perform. Action alist entries are: `inhibit-same-window' -- A non-nil value prevents the same From 0e6b74d2047452bb1fc3285921465132aeda0cb7 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Thu, 7 Jan 2021 16:00:58 +0100 Subject: [PATCH 84/96] Fix typo in last display-buffer doc string change * lisp/window.el (display-buffer): Fix typo in last doc string change. --- lisp/window.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/window.el b/lisp/window.el index 9d16e2956ea..c54a0db211e 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -7400,7 +7400,7 @@ to a list containing one of these \"action\" functions: For instance: - (setq display-buffer-below-selected '(display-buffer-at-bottom)) + (setq display-buffer-base-action '(display-buffer-at-bottom)) Buffer display can be further customized to a very high degree; the rest of this docstring explains some of the many From 40a0f8a3a2ac790bb398c321e7eb6928da330511 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Thu, 7 Jan 2021 16:35:48 +0100 Subject: [PATCH 85/96] Add a display-buffer window selection function that's more like XEmacs * doc/lispref/windows.texi (Buffer Display Action Functions): Document it. * lisp/window.el (display-buffer--action-function-custom-type): Add. (display-buffer): Mention it. (display-buffer-use-least-recent-window): New function (bug#45688). * src/window.c (Fwindow_bump_use_time): New function. --- doc/lispref/windows.texi | 6 ++++++ etc/NEWS | 9 +++++++++ lisp/window.el | 13 +++++++++++++ src/window.c | 13 +++++++++++++ 4 files changed, 41 insertions(+) diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi index b0906acbad5..f305d1a8ee8 100644 --- a/doc/lispref/windows.texi +++ b/doc/lispref/windows.texi @@ -2634,6 +2634,12 @@ window and displaying the buffer in that window. It can fail if all windows are dedicated to other buffers (@pxref{Dedicated Windows}). @end defun +@defun display-buffer-use-least-recent-window buffer alist +This function is like @code{display-buffer-use-some-window}, but will +not reuse the current window, and will use the least recently +switched-to window. +@end defun + @defun display-buffer-in-direction buffer alist This function tries to display @var{buffer} at a location specified by @var{alist}. For this purpose, @var{alist} should contain a diff --git a/etc/NEWS b/etc/NEWS index 48fb4b88e15..14d6b45c929 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -373,6 +373,15 @@ disabled entirely. ** Windows ++++ +*** New 'display-buffer' function 'display-buffer-use-least-recent-window' +This is like 'display-buffer-use-some-window', but won't reuse the +current window, and when called repeatedly will try not to reuse a +previously selected window. + +*** New function 'window-bump-use-time'. +This updates the use time of a window. + *** The key prefix 'C-x 4 1' displays next command buffer in the same window. It's bound to the command 'same-window-prefix' that requests the buffer of the next command to be displayed in the same window. diff --git a/lisp/window.el b/lisp/window.el index c54a0db211e..37e1800ad11 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -7243,6 +7243,7 @@ The actual non-nil value of this variable will be copied to the (const display-buffer-below-selected) (const display-buffer-at-bottom) (const display-buffer-in-previous-window) + (const display-buffer-use-least-recent-window) (const display-buffer-use-some-window) (const display-buffer-use-some-frame) (function :tag "Other function")) @@ -7387,6 +7388,8 @@ to a list containing one of these \"action\" functions: `display-buffer-in-previous-window' -- Use a window that did show the buffer before. `display-buffer-use-some-window' -- Use some existing window. + `display-buffer-use-least-recent-window' -- Try to avoid re-using + windows that have recently been switched to. `display-buffer-pop-up-window' -- Pop up a new window. `display-buffer-below-selected' -- Use or pop up a window below the selected one. @@ -8256,6 +8259,16 @@ indirectly called by the latter." (when (setq window (or best-window second-best-window)) (window--display-buffer buffer window 'reuse alist)))) +(defun display-buffer-use-least-recent-window (buffer alist) + "Display BUFFER in an existing window, but that hasn't been used lately. +This `display-buffer' action function is like +`display-buffer-use-some-window', but will cycle through windows +when displaying buffers repeatedly, and if there's only a single +window, it will split the window." + (when-let ((window (display-buffer-use-some-window + buffer (cons (cons 'inhibit-same-window t) alist)))) + (window-bump-use-time window))) + (defun display-buffer-use-some-window (buffer alist) "Display BUFFER in an existing window. Search for a usable window, set that window to the buffer, and diff --git a/src/window.c b/src/window.c index 58204c13e44..5e78aa400b5 100644 --- a/src/window.c +++ b/src/window.c @@ -8100,6 +8100,18 @@ and scrolling positions. */) return Qt; return Qnil; } + +DEFUN ("window-bump-use-time", Fwindow_bump_use_time, + Swindow_bump_use_time, 1, 1, 0, + doc: /* Mark WINDOW as having been recently used. */) + (Lisp_Object window) +{ + struct window *w = decode_valid_window (window); + + w->use_time = ++window_select_count; + return Qnil; +} + static void init_window_once_for_pdumper (void); @@ -8573,6 +8585,7 @@ displayed after a scrolling operation to be somewhat inaccurate. */); defsubr (&Swindow_vscroll); defsubr (&Sset_window_vscroll); defsubr (&Scompare_window_configurations); + defsubr (&Swindow_bump_use_time); defsubr (&Swindow_list); defsubr (&Swindow_list_1); defsubr (&Swindow_prev_buffers); From f5b8e5a7577c9b05bae1849f7b507b16c1f37c96 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Thu, 7 Jan 2021 16:43:27 +0100 Subject: [PATCH 86/96] * test/lisp/filenotify-tests.el (file-notify-test07-many-events-remote): Mark it as unstable also on emba. --- test/lisp/filenotify-tests.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el index 047109a96a2..d73b072661a 100644 --- a/test/lisp/filenotify-tests.el +++ b/test/lisp/filenotify-tests.el @@ -1265,7 +1265,7 @@ delivered." ;; Unpredictable failures, eg https://hydra.nixos.org/build/86016286 (file-notify--deftest-remote file-notify-test07-many-events "Check that events are not dropped for remote directories." - (getenv "EMACS_HYDRA_CI")) + (or (getenv "EMACS_HYDRA_CI") (getenv "EMACS_EMBA_CI"))) (ert-deftest file-notify-test08-backup () "Check that backup keeps file notification." From 3dc3874c768060e720aecc1c4ac0e87eea44d073 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Thu, 7 Jan 2021 16:47:26 +0100 Subject: [PATCH 87/96] Further display-buffer doc changes * lisp/window.el (display-buffer): `display-buffer-alist' is apparently the variable the user should be directed towards. --- lisp/window.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/window.el b/lisp/window.el index 37e1800ad11..38be7789062 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -7379,8 +7379,8 @@ fails, call `display-buffer-pop-up-frame'.") (defun display-buffer (buffer-or-name &optional action frame) "Display BUFFER-OR-NAME in some window, without selecting it. -To change which window is used, set `display-buffer-base-action' -to a list containing one of these \"action\" functions: +To change which window is used, set `display-buffer-alist' +to an expression containing one of these \"action\" functions: `display-buffer-same-window' -- Use the selected window. `display-buffer-reuse-window' -- Use a window already showing @@ -7403,7 +7403,7 @@ to a list containing one of these \"action\" functions: For instance: - (setq display-buffer-base-action '(display-buffer-at-bottom)) + (setq display-buffer-alist '((\".*\" display-buffer-at-bottom))) Buffer display can be further customized to a very high degree; the rest of this docstring explains some of the many From c8448f61858c156dcdc78bb88171544a4eff0ff5 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Thu, 7 Jan 2021 18:51:50 +0100 Subject: [PATCH 88/96] Remove an outdated comment * lisp/subr.el: Remove comment to reflect recent change in the definition of global-map, esc-map and ctl-x-map. --- lisp/subr.el | 3 --- 1 file changed, 3 deletions(-) diff --git a/lisp/subr.el b/lisp/subr.el index a5a979a2172..11aabfe504d 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1239,9 +1239,6 @@ in a cleaner way with command remapping, like this: ;;;; The global keymap tree. -;; global-map, esc-map, and ctl-x-map have their values set up in -;; keymap.c; we just give them docstrings here. - (defvar esc-map (let ((map (make-keymap))) (define-key map "u" #'upcase-word) From c0ca9359179071cc634adc0efd4523907b1e2e74 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Thu, 7 Jan 2021 19:56:59 +0200 Subject: [PATCH 89/96] * lisp/mb-depth.el (minibuffer-depth-indicator): Add :group 'minibuffer'. --- lisp/mb-depth.el | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp/mb-depth.el b/lisp/mb-depth.el index ea2ea174b50..f9a24e34bf2 100644 --- a/lisp/mb-depth.el +++ b/lisp/mb-depth.el @@ -37,6 +37,7 @@ and must return a string.") (defface minibuffer-depth-indicator '((t :inherit highlight)) "Face to use for minibuffer depth indicator." + :group 'minibuffer :version "28.1") ;; An overlay covering the prompt. This is a buffer-local variable in From cd56406b621bebff484a2978662c98f7689540bf Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Thu, 7 Jan 2021 20:08:44 +0200 Subject: [PATCH 90/96] * lisp/tab-bar.el: Improve tab-bar-show (bug#45556) * lisp/tab-bar.el (tab-bar-show): Change :set lambda to update all frames. Improve docstring. --- etc/NEWS | 4 ++-- lisp/tab-bar.el | 27 ++++++++++++++++++++------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 14d6b45c929..eaaf9bfb0ef 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -412,8 +412,8 @@ value of 'tab-bar-show'. --- *** New command 'toggle-frame-tab-bar'. -It can be used to enable/disable the tab bar individually -on each frame independently from the state of `tab-bar-mode'. +It can be used to enable/disable the tab bar individually on each frame +independently from the value of 'tab-bar-mode' and 'tab-bar-show'. --- *** New user option 'tab-bar-tab-name-format-function'. diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 5a95e5975de..7e556550daa 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -187,9 +187,9 @@ on a console which has no window system but does have a mouse." ;; Clicking anywhere outside existing tabs will add a new tab (tab-bar-new-tab))))) -;; Used in the Show/Hide menu, to have the toggle reflect the current frame. (defun toggle-tab-bar-mode-from-frame (&optional arg) "Toggle tab bar on or off, based on the status of the current frame. +Used in the Show/Hide menu, to have the toggle reflect the current frame. See `tab-bar-mode' for more information." (interactive (list (or current-prefix-arg 'toggle))) (if (eq arg 'toggle) @@ -236,18 +236,31 @@ If the value is `1', then hide the tab bar when it has only one tab, and show it again once more tabs are created. If nil, always keep the tab bar hidden. In this case it's still possible to use persistent named window configurations by relying on -keyboard commands `tab-new', `tab-close', `tab-next', `tab-switcher', etc." +keyboard commands `tab-new', `tab-close', `tab-next', `tab-switcher', etc. + +Setting this variable directly does not take effect; please customize +it (see the info node `Easy Customization'), then it will automatically +update the tab bar on all frames according to the new value. + +To enable or disable the tab bar individually on each frame, +you can use the command `toggle-frame-tab-bar'." :type '(choice (const :tag "Always" t) (const :tag "When more than one tab" 1) (const :tag "Never" nil)) :initialize 'custom-initialize-default :set (lambda (sym val) (set-default sym val) - (tab-bar-mode - (if (or (eq val t) - (and (natnump val) - (> (length (funcall tab-bar-tabs-function)) val))) - 1 -1))) + ;; Preload button images + (tab-bar-mode 1) + ;; Then handle each frame individually + (dolist (frame (frame-list)) + (set-frame-parameter + frame 'tab-bar-lines + (if (or (eq val t) + (and (natnump val) + (> (length (funcall tab-bar-tabs-function frame)) + val))) + 1 0)))) :group 'tab-bar :version "27.1") From 656801f5bb3a9d619e1c0b987d905c22387cc462 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Fri, 8 Jan 2021 09:58:31 +0100 Subject: [PATCH 91/96] * test/lisp/net/tramp-tests.el (tramp-test31-interrupt-process): Tag it :unstable on hydra. --- test/lisp/net/tramp-tests.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 819d69b600e..e1cb9939f29 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -4670,7 +4670,7 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'." (ert-deftest tramp-test31-interrupt-process () "Check `interrupt-process'." - :tags (if (getenv "EMACS_EMBA_CI") + :tags (if (or (getenv "EMACS_HYDRA_CI") (getenv "EMACS_EMBA_CI")) '(:expensive-test :unstable) '(:expensive-test)) (skip-unless (tramp--test-enabled)) (skip-unless (tramp--test-sh-p)) From 62e0c675908cc11907c15d1ae084b7bca7890a1a Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 8 Jan 2021 13:53:28 +0200 Subject: [PATCH 92/96] Fix syntax of space characters * lisp/international/characters.el (tbl): Give all the space characters whose Unicode General Category is Zs the 'space' syntax. (Bug#45660) --- lisp/international/characters.el | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lisp/international/characters.el b/lisp/international/characters.el index 87e8589e6fd..9bce419b489 100644 --- a/lisp/international/characters.el +++ b/lisp/international/characters.el @@ -526,9 +526,6 @@ with L, LRE, or LRO Unicode bidi character type.") ;; FIXME: We should probably just use the Unicode properties to set ;; up the syntax table. - ;; NBSP isn't semantically interchangeable with other whitespace chars, - ;; so it's more like punctuation. - (set-case-syntax ?  "." tbl) (set-case-syntax ?¡ "." tbl) (set-case-syntax ?¦ "_" tbl) (set-case-syntax ?§ "." tbl) @@ -602,11 +599,17 @@ with L, LRE, or LRO Unicode bidi character type.") ;; Cyrillic Extended-C (modify-category-entry '(#x1C80 . #x1C8F) ?y) - ;; general punctuation + ;; space characters (see section 6.2 in the Unicode Standard) + (set-case-syntax ?  " " tbl) (setq c #x2000) (while (<= c #x200b) (set-case-syntax c " " tbl) (setq c (1+ c))) + (let ((chars '(#x202F #x205F #x3000))) + (while chars + (set-case-syntax (car chars) " " tbl) + (setq chars (cdr chars)))) + ;; general punctuation (while (<= c #x200F) (set-case-syntax c "." tbl) (setq c (1+ c))) From 705292c200a6e35127c26a0ff676f41a072fefa4 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Thu, 7 Jan 2021 19:01:55 +0100 Subject: [PATCH 93/96] Remove unused DEFSYM * src/minibuf.c (syms_of_minibuf) : Remove unused DEFSYM. --- src/minibuf.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/minibuf.c b/src/minibuf.c index 8b235690199..5ee440f6622 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -2013,9 +2013,6 @@ syms_of_minibuf (void) DEFSYM (Qminibuffer_setup_hook, "minibuffer-setup-hook"); DEFSYM (Qminibuffer_exit_hook, "minibuffer-exit-hook"); - /* The maximum length of a minibuffer history. */ - DEFSYM (Qhistory_length, "history-length"); - DEFSYM (Qcurrent_input_method, "current-input-method"); DEFSYM (Qactivate_input_method, "activate-input-method"); DEFSYM (Qcase_fold_search, "case-fold-search"); From f5cfe5a0a9c64f001f1cec3f78b811a3b6e69b09 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Fri, 8 Jan 2021 12:27:32 +0100 Subject: [PATCH 94/96] * test/lisp/subr-tests.el (subr-test-kbd): New test. --- test/lisp/subr-tests.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index 8d19a268773..54f6eb4b2a1 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el @@ -61,6 +61,18 @@ (quote (0 font-lock-keyword-face)))))))) + +;;;; Keymap support. + +(ert-deftest subr-test-kbd () + (should (equal (kbd "f") "f")) + (should (equal (kbd "F1") "F1")) + (should (equal (kbd "RET") "\C-m")) + (should (equal (kbd "C-x a") "\C-xa"))) + + +;;;; Mode hooks. + (defalias 'subr-tests--parent-mode (if (fboundp 'prog-mode) 'prog-mode 'fundamental-mode)) From 5ac7b480757d8731fe2bda0452e48f0cd0356aa4 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Fri, 8 Jan 2021 15:16:02 +0100 Subject: [PATCH 95/96] Lift define-prefix-command to Lisp * lisp/subr.el (define-prefix-command): New defun. * src/keymap.c (Fdefine_prefix_command): Remove DEFUN. (syms_of_keymap): Remove defsubr for Fdefine_prefix_command. * test/lisp/subr-tests.el (subr-test-define-prefix-command): New test. --- lisp/subr.el | 16 ++++++++++++++++ src/keymap.c | 23 ----------------------- test/lisp/subr-tests.el | 11 +++++++++++ 3 files changed, 27 insertions(+), 23 deletions(-) diff --git a/lisp/subr.el b/lisp/subr.el index 11aabfe504d..b92744cdcbe 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -995,6 +995,22 @@ a menu, so this function is not useful for non-menu keymaps." (setq inserted t))) (setq tail (cdr tail))))) +(defun define-prefix-command (command &optional mapvar name) + "Define COMMAND as a prefix command. COMMAND should be a symbol. +A new sparse keymap is stored as COMMAND's function definition and its +value. +This prepares COMMAND for use as a prefix key's binding. +If a second optional argument MAPVAR is given, it should be a symbol. +The map is then stored as MAPVAR's value instead of as COMMAND's +value; but COMMAND is still defined as a function. +The third optional argument NAME, if given, supplies a menu name +string for the map. This is required to use the keymap as a menu. +This function returns COMMAND." + (let ((map (make-sparse-keymap name))) + (fset command map) + (set (or mapvar command) map) + command)) + (defun map-keymap-sorted (function keymap) "Implement `map-keymap' with sorting. Don't call this function; it is for internal use only." diff --git a/src/keymap.c b/src/keymap.c index 3d1993869bc..1197f6fd4a5 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -1712,28 +1712,6 @@ bindings; see the description of `lookup-key' for more details about this. */) return Flist (j, maps); } -DEFUN ("define-prefix-command", Fdefine_prefix_command, Sdefine_prefix_command, 1, 3, 0, - doc: /* Define COMMAND as a prefix command. COMMAND should be a symbol. -A new sparse keymap is stored as COMMAND's function definition and its -value. -This prepares COMMAND for use as a prefix key's binding. -If a second optional argument MAPVAR is given, it should be a symbol. -The map is then stored as MAPVAR's value instead of as COMMAND's -value; but COMMAND is still defined as a function. -The third optional argument NAME, if given, supplies a menu name -string for the map. This is required to use the keymap as a menu. -This function returns COMMAND. */) - (Lisp_Object command, Lisp_Object mapvar, Lisp_Object name) -{ - Lisp_Object map = Fmake_sparse_keymap (name); - Ffset (command, map); - if (!NILP (mapvar)) - Fset (mapvar, map); - else - Fset (command, map); - return command; -} - DEFUN ("use-global-map", Fuse_global_map, Suse_global_map, 1, 1, 0, doc: /* Select KEYMAP as the global keymap. */) (Lisp_Object keymap) @@ -3280,7 +3258,6 @@ be preferred. */); defsubr (&Sminor_mode_key_binding); defsubr (&Sdefine_key); defsubr (&Slookup_key); - defsubr (&Sdefine_prefix_command); defsubr (&Suse_global_map); defsubr (&Suse_local_map); defsubr (&Scurrent_local_map); diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index 54f6eb4b2a1..83031c44fcd 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el @@ -70,6 +70,17 @@ (should (equal (kbd "RET") "\C-m")) (should (equal (kbd "C-x a") "\C-xa"))) +(ert-deftest subr-test-define-prefix-command () + (define-prefix-command 'foo-prefix-map) + (should (keymapp foo-prefix-map)) + (should (fboundp #'foo-prefix-map)) + ;; With optional argument. + (define-prefix-command 'bar-prefix 'bar-prefix-map) + (should (keymapp bar-prefix-map)) + (should (fboundp #'bar-prefix)) + ;; Returns the symbol. + (should (eq (define-prefix-command 'foo-bar) 'foo-bar))) + ;;;; Mode hooks. From a31bfd594523dc06941ceb89cdbeabcd4a5d19f7 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Fri, 8 Jan 2021 15:26:02 +0100 Subject: [PATCH 96/96] Merge recently added kbd tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * test/lisp/subr-tests.el (subr--kbd): Merge test... (subr-test-kbd): ...with this one. Fix thinko in my previous commit. Thanks to Mattias Engdegård . --- test/lisp/subr-tests.el | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index 83031c44fcd..21185303360 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el @@ -66,9 +66,15 @@ (ert-deftest subr-test-kbd () (should (equal (kbd "f") "f")) - (should (equal (kbd "F1") "F1")) + (should (equal (kbd "") [f1])) (should (equal (kbd "RET") "\C-m")) - (should (equal (kbd "C-x a") "\C-xa"))) + (should (equal (kbd "C-x a") "\C-xa")) + ;; Check that kbd handles both new and old style key descriptions + ;; (bug#45536). + (should (equal (kbd "s-") [s-return])) + (should (equal (kbd "") [s-return])) + (should (equal (kbd "C-M-") [C-M-return])) + (should (equal (kbd "") [C-M-return]))) (ert-deftest subr-test-define-prefix-command () (define-prefix-command 'foo-prefix-map) @@ -653,13 +659,5 @@ See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19350." (should (>= (length (apropos-internal "^help" #'commandp)) 15)) (should-not (apropos-internal "^next-line$" #'keymapp))) -(ert-deftest subr--kbd () - ;; Check that kbd handles both new and old style key descriptions - ;; (bug#45536). - (should (equal (kbd "s-") [s-return])) - (should (equal (kbd "") [s-return])) - (should (equal (kbd "C-M-") [C-M-return])) - (should (equal (kbd "") [C-M-return]))) - (provide 'subr-tests) ;;; subr-tests.el ends here